Start learning 50% faster. Sign in now
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.
Mughal ruler, Aurangzeb died in which year?
Until which year is the National Quantum Mission (NQM) being implemented, as approved by the Union Cabinet?
The intervention by the monetary authority of a country in the money market to keep the money supply stable against external shocks is called _______.
_________is the oldest public-sector bank of India.
A train running at a speed of 108 km/h crosses a pole in 32 seconds. What is the length of the train?
Which statement correctly reflects the feature of BBPS?
I - The Bharat Bill payment system is a Reserve Bank of India ( RBI ) conceptualised s...
Prithviraj Raso, an epic poem about the life of the 12th century Indian king, Prithviraj Chauhan, was written by:
When is Indian Army Day celebrated every year?
Anwar Ibrahim sworn in as tenth prime minister of which of the following country?
Which of the International airports has signed a pact with Noida International Airport Limited (NIAL) for the development of an airport at Jewar, Uttar ...