Shaun Abram
Technology and Leadership Blog
Singleton implementations
A singleton is a class that is instantiated exactly once (or at least, once per classloader). It is considered to be an anti-pattern by many (including me!) because it makes unit testing difficult. You can’t substitute a mock implementation for a singleton (unless it happens to implement an interface, which I haven’t seen too often). And singletons also make your APIs into liars.
However, if you do want/have to use singletons, this article discusses the best approach.
Tags: singleton