SOLID Design Principles
SOLID is an acronym for the first five object-oriented design (OOD) principles.
SOLID stands for:
S — Single-responsibility Principle.
O — Open-closed Principle.
L — Liskov Substitution Principle.
I — Interface Segregation Principle.
D — Dependency Inversion Principle.
Single-responsibility Principle- A class should have one, and only one responsibility and it should have only one reason to change.
Open-closed Principle- Classes should be open for extension and closed to modification. Changing the current behavior of a Class will affect all the systems using that Class.
Liskov Substitution Principle- Subclasses should be substitutable for their base classes. This means parent Class or its child Class can be used in the same way without any errors.
keeping things separated, and the Interface Segregation Principle is about separating the interfaces.
A Class should perform only actions that are needed to fulfill its role. Any other action should be removed completely or moved somewhere else if it might be used by another Class in the future.
Dependency Inversion Principle- Our classes should depend upon interfaces or abstract classes instead of concrete classes and functions.