Singleton Pattern - Common Uses

Common Uses

  • The Abstract Factory, Builder, and Prototype patterns can use Singletons in their implementation.
  • Facade Objects are often Singletons because only one Facade object is required.
  • State objects are often Singletons.
  • Singletons are often preferred to global variables because:
    • They do not pollute the global name space (or, in languages with namespaces, their containing namespace) with unnecessary variables.
    • They permit lazy allocation and initialization, whereas global variables in many languages will always consume resources.

Read more about this topic:  Singleton Pattern

Famous quotes containing the word common:

    What the study of history and artistic creation have in common is a mode of forming images.
    Johan Huizinga (1872–1945)

    Many women cut back what had to be done at home by redefining what the house, the marriage and, sometimes, what the child needs. One woman described a fairly common pattern: “I do my half. I do half of his half, and the rest doesn’t get done.”
    Arlie Hochschild (20th century)