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:

    We early arrive at the great discovery that there is one mind common to all individual men: that what is individual is less than what is universal ... that error, vice and disease have their seat in the superficial or individual nature.
    Ralph Waldo Emerson (1803–1882)

    Nature seems to have taken a particular Care to disseminate her Blessings among the different Regions of the World, with an Eye to this mutual Intercourse and Traffick among Mankind, that the Natives of the several Parts of the Globe might have a kind of Dependance [sic] upon one another, and be united together by their common Interest.
    Joseph Addison (1672–1719)