Start learning 50% faster. Sign in now
The Singleton pattern violates the Open/Closed Principle of SOLID, which states that software entities (classes, modules, functions) should be open for extension but closed for modification. The Singleton pattern is designed to restrict the instantiation of a class to a single object. To achieve this, the class is tightly coupled to its own instance management logic, which means modifying or extending this behavior requires changes to the original class. As a result, Singleton classes are not easily extensible without modification, making them contrary to the Open/Closed Principle. Why Other Options are Incorrect: A) Strategy Pattern: The Strategy Pattern adheres to the Open/Closed Principle by allowing algorithms to be selected and applied at runtime without modifying existing code. C) Factory Method Pattern: This pattern promotes extensibility by allowing subclasses to alter the type of objects that will be created, without modifying the client code. D) Decorator Pattern: The Decorator Pattern is designed to extend functionality dynamically by wrapping objects, adhering to the Open/Closed Principle. E) Adapter Pattern: The Adapter Pattern allows for existing classes to be used without modification by adapting their interfaces to a new target interface, following the Open/Closed Principle.
Which fundamental rights in the Indian constitution were inspired by the U.S. Constitution?
Which of the following Articles of the Indian Constitution are related to citizenship?
Which constitutional article mandates equal pay for equal work in India?
Who presides over the joint sessions of both Houses of Parliament in India?
Which article of the Indian Constitution gives the right to every citizen to seek constitutional remedy from the Supreme Court when they have been depri...
The Family Courts Act of 1984 authorizes which entity to establish Family Courts?
Which of the following indices is not considered while calculating Human Development Index (HDI)?
As envisaged in the Constitution of India with respect to the Supreme Court (Number of Judges) Amendment Act, 2008 (11 of 2009)', there shall be a Supre...
According to Article 243G of the Indian Constitution, which entity is mandated to plan for economic development and social justice?
Under which Article of the Indian Constitution is the government required to uphold social welfare and labor laws to ensure a life of dignity for worker...