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:

    The hourly kindness, the day’s common speech,
    The habitual content of each with each
    When neither soul nor body has been crossed.
    William Butler Yeats (1865–1939)

    We are told to maintain constitutions because they are constitutions, and what is laid down in those constitutions?... Certain great fundamental ideas of right are common to the world, and ... all laws of man’s making which trample on these ideas, are null and void—wrong to obey, right to disobey. The Constitution of the United States recognizes human slavery; and makes the souls of men articles of purchase and of sale.
    Anna Elizabeth Dickinson (1842–1932)