Saturday, July 21, 2007

What is TDD?

This past week I attended a local ALPN event, and the topic was Test Driven Development (TDD). This was more technical than our usual topics, but I thought it was well presented and answered a lot of questions.

George Dinwiddie
was the presenter and did an excellent job of introducing TDD to a mostly non-technical audience. He started the discussion asking the attendees if they had heard of TDD (most everyone has) and what they thought TDD was. This is where it got interesting.

Not everyone responded, but those that did had a wide variety of answers, anywhere from TDD is another name for unit testing, to TDD is something that developers use to write code.

Here is what TDD is
  • assurance that your code does what you think it does
  • code documentation
  • code 'designer'
TDD has many benefits, but can be hard to adopt - it is a different way of thinking. The basic premise is to write a failing test case first, then write the code to make the test case pass.

It's a great way to improve code quality.

Here is why you should get your team to try it

George pointed out that his code quality has dramatically increased since adopting TDD, and said that he is now producing three times more code in the same time frame.

I've tried it myself and can certainly vouch for my productivity, but it was difficult to get started, and sometimes I don't stick to it as much as I should. As George said, it's important to start slowly, but take the time to be successful - often hard to do when you are under pressure to deliver.

I don't know - maybe I'll pick it up again!

Here is where you can get more information

The web has a lot of information on TDD. The best sites are, the wikipedia entry and of course, George's blog.

No comments: