Beware singletons
From CSSEMediaWiki
(Difference between revisions)
RobertLechte (Talk | contribs) (New page: The Singleton design pattern has several apparent advantages. The programmer can be sure that only one instance will exist. That instance is static. This saves the mess of having to pa...) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | :''Do not turn objects of a class into derived classes of the class. Be very suspicious of any derived class for which there is only one instance.'' --Riel's Heuristic 5.15, [[Arthur Riel 1996]] | |
− | + | For the purposes of this maxim, "singleton" refers not specifically to the [[Singleton]] design pattern, but to any class of which there is only one instance. The risks of using the Singleton pattern are discussed on the [[Singleton]] page. | |
− | + | [[Category:Riel's heuristics]] | |
− | + |
Latest revision as of 00:13, 21 July 2009
- Do not turn objects of a class into derived classes of the class. Be very suspicious of any derived class for which there is only one instance. --Riel's Heuristic 5.15, Arthur Riel 1996
For the purposes of this maxim, "singleton" refers not specifically to the Singleton design pattern, but to any class of which there is only one instance. The risks of using the Singleton pattern are discussed on the Singleton page.