· Single Responsibility Principle · Open-Closed Principle · Liskov Substitution Principle · Interface Segregation Principle · Dependency Inversion Principle
The single responsibility principle (SRP) advocates for creating software that is clean, maintainable, and scalable. According to SRP, a class should only have one reason to change, which means it should have only one responsibility.
The open-closed principle (OCP) says that software components should be designed to facilitate the addition of new features without altering existing code. This principle encourages extensibility while preserving the integrity of the current codebase.
The Liskov substitution principle (LSP) ensures the smooth substitution of derived class objects for base class objects. ts fundamental rule is that base objects should be interchangeable with any derived class object without affecting program accuracy.
The interface segregation principle (ISP) says to create specialized, smaller interfaces for client needs, avoiding large ones with unnecessary methods to prevent clients from being burdened with unused functionality.
DIP emphasizes decoupling high-level modules from low-level ones by introducing an abstraction layer, typically through interfaces or abstract classes. This reduces direct dependencies between classes, promoting flexibility and easier maintenance.