Jimmy Bogard has a post that hits the nail on the head with being a lonely programmer yet still applying TDD. I have been asked by two separate people recently what resources they should consider looking into for starting out in programming. Even though I am hardly an authority, I inevitably encourage folks just now getting into it to start learning how to apply TDD. Here are a few other benefits which I see TDD bringing to the solo developer.
- Refactoring is encouraged instead of rewriting . Having the freedom to do with the code what I want would usually leave the door of rewriting open to me. This not only stunts my growth as a developer who needs to learn to write code that is malleable, but also costs lots of money. But without tests in place, the paranoia would sometimes drive me to do a rewrite since the old code just didn't look perfect.
- BUFD (Big Up Front Design) has a greater chance to be suppressed. One of the problems with working alone is the freedom to think big about all the neat things I could do rather than solving how to execute the project requirements. Since there isn't someone sitting their making a face because you are off-topic on a requirement, the humble [Test] acts as that face that isn't impressed by my gold-plated code.
- Programming remains fun because it is doing stuff. Since there aren't the interesting discussions with peers or a sense of teamwork, the neat feeling we get when we see the computer doing our bidding serves to maintain some inspiration for the task-at-hand. If you are having to run the debugger and fight your way through a million NullRef exceptions or other misteaks to get to the point where you see something happening it is easy to get sidetracked or stop having fun. The feedback loop is more important for my sanity than the projects' success.
- I am still learning. Working in small chunks seems to promote experimentation in me more than a big empty project template. If there are things I need to play around with I feel like it is easier and okay to do that within a test fixture...I realize this isn't 'TDD' in the sense of driving out my design using tests, but it nonetheless gives me the impression that I am free play around with something before I head the design that way.
- Parameters are liberating. Stravinsky once said 'The more constraints one imposes, the more one frees one's self. And the arbitrariness of the constraint serves only to obtain precision of execution.' I have found the simple constraint of getting a test to pass drives me to improvise more in making it do so, usually making me think more creatively.
All I know is that I wasn't delivering features to my clients with as much confidence or timeliness before I started applying the principles the people who advocate TDD do. It isn't simply a matter of being disciplined, because I was quite disciplined, but I needed to focus that discipline into an paradigm that fed me as much as I feed it. For this solo pilot, TDD has scratched that itch.
Posted
04-23-2008 11:52 PM
by
Michael Nichols