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:
“It is the characteristic of great poems that they will yield of their sense in due proportion to the hasty and the deliberate reader. To the practical they will be common sense, and to the wise wisdom; as either the traveler may wet his lips, or an army may fill its water-casks at a full stream.”
—Henry David Thoreau (18171862)
“Man that is born of woman hath but a short time to live, and is full of misery. He cometh up, and is cut down, like a flower; he fleeth as it were a shadow, and never continueth in one stay.”
—Burial of the Dead, first anthem, Book of Common Prayer (1662)
Related Phrases
Related Words