Difference between revisions of "Singleton"

From Open Pattern Repository for Online Learning Systems
Jump to navigation Jump to search
(Edited source)
(Edited source)
Line 5: Line 5:
|image= <!-- Provide the filename of the image to be displayed (e.g., Design_pattern.png) -->
|image= <!-- Provide the filename of the image to be displayed (e.g., Design_pattern.png) -->
|contributor= <!-- List of contributors separated by a " , "comma. This is optional so you can remove this field if there are no contributors -->
|contributor= <!-- List of contributors separated by a " , "comma. This is optional so you can remove this field if there are no contributors -->
|source= Gamma, Helm, Johnson & Vlissides (1995)<ref name="Gamma">Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1995). ''[http://dl.acm.org/citation.cfm?id=186897 Design Patterns: elements of reusable object-oriented software.]'' Reading, Massachusetts: Addison-Wesley. ''ISBN 0-201-63361-2.''</ref>, Singleton Pattern (2016)<ref name="Singleton">Singleton Pattern. (2016). Retrieved October 4, 2016 from http://c2.com/cgi/wiki?SingletonPattern.</ref>
|source= Gamma, Helm, Johnson & Vlissides (1995)<ref name="Gamma">Gamma, E., Helm, R., Johnson, R. & Vlissides, J. (1995). ''[http://dl.acm.org/citation.cfm?id=186897 Design Patterns: elements of reusable object-oriented software.]'' Addison-Wesley: Boston, MA. ''ISBN 0-201-63361-2.''</ref>, Singleton Pattern (2016)<ref name="Singleton">Singleton Pattern. (2016). Retrieved October 4, 2016 from http://c2.com/cgi/wiki?SingletonPattern.</ref>
|dataanalysis= <!-- If applicable, list of data analyses used for mining the pattern separated by a " , "comma -->
|dataanalysis= <!-- If applicable, list of data analyses used for mining the pattern separated by a " , "comma -->
|domain= <!-- Learning domain the design pattern belongs to (e.g., General, Math, Algebra) -->
|domain= <!-- Learning domain the design pattern belongs to (e.g., General, Math, Algebra) -->

Revision as of 12:44, 4 October 2016


Singleton
Contributors
Last modification October 4, 2016
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.