I've been trying to discipline myself of late to always write my tests first. In a personal project, I found two things: first, I can see the code working right away, and second, I tend to write code in such a way that it's easy to write tests for.
The first is important on code I'm not being paid to write, because I have a tendancy to write all the interesting portions of the code and then stop. I can't tell you how much 3-5 year old code I have in my projects directory that won't even compile because I gave up on it.
The second is really interesting. I often find that the code that is easy to test also happens to compartmentalize into subroutines well, so it ends up encouraging good design anyway. Certainly a case of constructive laziness.
Have other monks that use Test Driven Development found the above to be true?
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Testing: Fun for the family
by hardburn
in thread Testing: Fun for the family
by BUU
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |