These principles are not totally independent from each other. They work together, so a violation of one may very well mean violation of some other principles.

We implement SOLID principles with the help of design patterns.

S – Single responsibility principle

A class should have one and only one reason to change.

O – Open/Closed principle

Classes and methods should be open for extension, but closed for modification.

One way to implement this is to use decorator design pattern.

L – Liskov substitution principle

Derived classes must be usable through the base class reference or interface without the need for the user to know the difference.

Derived types should be completely substitutable for their base types without breaking the functionality.

I – Interface segregation principle

The client should not be forced to depend on the methods they don’t use.

D – Dependency inversion principle

High level modules should not depend on the low level modules, both should depend on abstractions. Abstractions should not depend on details but details should depend on abstractions.

Command Query Separation

We should divide the methods into two separated categories.

Queries: Return a result and do not change the state of the system.

Command: Change the state of the system but do not return a result.