July 26, 2011 at 2:16pm
home
I’m finally diving into test-driven development (TDD), and two advantages come to mind:
- Making tests pass is fun! It’s a game: checkmark, checkmark, checkmark. Short feedback cycles (aka. instant gratification) are critical in maintaining ‘programming morale’ and productivity.
- Coded specs dramatically reduce the cognitive load of programming. Previously, I had to keep the entire application in my head to avoid regressions and manually hunt n’ peck for the inevitable bugs (or worse yet, have a production user complain, eek!). Now, once the spec is written, I let the spec worry about regressions, while I worry about new features and refactoring.
Of course, tests are still only as good as they’re written.