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 fact is that my wife if she had common sense would have more power over me than any other whatsoever, for my heart always alights upon the nearest perch.
    George Gordon Noel Byron (1788–1824)

    All the philosophy, therefore, in the world, and all the religion, which is nothing but a species of philosophy, will never be able to carry us beyond the usual course of experience, or give us measures of conduct and behaviour different from those which are furnished by reflections on common life. No new fact can ever be inferred from the religious hypothesis; no event foreseen or foretold; no reward or punishment expected or dreaded, beyond what is already known by practice and observation.
    David Hume (1711–1776)