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 great subverter of Pyrrhonism or the excessive principles of scepticism is action, and employment, and the occupations of common life.
    David Hume (1711–1776)

    We are the creatures of imagination, passion, and self- will, more than of reason or even of self-interest.... Even in the common transactions and daily intercourse of life, we are governed by whim, caprice, prejudice, or accident. The falling of a teacup puts us out of temper for the day; and a quarrel that commenced about the pattern of a gown may end only with our lives.
    William Hazlitt (1778–1830)