Skip to content

Instantly share code, notes, and snippets.

@muz3
Forked from O-I/four_elements_simple_design.md
Created February 27, 2021 06:46
Show Gist options
  • Save muz3/6d63db8566176dc498085528aadb7e45 to your computer and use it in GitHub Desktop.
Save muz3/6d63db8566176dc498085528aadb7e45 to your computer and use it in GitHub Desktop.
The Four Elements of Simple Design

The Four Elements of Simple Design

The rules can be stated as followed:

  1. Passes all tests
  2. Maximizes clarity
  3. Minimizes duplication
  4. Has fewer elements
  • The rules are listed in priority order.
    • e.g., Passes all tests trumps Maximizes clarity.
  • Rules 2 and 3 often seem to swap priority.
    • Minimizes duplication precedes Maximizes clarity in most versions (including Beck's).
    • Really, rules 2 and 3 feed off of each other like a dynamo.
    • When writing code, Minimizes duplication seems to trump Maximizes clarity, but when reading code, the reverse seems to be true.
    • On average, a developer will spend 10 times longer reading and understanding code than writing it. As a result, I personally place Maximizes clarity above Minimizes duplication, but it depends on what is being done and by whom.
  • Rule 0: Kent Beck says:

    In the rare case they are in conflict (in tests are the only examples I can recall), empathy wins over some strictly technical metric."

Further reading:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment