Posts

Showing posts from January, 2010

Factory Method Pattern - Misconception

Image
This post does not talk about the Factory Method Pattern, but I would like to discuss about from where it starts. Recently I had the privilege to attend a training on the topic. I do not miss opportunity to attend any session on process or pattern, you always have something to learn. It was an good interactive session but we had the same old discussion that instead getting to the factory method we ended up discussing the implementation (some may call it simple factory idom, but i dont) forgetting that patterns only talk about the behavior and interaction and not about implementation. Let me take a chance to explain the Factory Method Factory Method - I will use the common example of PizzaFactory as used by Head First to explain the factory method: Elements: Pizza (Product) SimplePizzaFactory (Creator) Definition: The essence of the Factory Pattern is to "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a