Possible Duplicate:
What is so bad about Singletons?
Singleton Design Pattern: Pitfalls
I hear a lot of this but din’t find firm reason for it.
Avoid the singleton anti-pattern and replace it with DI.
but, why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Stateful singletons are much more difficult to unit test.
I use stateless singletons which I don’t see a problem with.
Since singletons can implement interfaces, they can be passed using dependency injection (and should be passed as such where possible)