GoF Creational Patterns

See Also

GoF (Gang of Four) creational patterns abstract the instantiation process. These patterns help make a system independent of the objects that it creates. There are two types of creational patterns: class creational patterns and object creational patterns. Class creational patterns use inheritance to vary the class that is instantiated. Object creational patterns delegate instantiation.

The table below describes each of the GoF creational patterns:

Pattern Name Design Problem Handled Role Description
Abstract Factory Defines an interface used to create objects in a generic manner, without having to specify concrete classes. AbstractFactory Defines a public interface used to create abstract product objects
ConcreteFactory Defines the operations to create concrete product objects
Abstract Product Defines a public interface for a type of product.
ConcreteProduct Declares a product object that will be instantiated by its related concrete factory. Defines the AbstractProduct interface.
Client Manipulates the AbstractFactory and AbstractProduct objects.
Builder The construction of a complex object is separated from its representation so that the same construction process can create different representations. Builder Defines the required operations for creating various parts of a Product object.
ConcreteBuilder Implements the operations declared in the Builder interface
Director Builds a specific product via the interface exposed by the Builder object.
Product The concrete type the Builder object creates.
Factory Method Provide an interface for creating an object. Subclasses implementing the base Factory interface can decide what concrete object to create at runtime Product Defines the public interface that allows clients to create objects through.
Concrete Product Implements the operations declared in the Product interface.
Creator Defines the operations used to create objects that implement the Product interface.
ConcreteCreator Implements the operations declared in the Creator interface
Prototype Provides an interface from which a client can have a particular object handle the specific details of cloning that same object, resulting in an exact duplicate. Prototype Provides a consistent method that can be used to clone the current object.
ConcretePrototype Implements the operations declared in the Prototype interface.
Client Manipulates the Prototype objects
Singleton Guarantees that only one instance of a particular class type is ever instantiated, while at the same time providing global access for all interested clients to that instance. Singleton Defines a set of operations that allows clients access to a single instance of this type.
See Also
GoF Behavioral Patterns
GoF Structural Patterns

Legal Notices