Unit testing and TDD

Back in March, I wrote a column entitled "Unit
Testing and Test-First Development
".

I've been playing around with unit testing a bit more since then, and have a few tentative
conclusions.

1.
Unit testing is, overall, a "Good
Thing
" 2.
Unit testing works well for class libraries, especially ones that act fairly statically.
If you create one of these, you should be writing unit tests 3.
Unit testing is hard with graphical applications and/or dynamic applications. I have
an app that I'm writing that uses multiple threads, fires events asynchronously, and
is peer to peer. There aren't any unit tests for that section yet. 4.
Unit testing is great for tricky code that you wrote but weren't sure that it really
worked. I updated my Regex Workbench a while back,
and in the process wrote unit tests for all the code that I have that interprets regular
expressions to english. I found one feature I hadn't implemented, and two that were
implemented incorrectly. I'm now much more confident that it works.

I'e also been playing with Test-driven development. I'm not sure about it yet, though
it is true that if you write the tests up front, you're much more likely to write
them.