Abstract Factory Design Pattern
December 26, 2005 · 2 Comments
Someone asked today whether the abstract factory design pattern might be overkill for general ColdFusion web applications. I said, yes, we would find more applications for the factory method design pattern in our world - abstract factories are pretty complex beasts.
So, what's the difference between the two? With factory method, you generally provide a key of some sort and the method yields an object of that type. We see this with hand-coded factories that we give a text string to and get back an object - the text string is either a simple key, the name of a component type or the ID of some object described elsewhere (e.g., an XML file). ChiliBeans and ColdSpring are two good examples of factory methods.
With abstract factory, you usually have multiple factory implementations and each factory implementation is responsible for creating objects that are usually in a related hierarchy.
We typically just say "factory" and we mean "factory method". Want to see an abstract factory in all its glory (gory?)... check out this 1996 article I wrote about building a compiler. I didn't call it an abstract factory design pattern because back then I didn't know the names of those patterns very well (the "Gang of Four" Design Patterns book appeared only two years earlier).
If you're feeling masochistic and want to understand a bit more about what makes me tick, feel free to read the entire compiler writing series (six parts, written between 1994 and 1996 and published in Overload).
Tags: architecture

2 responses so far ↓
1 jim collins // Dec 27, 2005 at 8:25 AM
2 Sean Corfield // Dec 27, 2005 at 12:53 PM
Leave a Comment