The Four Elements of Simple Design
- Introduced by Kent Beck in the 1990s.
- Part of his software development methodology Extreme Programming.
- His exact wording appears in the White Book.
The rules can be stated as followed:
Passes all tests
Has fewer elements
- The rules are listed in priority order.
Passes all teststrumps
- Rules 2 and 3 often seem to swap priority.
Maximizes clarityin most versions (including Beck's).
- Really, rules 2 and 3 feed off of each other like a dynamo.
- When writing code,
Minimizes duplicationseems 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
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."