Tuesday, April 19, 2011

Factory Method Design Pattern

In factory pattern we define an interface to create objects. Concrete class will decide which object need to be created based on parameters passed to the creation method. Withing the factory some times it will maintain an object pool to minimize the cost of creation and initialization of objects. The creation of objects may need some lot of tasks like passing some long parameter list to constructor and setting some required properties via setters. so if we do this object creation every where their will be a massive code duplication. this has a maintainability issues and code readability issues. Some times creation of object may need some resource not appropriate to view in every where.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home