Creational Patterns

All of the creational patterns deal with the best way to create instances of objects. This is important because your program should not depend on how objects are created and arranged. In Java, of course, the simplest way to create an instance of an object is by using the new operator.

Fred = new Fred(); //instance of Fred class

However, this really amounts to hard coding how you create the object within your program. In many cases, the exact nature of the object that is created could vary with the needs of the program from time to time and abstracting the creation process into a special "creator" class can make your program more flexible and general.  (Each chapter is in PDF format)

The Factory Method provides a simple decision making class which returns one of several possible subclasses of an abstract base class depending on data it is provided.

The Abstract Factory Method provides an interface to create and return one of several families of related objects.

The Builder Pattern separates the construction of a complex object from its representation, so that several different representations can be created depending on the needs of the program.

The Prototype Pattern starts with an initialized and instantiated class and copies or clones it to make new instances rather than creating new instances.

The Singleton Pattern provides a class of which there can be no more than instance, and provides a single global point of access to that instance.

Summary of Creational Patterns