S.O.L.I.D. abbreviation covers several solution design principles in object-oriented design.

  • Single-responsibility. Each class should encapsulate only one part of functionality.
  • Open-closed. This stands for being open for extension of the functionality and closed for changes. Use approach when custom logic is defined as new class which extends standard one without changing the last.
  • Liskov substitution principle. This simply means that the solution should work without any changes to its functionality if we use instances of subclass instead of instances of a base class. So this is basically the approach dictating that we rely on base class contract and not it's internals.
  • Interface segregation. Design interface of a class so that it only contains the methods required by it's consumer. For multiple consumers of different nature, provide several service classes instead of a single large one.
  • Dependency inversion. Rely on contracts not on implementations. Your high-level classes should refer to actual implementations purely by low-level class implementations and be decoupled from low-level implementations.