Creational pattern

From Wikipedia, the free encyclopedia

In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.

Some examples of creational design patterns include:

  • Abstract factory pattern: centralize decision of what factory to instantiate
  • Factory method pattern: centralize creation of an object of a specific type choosing one of several implementations
  • Builder pattern: separate the construction of a complex object from its representation so that the same construction process can create different representations
  • Lazy initialization pattern: tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed
  • Object pool: avoid expensive acquisition and release of resources by recycling objects that are no longer in use
  • Prototype pattern: used when the inherent cost of creating a new object in the standard way (e.g., using the 'new' keyword) is prohibitively expensive for a given application
  • Singleton pattern: restrict instantiation of a class to one object


[edit] See also