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:

    “I set forth a humble and inglorious life; that does not matter. You can tie up all moral philosophy with a common and private life just as well as with a life of richer stuff. Each man bears the entire form of man’s estate.”
    —Michel de Montaigne (1533–1592)

    “The most beautiful lives, to my mind, are those that conform to the common human pattern, with order, but without miracle and without eccentricity.”
    —Michel de Montaigne (1533–1592)