Wednesday, September 17, 2008

unit tests and just-got-it-working inertia

I've been reading and enjoying The Productive Programmer by Neal Ford. It has re-ignited some of my passion for Test-Driven Development.

This morning I finished a first phase of "refactoring" some code architecture and found myself extremely hesitant to dive straight into the next phase. I think it's because the extent of my "testing" was to tab over to the fully-functioning web page and refresh after each code change. That's pretty much an "all-or-nothing" scenario.

And the thing about all-or-nothing scenarios is that once you've achieved the "all" state, you're very hesitant to go back to the "nothing" state. Maybe I'm starting to understand one of the benefits of unit tests as opposed to whole-sale acceptance tests. With smaller unit tests, you can move more concretely from nothing to something, then from something to something a little more, then finally to all done.

No comments: