| Paul ( @ 2003-12-31 20:22:00 |
| Current mood: | focused |
| Current music: | John Williams - Confrontation With Count Dooku and Finale |
Enough with the Test Driven Development Hype
Okay everyone, that's enough hype about test driven development, I think.
I'm as much a fan of unit-tests as the next guy, used intelligently.
The key phrase, here, is the "used intelligently" part. The Junit documentation gets it right - test anything that "could reasonably be expected to fail", or "has caused an actual bug in the past".
Now, maybe we'll disagree about what "could reasonably be expected to fail". And that's okay by me, as long as we agree that we're not trying to "test everything". Because that is a recipe for madness. You'll spend more time writing tests than code. You'll spend more time maintaining tests than code. That's work for work's sake, and I hate stuff like that.
But, I'm sure some of us are already being told to "unit test everything". After all, unit-testing is our silver bullet that will solve all our bug problems, right?
But when you try to test everything, guess what? You'll spend ages writing hugely complicated test cases. You'll spend ages bug fixing the test harnesses that sometimes are more complicated than the code they're testing (oh, that's a good idea, that is). You'll then discover, about the same time you normally find bugs in your release cycle, that despite all your tools and tests, you forgot to test something, and there's a bug... or eight.
There's a middle-ground here, in the diminishing returns of unit-testing. I think all of us realize you can go too far with the testing. Well, most of us. Occasionally I speak to some poor junior developer who is writing tests for the most idiotically simple code I've ever seen because, well, that's the requirement, and developers at his company aren't allowed to think for themselves.
So, enough with the hype already. It's starting to go too far.
And, as my hypocrisy knows no bounds, let's all go back to talking about how wonderful IntelliJ is.