Click here to Skip to main content
15,891,012 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I have been reading singleton pattern,it's advantages and disadvantages. Since I am new to this I am not able to understand the detailed nature of disadvantages. Can someone please explain in detail the disadvantages of singleton with any example if possible.
eg:
1. How do they deviate from Single Responsibility Principle(SRP).
2. It hides the dependency in the code of the application.

Thanks in advance!!!

What I have tried:

I have tried google to understand the disadvantages but everywhere they uses the same terms without any example.
Posted
Updated 4-May-17 21:14pm
Comments
Richard MacCutchan 5-May-17 3:06am    
This forum is for programming questions. If you want to learn a subject then Google will find you many document references.

1 solution

We have even an article on this very subject: Singleton Pattern – Positive and Negative Aspects[^]. It doesn't show examples, though. You may also try to use Google for the purpose of finding code samples.
 
Share this answer
 
Comments
maverick1991 5-May-17 3:16am    
Thanks Cpallini....I had visited that article.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900