It's very hard to create a subclass, or to create a mock object for a Singleton class. Singleton makes the unit testing harder. Singleton hide the dependencies and make the classes tightly coupled with each other.
For the above reasons, Singletons are called as Anti-Pattern.
Thanks and Regards
Asked In: Many Interviews |