Creational Design Patterns

Creational Design Patterns abstract the process of instantiation/Creation of objects. And, make the system independent of how its objects are created, composed and represented.

Abstract Factory : Provides an interface for creating families of related or dependent objects without specifying their concrete classes. It is a creational pattern to create families of objects.

Factory Method : Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses. It lets to to get an individual member from a family.

Prototype : Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

Builder : Abstract the steps of construction of a complex object from its representation so that the same construction process can create different representations.

Singleton : Restrict the instantiation of a class to a specific number of objects and provide a global access point.

Notes :

a) The factory is concerned with what is made, the builder with how it is made. Builder returns the product as the final step, but as far as the Abstract Factory is concerned, the product gets returned immediately.
b) In the factory method design pattern all creators needs to be subclassed while in Abstract Factory method only one class is need to be subclassed. Factory method has only one creator while abstract factory method has multiple creators. Scope of the Factory method is class level i.e. factory method is implemented using the subclassing (inheritance), while Abstract Factory method uses delegation.


Leave a Reply

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

You are commenting using your 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