In 30 seconds
- Do the simplest thing that could possibly work.
- Kent Beck's four rules guide what simple means.
- Simple isn't easy; it takes discipline and refactoring.
Kent Beck's four rules
- Passes all the tests
- Reveals intention
- No duplication
- Fewest elements
In priority order. These come from Extreme Programming.
YAGNI
"You aren't gonna need it": don't build for imagined future needs. Build for today's stories; when tomorrow's need arrives, refactor to support it. This is the agile principle of maximizing the work not done.
Why it matters
Speculative code adds complexity, bugs and maintenance. Simple code is faster to read, test and change, which supports emergent design.
Myth vs reality
Myth · Simple means quick and dirty.
Reality · Simple means clear and minimal, not careless.
Myth · Simple designs can't scale.
Reality · They evolve to scale when needed.
Myth · YAGNI means never planning ahead.
Reality · Plan for costly-to-change decisions; skip speculation.
FAQ
How do I know when it's simple enough?
When removing anything would break a test or hide intent.
Does simple design conflict with architecture?
No; keep architecture light and intentional.
What's the last responsible moment?
Decide as late as you can without the delay causing harm.