Question
Which design pattern is best suited for managing the
creation of objects without specifying their concrete classes?Solution
The Factory Pattern is a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alter the type of objects that will be created. It abstracts the instantiation process, enabling flexibility and scalability in object creation. For instance, in a GUI framework, the factory method might create different types of buttons (WindowsButton, MacButton) depending on the operating system. By decoupling the client code from concrete classes, this pattern promotes adherence to the Open/Closed Principle of SOLID. Why Other Options Are Incorrect :
- Singleton Pattern : This ensures a class has only one instance and provides global access to it, unrelated to flexible object creation.
- Observer Pattern : This defines a one-to-many dependency, where changes in one object are notified to multiple observers.
- Adapter Pattern : This works as a bridge between incompatible interfaces, not for object creation.
- Decorator Pattern : This adds functionality dynamically to objects, without modifying their structure.
Which Indian state had the highest annual growth rate in milk production during 2022-23, according to the Basic Animal Husbandry Statistics 2023?
Consider the following statements:
I. Pradhan Mantri Awas Yojana – Urban (PMAY-U), a flagship Mission of Government of India was launched o...
What was the annual increase in UPI transaction volume as of September 2024?
Which ministry launched a new scheme to establish a sustainable electronics component ecosystem in India?
Which recommendation did the RBI’s Internal Working Group (2025) make regarding the 14-day variable rate repo/reverse repo operations?
Who was named Player of the Match in the 2025 Duleep Trophy final after scoring 194 runs?
Which state was the only non-participant in the SASCI scheme as of November 27, 2025?
India and ________ will be jointly conducting the 6th edition of the Joint Military Exercise, called “EX SHAKTI 2021”.
Which theme was adopted for Kashi Tamil Sangamam 4.0 in 2025?
To boost corporate governance norms, SEBI has notified rules introducing special rights to unitholders of REITs who can now nominate representatives on ...