Question
Which SOLID principle emphasizes that software entities
should be open for extension but closed for modification?Solution
The Open/Closed Principle (OCP) is one of the SOLID principles for object-oriented design. 1. Key Idea: Software entities like classes, modules, and functions should be extendable without altering existing code. 2. Implementation: Achieved through techniques like inheritance, polymorphism, or interfaces that allow new functionality to be added without modifying the original codebase. 3. Benefits: Promotes code reusability, reduces the risk of introducing bugs into stable code, and facilitates easier maintenance and scaling. 4. Example: A class for processing payments could use an interface for payment methods. Adding a new payment type would require extending the interface, not modifying the class. This principle ensures that software systems are adaptable to new requirements without jeopardizing existing functionality. Why Other Options Are Incorrect: β’ A) SRP: Focuses on assigning one responsibility to each class/module but does not address extensibility. β’ C) LSP: Ensures derived classes can replace base classes without altering behavior, unrelated to modification. β’ D) ISP: Advocates for creating specific interfaces for clients, reducing unnecessary dependencies. β’ E) DIP: Encourages high-level modules to depend on abstractions rather than concrete implementations.
Which clause is used to sort the results in SQL?
Which SQL clause is used to filter records after aggregation?
Which type of slowly changing dimension (SCD) preserves full history by adding a new row for each change and using effective date ranges?
A Fact Constellation Schema is also called:
What is the primary function of ETL in a data warehouse environment?
Which of the following stores historical data for analysis?
Which of the following is NOT a characteristic of OLAP systems?
Which of the following commands is part of the Transaction Control Language (TCL) in SQL?
Which of the following is a real-time data warehouse application?
Data cleansing is primarily concerned with: