The diary of a .NET Developer, working on an unlaunched startup project. Also, I live and work in Southern Oregon.

Saturday, January 17, 2009

Test Driven Development is design

In Hanselminutes podcast #146, Scott Bellware talked about Test Driven Development being design, which I already sort of knew, but what I got out of the show is how TDD can really make a difference in my coding practices.

By practicing TDD, it's going to bring to light all sorts of "test friction". For example, the harder it is to setup tests, the harder TDD becomes. The difficulty I have in setting up tests my objects is a big reason I don't even attempt to practice TDD. Once I realized this, the idea that "test smell begets design smell begets code smell?" sort of made sense. I've got this horrible test smell staring me in the face and now I really want to do something about it.
How can I reduce test setup friction? Is single responsibility (part of SOLID) the answer? Will Structure Map help?

Scott Bellware finished the podcast with a suggestion to read the book TDD in Microsoft .NET by James Newkirk. I actually already own the book and immediately pulled it off the shelf and am re-reading it. ( I read it 2 years ago before I even knew what unit testing was.)

I'm researching this topic heavily and will post more when I find some answers.


  1. Hi Ben,

    There's some value in the mental exercise of trying to say "setting up objects" versus "setting up tests". It's a subtle difference, but it does help focus on the core issue. Also, it may help others around you make the transition, as well.

  2. That does make more sense. The problem is coming from my objects, not the tests.