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:

    “We have almost succeeded in leveling all human activities to the common denominator of securing the necessities of life and providing for their abundance.”
    —Hannah Arendt (1906–1975)

    “But neither milk-white rose nor red
    May bloom in prison air;
    The shard, the pebble, and the flint,
    Are what they give us there:
    For flowers have been known to heal
    A common man’s despair.”
    —Oscar Wilde (1854–1900)