== Why I really dislike the Singleton design pattern To quote Glyph Lefkowitz (from [[here|http://mail.python.org/pipermail/python-list/2001-June/047214.html]]): > Aah, the singleton. Global variables for the new millennium. I'm not against global variables, but I am against misleading people about them. The Singleton pattern lies about them; it looks like you have a normal object, but you really have a global variable without knowing it. (And if everyone knows you have a faux global variable, you are just tarting up a global variable in 'object-oriented' clothes. This is like respecting the letter of the law ('globals bad, objects good') without understanding its spirit.) If your language doesn't have global variables, you have my sympathies and condolences. In such circumstances, Singletons and other things become necessary hacks. Note that I consider 'Singleton' not the same as a class where you only ever instantiate one object from in the course of your program. With Singleton, your program appears to instantiate multiple objects from the same source, but they are all the same thing. (I've seen some people use 'Singleton' to describe what I would call a cached lookup. This is where you have descriptors of some sort and turn them into objects, but repeatedly calling the factory function with the same descriptor always gives you the same object back instead of making a new one every time.) (Sort of continued from [[../python/PointlessClasses]].)