Singleton pattern violates the Single Responsibility Principle, responsible for both managing its instance and providing a service — Dual responsibility make the code less modular and harder to maintain.
What is Singelton pattern?
The Singleton pattern is a design pattern that falls under the creational category. It is used to ensure that a class has only one instance and provides a global point of access to that instance. In other words, it restricts the instantiation of a class to a single object and…