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:

    Our common country is in great peril, demanding the loftiest views, and boldest action to bring it speedy relief.
    Abraham Lincoln (1809–1865)

    All this class of pleasures inspires me with the same nausea as I feel at the sight of rich plum-cake or sweetmeats; I prefer the driest bread of common life.
    Sydney Smith (1771–1845)