There is no particular limit to the number of creational patterns, any more than there is a finite number of possible blueprints for a house,
there are five which are particularly well-known.
- Factory Method pattern
- Abstract Factory
We have already looked at the Singleton pattern.
Later in this module, you will have a chance to explore the Factory Method pattern
The other three common creational patterns are described in this SlideShow:
1)Abstract Factory pattern defines an interface for creating instances of several related abstract classes without specifying their concrete subclasses. The java.awt.Toolkit class used to create native peers for graphical user interface components is an example of an abstract factory class..
2)Builder Pattern builds different complex objects from the same set of component parts. For example, the Director class might feed a long list of names and addresses into the Builder. The Builder might build an HTML page from that list, an XML page, or a PostScript file, depending on what type of Builder it was.
3)The Prototype pattern creates new objects by copying a prototype object. By changing the object that is copied, you change the object that is created. This is useful when you need many different copies of a relatively complex object, all of which have the same initial state.
Creational: This deals with the concept of how an object can be created.
This often involves isolating the details of object creation so your code is not dependent on what types of objects there are and thus does not have to be changed when you add a new type of object.
The aforementioned Singleton is classified as a creational pattern, and later in this course you will see examples of the Factory Method and Prototype.