SOLID Principles

The SOLID principles are a set of software design principles that teach us how we can structure our functions and classes in order to be as robust, maintainable and flexible as possible.

S - Single-responsiblity principle

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

O - Open-closed Principle

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

L - Liskov substitution principle

Ability to replace any instance of a parent class with an instance of one of its child classes without negative side effects.

I - Interface segregation principle

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.

D - Dependency Inversion Principle

Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.

Sources

WIKI: SOLID principles of object-oriented programming

Blog: S.O.L.I.D: The First 5 Principles of Object Oriented Design