Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ewatch/4b5fde35582f6ff5e5ceb844b799d0fd to your computer and use it in GitHub Desktop.
Save ewatch/4b5fde35582f6ff5e5ceb844b799d0fd 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