Design Patterns: Singleton

Posted by Monik, 12 October 2010.
Programming Code Design Design Patterns
Book summary
Summary on basis of the book ,,Design Patterns: Elements of Reusable Object-Oriented Software'', by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Addison-Wesley, 1995.

jaki singleton jest kazdy widzi..
* class operation = static operation (?)

We use Singleton pattern when we want to ensure a class only has one instance, and provide a global point of access to it. Another case of using this is when we want to have the possibility of using a subclass of a class instead of the class without having to modify the code of the other classes.

Consequences and variations:
* Registry of singletons works the way that it maps singleton String name to class name; each singleton registers itself in the registry, e.g. in its constructor; a singleton's instance method asks the registry for the instance giving it its string name; (metne to jeszcze dla mnie..)

Comments


Comments: