Singleton - Creational Design Pattern (I)
8 March 2008The Singleton Design Pattern is the most commonly used design pattern in Java. The Singleton Design Pattern is a Creational Design Pattern. It governs the instantiation process. Sometimes in programming only one object is required across the system. The Singleton Design Pattern is used to achieve exactly that, that is to restrict instantiation of a class to one object. The Singleton Design Pattern ensures a class has only one instance, and provides a global point of access to it.
Several design patterns such as Abstract Factory, Builder, and Prototype can in turn use the Singleton Design Pattern in their implementations. In fact facade objects are often Singleton as only one facade instance is required. If in the future you require multiple instances, with the Singleton design pattern you can achieve that without affecting a singleton class’s clients. Some times Singletons are used ahead of global variables.
Related Posts:
- Singleton - Creational Design Pattern (II)
- The Strategy Design Pattern in Java(I)
- The Observer Design Pattern(I)
- Adapter design pattern
- Singleton Pattern
- The Facade Design Pattern (I)
- Design Patterns - Basics (I)
- The Strategy Design Pattern in Java(II)
- The Facade Design Pattern (II)
- Adapter design pattern (II)
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Singleton - Creational Design Pattern (I)