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:

    “The most common error made in matters of appearance is the belief that one should disdain the superficial and let the true beauty of one’s soul shine through. If there are places on your body where this is a possibility, you are not attractive—you are leaking.”
    —Fran Lebowitz (b. 1951)

    “The world is but a perennial movement. All things in it are in constant motion—the earth, the rocks of the Caucasus, the pyramids of Egypt—both with the common motion and with their own.”
    —Michel de Montaigne (1533–1592)