Simple Design

Last modified by chrisby on 2024/02/22 16:26

Design should be as simple as possible. Only implement what's necessary for the current requirements. Simple code is faster to understand and easier to maintain.

Kent Beck's Rules

... for simple designed code:

  1. Tests Pass
  2. Reveals Intent
    • = Easy to read, self explanatory code
  3. No Duplications
    • Sometimes simple abstractions are required, sometimes more complex refactorings or the introduction of design patterns.
  4. Fewest elements
    • Extra Code Means Extra Effort: It increases potential bugs, maintenance, and developer cognitive load.
    • Lean Codebase: Aim for a minimal set of elements in the code (variables, functions, classes, etc.) that still meets all the requirements, aka passes all the tests. Reducing lines of code is usually part of this process, but the ultimate goal is not to minimize code at the expense of readability, but to simplify the code so that it is lean but still easy to read.