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:

    There seems to be a common strain of miserliness in the American people when it comes to throwing away toothpaste tubes which have a little left in the bottom.
    Robert Benchley (1889–1945)

    Let us pray for the whole state of Christ’s Church Militant here in earth.
    —Book Of Common Prayer, The. Holy Communion, “Prayer for the Church Militant,” (1662)