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:

    In common with other rural regions much of the Iowa farm lore concerns the coming of company. When the rooster crows in the doorway, or the cat licks his fur, company is on the way.
    —For the State of Iowa, U.S. public relief program (1935-1943)

    There comes Poe, with his raven, like Barnaby Rudge,
    Three-fifths of him genius, and two-fifths sheer fudge.
    Who talks like a book of iambs and pentameters,
    In a way to make people of common sense damn metres,
    Who has written some things quite the best of their kind,
    But the heart somehow seems all squeezed out by the mind.
    James Russell Lowell (1819–1891)