« Feedback | Main

March 08, 2010

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e5539fd288883301310f7c6362970c

Listed below are links to weblogs that reference Test Driven Development vs. Freehand Development (my addition to the ever evolving construction analogy):

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Dan Yankowsky

I like something that I believe you once said to me: TDD would still have value even if somebody came along at the end of the day and swept away all the tests that you had written.

I do generally find that testable code is of higher quality than untestable code. (There are counter examples, but I think there is a correlation between testability and quality.) I certainly found that my coding style changed as I was learning TDD. More recently, I find that I don't often write unit tests (even in places where it would definitely help me). Still, TDD has had an obvious impact on the code that I write. I think many programmers could benefit from thinking from a test-oriented point of view.

In terms of design, I think that unit tests act as a sanity test. By actually trying to exercise the class under test, the developer will see the class from a new perspective. Ideas that seemed good from the inside of the class might turn out to be bad ideas when viewed from outside. Bulky classes create bulky tests, and bulky tests can be easier to see.

To tie this back to architecture, I think of unit tests more like CAD. An architect who is restricted to paper will have a harder time "seeing" the building he is designing. On the other hand, an architect with access to CAD software can instantly grok the entirety of his design. Anything that appears out of place will be obvious. The same is true for unit tests. Tests make it easy for you to think of a class as a whole, from the outside. This perspective shift is the key.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment