Monthly Archives: September 2012

Is Singleton Root of All Evil?

Yes.

Despite all its criticism, singletons still exists today, perhaps because insecure programmers feel the illusion of doing the “right” thing, since they are after all usingĀ a design pattern. For those who think, “What experts do, must be right”, I will leave a famous quote by Christopher Hitchens-

Picture all experts as if they were mammals. … Seek out argument and disputation for their own sake.

The popularity of the word ‘singleton’ probably comes from set theory, where it is a set with exactly one element. Similar to its mathematical counterpart, a singleton pattern in software engineering ensures exactly one instance of a class for each running application. This is how you would write a singleton class in Java: Continue reading

Follow

Get every new post delivered to your Inbox.