Which of the following design patterns violates the Open/Closed Principle of SOLID principles in object-oriented design?
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.
What was the significant achievement of Agnikul's Agnibaan launch vehicle?
Which former IAS officer has been appointed as the new CEO of NITI Aayog?
Which of the following sportsperson has been nominated for the 2022 Laureus World Breakthrough of the Year Award?
Which Indian State/Union Territory is set to have its first Biodiversity Heritage Site (BHS) with Yaya Tso, a high-altitude lake, becoming the region's ...
The Indian Institute of Spices Research (IISR) recently won the best technology award for its work in which field?
What was the rank of India in ISSF World shooting Championship 2022?
Which Union Minister inaugurated the Pradhan Mantri Colleges of Excellence in all 55 districts of Madhya Pradesh?
Which state topped the Urban Governance Index (UGI) in 2024?
Which prestigious title did The Banker award to the Federal Bank in 2023?
How much fund did the Israel government grant to Intel for its new chip plant in southern Israel?