SOLID principles
The SOLID principles are a set of five software architecture principles that advocate for creating maintainable, understandable, flexible, and modular software. Though they were originally targeted at object-oriented software, the concepts behind them are useful and can be applied to systems other than object orientation.
These concepts were first introduced by Robert J. Martin in his Design Principles and Design Patterns paper in 2000. However, the SOLID acronym was introduced later by Michael Feathers.
The acronym SOLID stands for the following:
- Single Responsibility Principle (SRP)
- Open-Closed Principle (OCP)
- Liskov Substitution Principle (LSP)
- Interface Segregation Principle (ISP)
- Dependency Inversion Principle (DIP)
We will walk through each of them and use the concepts that we have covered for discussion.
SRP
The SRP states that a class should have one responsibility or concern, and only one. There is only one reason...