Avijeet Dash and Satyabrata Dash
A creational design pattern abstracts object creation process to a different
subsystem.
They help make a system independent of how its objects are created, composed
and represented.
There are five creational patterns.
Class Creation Pattern uses inheritance to vary the class that’s
instantiated. Factory Method is an example of Class Creational Pattern.
Object Creational Pattern will delegate instantiation to another object.
The other four creational patterns belong to this category.
All the different creational patterns are very closely related. They can be
competitors or complementary at times. There are cases when either Abstract
Factory or Builder can be used. At other times they work together, like Abstract
Factory may use Singleton or Prototype in implementation.
In the tutorial, each creational pattern has been explained with an example.
The UML diagram explains the major objects involved and their collaboration. The
sample code shows implementation of the pattern in Java.
(The authors are senior developers at MindTree Consulting. They can be
reached at avijeetd@mindtree.com and satyabrata_dash@mindtree.com.
References: Design Patterns, elements of reusable object-oriented software
by Gamma, Helm, Johnson and Design Patterns in Java by James W. Cooper)