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:
“... every womans organization recognizes that reformers are far more common than feminists, that the passion to look after your fellow man, and especially woman, to do good to her in your way is far more common than the desire to put into every ones hand the power to look after themselves.”
—Crystal Eastman (18811928)
“The mothers battle for her childwith sickness, with poverty, with war, with all the forces of exploitation and callousness that cheapen human lifeneeds to become a common human battle, waged in love and in the passion for survival.”
—Adrienne Rich (20th century)