A Hardheaded View of TDD

I had a chance to pair with Llewellyn Falco last week at Agile Open Northwest. Our approaches to test-driven development are pretty different, so we had some interesting conversations on the nature of TDD. In a followup email, Llewellyn said that his takeaway was that I don't see tests as specifications for my app. To which I responded:

You're absolutely correct that I don't see TDD's tests as specifications. I see TDD and its tests as a tool with three benefits:

  1. Helping me write correct, usable code now
  2. Alerting me and others to errors when we change or add code
  3. Helping us understand the original intent of my code

My approach to TDD is focused on maximizing these three benefits while minimizing the cost of writing and maintaining the tests. Specification isn't part of the picture. (It has value, but it isn't what I use TDD for.)

I may have missed a few of the benefits of TDD in that response, but I think it's essentially correct. I take a hardheaded view of TDD. For me, TDD's tests aren't an end worth pursuing. They're a tool that gives me certain benefits: a check on my work, a suite of regression tests, and code-level documentation. Other than that, they're waste to be minimized.

If you liked this entry, check out my best writing and presentations, and consider subscribing to updates by email or RSS.