Agile Zone is brought to you in partnership with:

James is a consultant, author, and speaker. He brings a rare combination of business savvy, deep technical understanding, and an engaging presentation style to his work, putting him in demand around the world. James is a prominent figure in the Agile community: he is an inaugural recipient of the prestigious Gordon Pask Award for Contributions to Agile Practice and one of the first ten people to sign the newly-released Agile Manifesto in 2001. James keeps a blog at jamesshore.com and is co-author of The Art of Agile Development. James is a DZone MVB and is not an employee of DZone and has posted 60 posts at DZone. View Full User Profile

A Hardheaded View of TDD

02.21.2011
| 1716 views |
  • submit to reddit

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.

References
Published at DZone with permission of James Shore, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Mark Anthony replied on Fri, 2012/04/13 - 10:57am

I see where you're coming from. But it seems like "TDD's tests aren't an end worth pursuing" is contradicted by your stated benefit of code-level documentation--i.e. the end of well-crafted tests themselves. As you suggest, one very worthy primary goal of TDD is creating useful documents that help future code maintainers navigate and understand class capabilities. That's big enough to make the "other than that" seem out of place. 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.