Solid Principle
SOLID Principle What are the SOLID principles? Five object-oriented design principles help make code: Maintainable (easy to change without breaking things) Extensible (easy to add new features) Testable (easy to write unit tests) Understandable (easy for other developers to read) The five principles: S – Single Responsibility Principle (SRP) One class = one reason to change. O – Open/Closed Principle (OCP) Open for extension, closed for modification. L – Liskov Substitution Principle (LSP) Subclasses should work wherever base classes work (no broken contracts). I – Interface Segregation Principle (ISP) Clients should not be forced to depend on methods they don’t use. D – Dependency Inversion Principle (DIP) Depend on abstractions, not concrete classes. Why are we using SOLID principles? Reduce bugs when requirements change → You can modify code without breaking unrelated parts. Improve maintainability → Code is easier to und...