Vote up, vote down. It doesn't matter which - just vote! Login and vote now.
By shamsm
via shamsmi.blogspot.com
Submitted: Apr 21 2008 / 11:53
Last year I had wrote about the factory patterns, I just thought I'd share those links with you all.
Simple Factory: http://shamsmi.blogspot.com/2007/08/simple-factory.html
Factory Method Pattern: http://shamsmi.blogspot.com/2007/08/factory-method-pattern.html
Abstract Factory Pattern: http://shamsmi.blogspot.com/2007/08/abstract-factory-pattern.html
Comments
Jakob Jenkov replied ago:
Nice of you to share them :-)
One comment: You state that "it is time to familiarize ourselves with ... Favor Object Composition over Inheritance", but your text doesn't really explain how the abstract factory pattern adheres to this rule.
If you continue to write about creational patterns, may I suggest adding the whole issue of dependency injection containers, which hide whatever factory pattern you choose to use, from the objects created?
shamsm replied ago:
@jj83777
thanks for your comments.
regarding Favor Object Composition over Inheritance, we can see in the Fountain class that we now maintain a reference to AbstractFountainFactory to perform the createXxx() operations.
regarding DI, I must admit DI was not into my consideration when i wrote, However, any instance of AbstractFountainFactory could have been DI-ed into the Fountain class using constructor -based or setter-based injection :)
Voters For This Link (3)
Voters Against This Link (0)