Singleton is definitely one of the most misused and abused patterns out there. Many of us have been infected with Singletonitis at one point or another. Curiously, its close c
According to this definition of Monostates, is this note:
"Monostates are evil in the same way that SingletonsAreEvil."
I don't necessarily agree. The basic premise is that Singletons and Monostates are global variables, and since Globals are evil, so too must be Singletons and Monostates.
The problem with this line of reasoning is that it doesn't take into account WHY globals are evil. Globals are evil primarily because they are variables that can be accessed outside the local scope accidentally, similarly to how non-typed languages often allow variables to be created simply by referencing them.
Singletons and Monostates can't cause the same kinds of problems, because it's virtually impossible to "accidentally" reference a global static, call it's instance method, then utilized the instance.
In other words, globals are evil because they cause subtle and hard to see problems. Singletons and Monostates do not cause the same kinds of problems, so I don't see them as evil for the same reasons, which is where most people seem to go wrong in this argument.
Now, can singletons and monostates cause other kinds of problems? Sure. Apparently, the TDD people hate them because they are hard to test correctly with automated testing. Ok, fine, but for those people that don't use TDD, those problems don't exist.
Of course singletons can be misused. People that use them simply to avoid passing an instance around are misusing them. I think Monostates are better for that than a singleton.
Many people propose factory patterns instead of singletons, but I feel that Factories are just fancy singleton generators. No, there is no static "instance" method, but it basically does the same thing (when a factory creates a single instance object that is). Factory.Create is no different from Singleton.Instance.
EDIT:
One aspect of Singletons and Monostates that is comparable to Globals is that they are shared, and thus not thread safe. While this is a concern if you plan to do multi-threaded apps, if you know this you can take steps to serialize access to the shared objects. So this is probably the only area where, generally, all three types can be thought of as causing troubles.