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.
In which colour are the railway lines and telephone lines shown in the topographic map?
Diesel locomotives are built in?
______ implies transformation of various inputs into outpur, thereby increasing the want-satisfying capacity of inputs.
Where is the Centre for Railway Research (Vehicle Dynamics, Heavy Haul & High-Speed Technology) located?
Who built India's first railway line?
The first thoughts for a railway system in British India were expressed in a Parliamentary Select Committee meeting held ______ in in 1831-32.
Presentation of the first ever railway budget in India held in:
The Indian Railways’ quadrilateral; linking the four metropolitan cities of Delhi, Mumbai, Chennai and Howrah, commonly known as the Golden Quadrilat...
When was the Indian Railways and RailTel Corporation of India Limited incorporated?
Which one of the following States does NOT have the Headquarters of any Railway Zone?