S.O.L.I.D:

  • Single responsibility
  • Open-closed principle
  • Lisko substitution principle
  • Interface segregation principle
  • Dependency inversion principle

SOLID mostly is adressing OOP and is rather an unreachable ideal. A solution is extention methods or Dependency Injection.

The principles in detail

Open-closed principle

  • Open to extension
  • Closed to modification

It should be able to add functionality without altering existing classes and method.

Lisko substitution principle

It basically says: “Class B is a subclass class A, then we should be able to pass an object of class B to any method that expects and object of class A” Thus, a child class should do the same things that parent class can do. In the actual example for “Child” and “Parent”, where a Parent might be able to drive a car and a child is not allowed, this requires abstracting with a “Human” class. The Child class would inherit from the human class, just as the parent class.

This idea is heavily linked to inheritance and depends on it.

Interface segregation principle

This concept endorses splitting up interfaces to avoid bulky interfaces. Resulting are multiple interfaces for single tasks - and potentially one abstract interface which serves as the baseline.

Dependency inversion prinicple

High level modules should not depend on low level modules. Both should depend on an abstraction.