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:

    It is a common accident for men camping in the woods to be killed by a falling tree.
    Henry David Thoreau (1817–1862)

    That we can come here today and in the presence of thousands and tens of thousands of the survivors of the gallant army of Northern Virginia and their descendants, establish such an enduring monument by their hospitable welcome and acclaim, is conclusive proof of the uniting of the sections, and a universal confession that all that was done was well done, that the battle had to be fought, that the sections had to be tried, but that in the end, the result has inured to the common benefit of all.
    William Howard Taft (1857–1930)