Why Did I Go Agile? Part Two: TDD
As I mentioned in the first post in this series, Part One: An Open Mind, I was ready for change and willing to try TDD.
I had just joined the team that was forming to deliver a large project in a short timeframe. I was responsible for an entire subsystem for a project that was supposed to ship in a few months. At this point, I had heard and read a little bit about test driven development, and I knew two colleagues that used TDD successfully. After the pains I had gone through on recent projects, I decided to try TDD out on my code. I was used to doing unit testing after I coded, but doing it in a half-assed way, as there was never enough time to do it right. So I read a few books, got a little bit of help, and started doing TDD on this subsystem. It was tough at first, and I broke the rules a lot, but I was trying. In the end, I did not follow the rules completely, but I did have automated unit tests for most of the code (most of the tests were written before system code, but not all). I delivered my code on our "code complete" milestone, even though I did need to work a few long days. The test team took an initial look, and found a few environmental and configuration issues. After ironing these problems out, which took a week, I waited for my testers to start filing bugs.
And I waited…
…and waited…
Finally, after a week and a half of waiting, I stopped by the office of the lead tester, and asked if he had looked at my code yet. He had. He had a whole suite of automated functional tests and a number of manual and exploratory tests. But he had found only one issue: the spec was out of date and needed to be updated. I asked him to continue hammering on the sub-system and let me know if there were any problems.
I took the opportunity to relax a bit. After a week, I was caught up on documentation, my booklist, and I was bored. So I asked my manager who was having problems and who needed some help because of their bug counts. I was able to work on a few other subsystems and provide help for a few developers. This became another death-march project for the other developers, with the team using me as a firefighter. I was still waiting for a bug in my subsystem when we shipped, and am still waiting now, almost two years later.
This experience completely sold me on TDD. It also set me up to be more open to other "crazy" ideas around agile.