SOLID is a set of design principles for Object-Oriented Programming
SOLID is an acronym for a set of five principles to design programs with the OOP paradigm that are easily maintainable and resilient.
The goal of SOLID is to achieve high cohesion and low coupling.
The five principles are:
-
(S) Single Responsibility principle: a class should only take care of one thing (i.e. there should never be more than one reason for a class to change).
-
(O) Open-Closed principle: classes should be open for extension, but closed to modifications.
-
(L) Liskov Substitution principle: methods that use a base class should be able to use a derived subclass without the program malfunctioning.
-
(I) Interface Segregation principle: clients should not be forced to depend on interfaces they don't use.
-
(D): Dependency Inversion principle: depend on abstractions (interfaces / traits / etc.), not specific types.