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:
“Words like freedom, justice, democracy are not common concepts; on the contrary, they are rare. People are not born knowing what these are. It takes enormous and, above all, individual effort to arrive at the respect for other people that these words imply.”
—James Baldwin (19241987)
“Nothing astonishes men so much as common sense and plain dealing.”
—Ralph Waldo Emerson (18031882)
Related Phrases
Related Words