Very good article on Singleton in Java – a part of Gang of Four design

Author makes comprehensive review of existing ways to implement singleton: lazy loading, enums, double check locking, and volatile keyword. The number of 225155 page views as on 13.10.2014 since 02.13.2013 speaks for itself. You can visit it here.

Quick glance on the introduction:

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.

Singleton Design Pattern – An Introspection w/ Best Practices

Advertisements