Singleton Design Pattern – An Introspection w/ Best Practices | Javalobby
Singleton Design Pattern – An Introspection w/ Best Practices 02.13.2013 Singleton is a part of Gang of Four design pattern and it is categorized under creational design patterns. In this article we are going to take a deeper look into the usage of the Singleton pattern. It is one of the most simple design pattern in terms of the modelling but on the other hand this is one of the most controversial pattern in terms of complexity of usage. In Java the Singleton pattern will ensure that there is only one instance of a class is created in the Java Virtual Machine. It is used to provide global point of access to the object. In terms of practical use Singleton patterns are used in logging, caches, thread pools, configuration settings, device driver objects. Design pattern is often used in conjunction with Factory design pattern . This pattern is also used in Service Locator JEE pattern. Structure: Static member : This contains the instance of the singleton class. Private constructor :Read full article from Singleton Design Pattern – An Introspection w/ Best Practices | Javalobby
No comments:
Post a Comment