0 Followers
2. O - Open/Closed Principle (OCP) Definition: Software entities (classes, modules, functions) should be open for extension but closed for modification. Why: This allows new functionality to be added to the system without changing the existing code, reducing the risk of introducing bugs in stable code.
3. L - Liskov Substitution Principle (LSP) Definition: Subtypes should be substitutable for their base types without affecting the correctness of the program. Why: This ensures that a derived class can be used in place of its parent class without unexpected behavior.
4. I - Interface Segregation Principle (ISP) Definition: A client should not be forced to implement interfaces it does not use. Instead, smaller, more specific interfaces are better than one large, general-purpose interface. Why: Large interfaces force classes to implement methods that they may not need, leading to unnecessary complexity.
1. S - Single Responsibility Principle (SRP) Definition: A class should have only one reason to change, meaning it should have only one responsibility. Why: If a class has multiple responsibilities, changes in one area might lead to unintended side effects in another, making the code fragile and difficult to maintain.