In a couple of different threads, I noticed Ilja Preuss mentioning that the Abstract Factory is more like (or a special form of) Strategy pattern.
I would like to understand this better. I had the following definition of Strategy in my mind: Strategy defines a family of algorithms, encapsulates each one of them, makes them interchangable and lets them vary independent of the client that uses it.
This is what I understood from the Head First Design Patterns. And my interpretation says that, Strategy basically deals with a typical kind of problem of locking some implementation within inheritance hierarchy. By seperating out those implementation (call them algorithm), encapsulating them, and having a composition between the inheritance hierarchy and the algorithm hierarchy solves that problem and helps achieve more flexibility.
Whereas the Abstract Factory deals more with creating instances of family of related classes.
With other words: Abstract Factory is a Strategy where the algorithms are concerned with creating instances.
Does that make sense?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus