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 British are a self-distrustful, diffident people, agreeing with alacrity that they are neither successful nor clever, and only modestly claiming that they have a keener sense of humour, more robust common sense, and greater staying power as a nation than all the rest of the world put together.”
—Quoted in Fourth Leaders from the Times (1950)
“To do common things perfectly is far better worth our endeavor than to do uncommon things respectably.”
—Harriet Beecher Stowe (18111896)
Related Phrases
Related Words