Difference between revisions of "Singleton"

From Open Pattern Repository for Online Learning Systems
Jump to navigation Jump to search
(Added contributors)
m (Edited spelling)
 
(2 intermediate revisions by the same user not shown)
Line 66: Line 66:
<references/>
<references/>


[[Category:Design_patterns]] <!-- List of other categories the design pattern belongs to. The syntax for linking to a category is: [[Category:<Name of category]] -->
[[Category:Design_patterns]] [[Category:Patlet]] [[Category:Software Design Patterns]]<!-- List of other categories the design pattern belongs to. The syntax for linking to a category is: [[Category:<Name of category]] -->

Latest revision as of 09:37, 6 June 2017


Singleton
Contributors Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
Last modification June 6, 2017
Source Gamma, Helm, Johnson & Vlissides (1995)[1], Singleton Pattern (2016)[2]
Pattern formats OPR Alexandrian
Usability
Learning domain
Stakeholders

If a system only needs one instance of a class, and that instance needs to be accessible in many different parts of a system, you control both instantiation and access by making that class a singleton.[1][2]


Context

Problem

Forces

Solution

Consequences

Benefits

Liabilities

Evidence

Literature

Discussion

Data

Applied evaluation

Related patterns

Example

References

  1. 1.0 1.1 Gamma, E., Helm, R., Johnson, R. & Vlissides, J. (1995). Design Patterns: elements of reusable object-oriented software. Addison-Wesley: Boston, MA. ISBN 0-201-63361-2.
  2. 2.0 2.1 Singleton Pattern. (2016). Retrieved October 4, 2016 from http://c2.com/cgi/wiki?SingletonPattern.