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 mere fact of leaving ultimate social control in the hands of the people has not guaranteed that men will be able to conduct their lives as free men. Those societies where men know they are free are often democracies, but sometimes they have strong chiefs and kings. ... they have, however, one common characteristic: they are all alike in making certain freedoms common to all citizens, and inalienable.”
—Ruth Benedict (18871948)
“The common experience is, that the man fits himself as well as he can to the customary details of that work or trade he falls into, and tends it as a dog turns a spit. Then he is part of the machine he moves; the man is lost.”
—Ralph Waldo Emerson (18031882)