Stewart Stremler wrote:
begin quoting guy keren as of Tue, Aug 15, 2006 at 12:13:22AM +0300:
[snip]
the first rule of writing unit tests is - don't think about it. do it.
the second rule of writing unit tests is - don't think about it. do it.
It's easier to start this way than it is to retrofit.
It's better to retrofit than to not test at all.
I disagree with you.
I have come to the conclusion that the "test first" folks are wrong.
Write the code to do what you want to do first.
Write tests as you *debug*. The act of writing the debug tests causes
the refactoring that the "test first" folks so actively crave.
I find that when I make the shift to the debug phase is when I actually
can start to delineate the boundaries. Before that, it's wasted effort.
In addition, those areas with the most bugs accrete the most tests.
This is, in fact, what you want. You don't want to spend lots of time
writing tests for areas that you got correct; you want to spend as much
time writing tests for those areas which are tricky.
Perhaps this breaks down in a group. But when I am writing something by
myself, my time is the single most valuable commodity. I can't afford
to be wasting time writing tests for those areas I got right or for
those areas which are going to get ripped out shortly.
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg