S.O.L.I.D design principles overview

S.O.L.I.D is an acronym for the first five principles of object-oriented design (OOD).

These principles, when combined together, make it easy for a programmer to develop software that are easy to maintain and extend. They also make it easy for developers to avoid code smells, easily refactor code, and are also a part of the agile or adaptive software development.

Here is a quick overview of each principle:

  • S – Single Responsibility Principle

    • A class should have only one job.
  • O – Open Closed Principle

    • You should be able to extend a class without modifying it.
  • L – Liskov Substitution Principle (A.K.A Design by Contract)

    • Derived classes must be substitutable for their parent class.
  • I – Interface Segregation  Principle

    • Make fine grained interfaces that are client specific, not general-purpose interfaces. Clients should not be forced to depend on interfaces that they do not use.
  • D – Dependency Inversion Principle

    • Depend on abstractions, not concretions.