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 fatuously hoped that we might pluck from the human tragedy itself a consciousness of a common destiny which should bring its own healing, that we might extract from life’s very misfortunes a power of cooperation which should be effective against them.
    Jane Addams (1860–1935)

    The common goal of 22 million Afro-Americans is respect as human beings, the God-given right to be a human being. Our common goal is to obtain the human rights that America has been denying us. We can never get civil rights in America until our human rights are first restored. We will never be recognized as citizens there until we are first recognized as humans.
    Malcolm X (1925–1965)