Saturday, March 11, 2006

Falling in love

Falling in Love

Well I've fallen in love again (no not with another woman, very much in love with my wife!), and JUnit is the object of my desire. I remember being skeptical about using unit testing on a project. I had all the typical concerns about how much it would slow me up and whether it would be worth all the extra time. Ladies and gentlemen, it's been worth every ounce of effort.

I got to a point in developing where I was sick and tired of buggy code. Tired of doing a demo and something breaking, or changing a seemingly innocent isolated piece of code and then finding out much later on that I'd broken some obscure feature. I don't consider myself a bad programmer in the sense of writing typically unstable code, but something had to change. Enter unit testing.

I've been using my Shoechicken project (http://www.shoechicken.com), as my first testbed for unit testing. I decided that if it worked well for Shochicken, I'd start looking into using it elsewhere. Well I have to say that Shoechicken has benefited wonderfully from our ever growing set of tests. Not only do I feel much more confident about code I write, but I feel more confident in refactoring and improving older code as the unit tests provide a good indication of whether all is well with the chicken. I do feel that the unit tests slowed me down, there's no real way that doing extra typing isn't going to. Where I feel I've actually saved time is in code maintenance and bug tracking.

Bottom line is that I recommend unit testing to anyone who's interested (and those who aren't.)