5 principles for Object-Oriented Programming

SOLID is an acronym for:

Single-Responsibility

👉 A class should have one and only one reason to change, meaning that a class should have only one job.

Open-closed

👉 Objects or entities should be open for extension but closed for modification.

Liskov Substitution

👉 Every subclass should be substitutable for the base or parent class

Interface Segregation

👉 A class shouldn’t be forced to implement an interface that it doesn’t use or depend on methods it doesn’t use

Dependency-Inversion

👉 Don’t have a class depend explicitly on another class, have an abstract interface between them

This last one seems weird.


Source