Skip to content

Instantly share code, notes, and snippets.

Last active September 29, 2023 10:07
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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:

Copy link

golubitsky commented May 11, 2022

His exact wording appears in the White Book.

It's on page 109 (of the edition published in 2000)!

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