I used to hate tests, but now I love them.

When possible, I prefer to write the tests first - and yes, it can help you catch a kludgy implementation earlier.

Sometimes, when refactoring older code, I find it easier to do the rewrite first, because I often don't fully understand what I'm refactoring when I start, so my tests would be way off.

Andy Lester has written some great stuff on the joys of testing. I recommend this (HTML version). If that doesn't convince you of the benefits of a good testing strategy, I don't think anything will :)

In reply to Re: Does anybody write tests first? by cLive ;-)
in thread Does anybody write tests first? by amarquis

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":