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:

    Romance reading and writing might be seen ... as a collectively elaborated female ritual through which women explore the consequences of their common social condition as the appendages of men and attempt to imagine a more perfect state where all the needs they so intensely feel and accept as given would be adequately addressed.
    Janice A. Radway (b. 1949)

    I hope there are some who will brave ridicule for the sake of common justice to half the people in the world.
    Barbara Leigh Smith Bodichon (1827–1891)