5

Question: Why do people hate Singletons?

Googled, can't see any reasons I actually agree with.

Comments
  • 2
    Singleton as a pattern isn't bad and should not be hated. However, it's a pattern easily abused into a place where the whole codebase works on only singletons. Such abuse with little caution to state and you get a multi threaded hell. This abuse is most seen when you have"manager" classes all over the place.

    I call manager classes and helper classes "garbage bin where you put poorly designed logic"
  • 0
    Thanks for your thoughts.

    Following up your answer with more googling, it seems like helpers etc are an antipattern in general.

    I'll file that away as something to keep in mind.
  • 0
    Do you do unit tests? If you do, you'll realise quickly why singletons(or rather, the Singleton Pattern) are best used sparingly. :-)
Add Comment