SOLID Engineering Principles
SOLID is an acronym for the five principles made popular by Robert C. Martin (also known as Uncle Bob).
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 reason to change, meaning that a class should have only one job.
This principle aims to separate behaviours so that if bugs arise as a result of your change, it won’t affect other unrelated behaviours.
Open-Closed Principle
Objects or entities should be open for extension but closed for modification.
This principle aims to extend a Class’s behaviour without changing the existing behaviour of that Class. This is to avoid causing bugs wherever the Class is being used.
Liskov Substitution Principle
If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.
This principle aims to enforce consistency so that the parent Class or its child Class can be used in the same way without any errors.
Interface Segregation
A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use.
This principle aims at splitting a set of actions into smaller sets so that a Class executes ONLY the set of actions it requires.
Dependency Inversion
High-level modules should not depend on low-level modules. Both should depend on the abstraction. Abstractions should not depend on details. Details should depend on abstractions.
High-level Module(or Class): Class that executes an action with a tool.
Low-level Module (or Class): The tool that is needed to execute the action
Abstraction: Represents an interface that connects the two Classes.
This principle aims at reducing the dependency of a high-level Class on the low-level Class by introducing an interface.
Conclusion
To sum it up, SOLID principles are like a rulebook for writing good code. They help make software easier to understand, modify, and fix. By sticking to these principles, developers can create programs that are less likely to have problems and are simpler to work with in the long run. It's all about making code that just makes sense and works well.


