We've a design patterns study group here using
the HFDP book, which we enjoy a lot.
One thing we noticed in our last session is that
the abstract factory pattern somehow didn't flow
for us. Investigating, discussing, thinking,
we believe what blew us is two things:
1st) Wouldn't it make more sense if the
PizzaIngredientFactory is still a
PizzaFactory, that is, if the abstract factory is enhanced with the ability to create pizzas as well. This would be in line with the GoF's abstract factory
MazeFactory example as well (GoF, p.92), where the creation of the Maze itself is part of the abstract factory.
2nd) Further, the other thing which troubled us is the
ChicagoPizzaStore. Shouldn't the store specifics be dealt with only by having selected the appropriate factory ?
We've changed the example's source code to be aligned with our thinking, and to us it looks easier to understand, especially when comparing it to the preceding Factory Method example.
Thoughts/opinions very appreciated,