December 21, 2006

...Learn TDD with Codemanship

XML Files - No Free Lunch

In my last post, I suggested there was no free lunch when using code generation tools like Hibernate. Logic specified in XML files is logic that still can go wrong and therefore still needs to be tested. When we struggle and fiddle and fuss with our object-relational mappings, I suspect it's because we didn't approach test-driven development with the same rigour that we might when we're testing Java code or C# code. We leave gaping holes in our test coverage, and these problems easily slip in through them.

I've observed the same problem when dealing with Ant build scripts: fiddling and fussing and all manner of time-consuming shenanigans. And I can't help wondering if it's because we didn't treat our build scrupts with the same rigour that we apply to our "production code". Build scripts can go wrong in some very subtle ways. A software configuration can change the behaviour of the system, and therefore needs to be tested just like any other code that can change system behaviour.

So a little light bulb went on in my head and I these words popped out of nowhere:

AntUnit - a unit testing tool for build scripts (not to be confused with "Ant Music")

And wouldn't you know it there is indeed such a beast! Those clever folk at the Apache Foundation have been there and got the t-shirt already.

So here are two New Year's resolutions for 2007:

1. I will implement object-relational persistence mappings using test-driven development
2. I will implement build scripts using test-driven development

And I'll be very interested to find out if the fussing and fiddling and time-consuming shenanigans mysteriously come to an end...
Posted 14 years, 3 months ago on December 21, 2006