The factory method pattern is an object oriented design pattern to implement the concept of factories.Like other creational patterns ,it deals with the problem of creating objects without specifying the exact class of the object that will be created.
The creation of object is usually a complex process .The object creation may lead to significant duplication of code,may require information not accessible to the composing object ,may not provide sufficient level of abstraction or may otherwise not be a part of composing object.The factory method design patterns handles these problems by defining a seperate method for creating the object,which subclasses can then override to specify the derived type of product that will be created.
some of the processes required in creating of the object include
- Determining which object to create
- Managing the lifetime of the object
- Managing specialized build up and tear down concerns of the objects
The term factory method refers to a method of a factory whose main purpose is creation of objects
No comments:
Post a Comment