Starting Point

As a clean code enthusiast, the design principles I am using in my day-to-day development activities are the commonly well know ones. Since they never let me down, I consider them a starting point and worth outlining.

General

  • Encapsulate what varies
  • Favor composition (over inheritance)
  • Program to interfaces
  • Favor loose coupling (and high cohesion)

SOLID

  • Single responsibility – a class has one reason to change
  • Open for extension / Closed for modification
  • Liskov substitution – subtypes are substitutable for their base types
  • Interface segregation – interfaces shall be small and cohesive
  • Dependency inversion – high level modules shall not depend on low level modules, but both on abstractions