Daily Static

Technology, Dynamic Programming and Entrepreneurship

This page is powered by Blogger. Isn't yours?
Thursday, April 10, 2003
Test Driven Development

I've known about Test driven development for quite some time now, and
I've even tinkered around with it some, but I've never built anything
of significance using it. Until yesterday that is. I finally
decided to give it a try building a full class using test driven
development. I decided what the component needed to do, figured out
the basic functionality it needed to deliver and then I stubbed out
the functions.

Stubbing out the functions allowed me to configure NUnit to run tests
against the stubbed functions. From this point, I wrote about 15
basic tests. This part was easier than I thought it would be,
considering you have to do this implicitly if not explicitly in order
to write any function. Using this method it was easy to carve out
the logic domains the function needed to cover.

Next I worked my way through the tests, completing the functions so
they passed the tests. About half way through I came across a few
things I'd missed in my initial test scenarios, so I added them then
continued working through the tests. All together it took just over
an hour to design it, stub it, write the tests and implement them.
The difference with this process was I felt completely on top of the
process at all times. Every once in a while when I don't do test
driven development and I'm working on a complex problem I get a
feeling of frustration and sometimes a mild disorientation. Usually
I have to take a step back and look at the problem from a different
perspective and then come at it again. However the test driven
development allowed me to carve the problem up into much more
manageable pieces. At the end I felt like it was a really solid
design that was both simple and elegant.

Comments: Post a Comment