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:
“You common cry of curs, whose breath I hate
As reek athrotten fens, whose loves I prize
As the dead carcasses of unburied men
That do corrupt my airI banish you!”
—William Shakespeare (15641616)
“The common erotic project of destroying women makes it possible for men to unite into a brotherhood; this project is the only firm and trustworthy groundwork for cooperation among males and all male bonding is based on it.”
—Andrea Dworkin (b. 1946)
Related Phrases
Related Words