Dependency Inversion states that high level modules should not depend upon low level modules. Instead, they should depend on abstractions and not concretions.
The letter I in SOLID stands for the interface segregation principle. The principle states that a client should not be forced to implement an interface that it doesn’t use.
The Liskov Substitution principle states that derived classes must be substitutable for their base classes. Meaning, every time you prepare a subclass, that subclass should be substituable in every place where the original class was accepted.
The O in SOLID represents the open-closed principle which states that entities should be open for extension but closed for modifications.
The following rules are from the book Clean Code by Robert C Martin which I will cover over a few parts. Functions should be small. Each function should only be up to 4 – 5 lines of code If, else […]