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:
“Do you come to a philosopher as to a cunning man, to learn something by magic or witchcraft, beyond what can be known by common prudence and discretion?”
—David Hume (17111776)
“In all conversation between two persons, tacit reference is made, as to a third party, to a common nature. That third party or common nature is not social; it is impersonal; is God.”
—Ralph Waldo Emerson (18031882)
Related Phrases
Related Words