I really like the idea of test suites, they give me a positive feeling that the code I’m making is probably going to do what it’s supposed to do. Not only that, but I feel far more confident about hacking the code to pieces in a random fit of creative genius if I know I can run a set of unit tests at the end and make sure all my designed APIs still work from the outside.
But why should I feel so good about tests? Isn’t writing the tests just like writing the code? except for the second time?
Well the logic of tests may mean that you have to do all the same kinds of logic, but it’s not really the same logic. You’re telling the computer what you expect to happen, not what happens. Take the analogy given in the title: If you were to carve/sculpt a masterpiece, you could be expected to gain some great notoriety for being a genius artist; alas much like code without tests it’s a one shot deal. As soon as you try and change the work, change it’s material and reproduce it for more customers you suddenly find yourself with lots of work making, remaking, fixing and refixing.
Any hired programmer will recognize the situation. Conversely software with complete testing (of all three kinds) will be much more like a mold, given any language with enough consistent code you could fill the mold many times to arrive at the same quality as before. The tests aren’t the same as the original sculpting, they’re much more like the framework that shows how to reproduce the work with ever tighter testing resulting in ever more accurate reproduction.
This assumes of course you imagine programming cycles as if they were mass production units.
Enough waffle! what do you think?