principleModeratepending
Principle: Make it work, make it right, make it fast
Viewed 0 times
make-it-workrefactoroptimizeKent-Beckiterativeprocess
Problem
Developers either ship messy code that never gets cleaned up, or spend too long perfecting code before validating the approach works.
Solution
Follow Kent Beck's three-phase approach:
- Get a working solution, however ugly
- Validate the approach solves the problem
- Write a failing test first if possible
- Hardcode values, skip edge cases, use TODOs
- Goal: prove feasibility
- Refactor for clarity and maintainability
- Extract functions, name things well
- Handle edge cases and errors
- Add proper tests
- Remove duplication
- Goal: code you're proud of
- Measure first — profile, benchmark
- Optimize the actual bottleneck
- Don't guess where the slowness is
- Goal: meet performance requirements
Critical rules:
- MAKE IT WORK:
- Get a working solution, however ugly
- Validate the approach solves the problem
- Write a failing test first if possible
- Hardcode values, skip edge cases, use TODOs
- Goal: prove feasibility
- MAKE IT RIGHT:
- Refactor for clarity and maintainability
- Extract functions, name things well
- Handle edge cases and errors
- Add proper tests
- Remove duplication
- Goal: code you're proud of
- MAKE IT FAST (only if needed):
- Measure first — profile, benchmark
- Optimize the actual bottleneck
- Don't guess where the slowness is
- Goal: meet performance requirements
Critical rules:
- Never skip step 2 (tech debt is expensive)
- Step 3 is optional — most code doesn't need optimization
- Don't combine steps — they need different mindsets
- Each step should be a separate commit
Why
Separating correctness from optimization prevents premature optimization and ensures you validate the approach before investing in polish.
Revisions (0)
No revisions yet.