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 hourly kindness, the days common speech,
The habitual content of each with each
When neither soul nor body has been crossed.”
—William Butler Yeats (18651939)
“We are told to maintain constitutions because they are constitutions, and what is laid down in those constitutions?... Certain great fundamental ideas of right are common to the world, and ... all laws of mans making which trample on these ideas, are null and voidwrong to obey, right to disobey. The Constitution of the United States recognizes human slavery; and makes the souls of men articles of purchase and of sale.”
—Anna Elizabeth Dickinson (18421932)
Related Phrases
Related Words