Factory Pattern

Following UML [1] describes the key concepts of this pattern:

  • Client is coding on Interface not class, which make the client decoupled from concrete product type
  • Factory encapsulates the creation detail of the product, which make any change of creation is transparent to client

Factory Pattern

The next question is how does Client tell the Factory to create different Product? There are several ways:

  • pass a parameter to the Factory
  • register the product into Factory, using Reflection, etc.
  •  Factory design pattern with abstractions(Factory Method): create Factory for each Product


  1. http://www.oodesign.com/factory-pattern.html
  2. http://en.wikipedia.org/wiki/Factory_(object-oriented_programming)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s