SOLID

Per wikipedia, SOLID is an acronym for 5 design principles in object-oriented-programming. These principles are:

  • Single Responsibility
  • Open-Closed
  • Liskov Substitution
  • Interface segregation
  • Dependency Inversion

Single Responsibility

A class/interface should have one and only one responsibility.

Open-Closed

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

Liskov Substitution

AKA Design by contract.

All objects that conform to a given interface should be treated as interchangeable.

Interface segregation

It’s better to have 20 different interfaces/protocols, than 1 god interface/protocol.

Dependency Inversion

Depend upon interfaces, not a specific concrete implementation.

Last updated: 2019-09-18 13:23:41 -0700