Paul ([info]subtlety) wrote,
@ 2003-12-31 20:22:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
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.




(Post a new comment)


(Anonymous)
2004-01-01 01:37 pm UTC (link)
Eclipse is better ;)

(Reply to this)

TDD is not about testing
(Anonymous)
2004-01-01 03:00 pm UTC (link)
TDD is a way to design your object model. As a side effect it will produce test cases (which is good) but it is not really about testing. I have found that TDD increases my coding speed since I tend to get better object model faster and a firm base to do refactoring when requirements change.

(Reply to this)

Longer answer
(Anonymous)
2004-01-01 05:14 pm UTC (link)
There is an answer to this in my blog:

RE: Enough with the Test Driven Development Hype (http://blogs.codehaus.org/people/rinkrank/archives/000533_re_enough_with_the_test_driven_development_hype.html)

Cheers,
Aslak

(Reply to this)(Thread)

Re: Longer answer
(Anonymous)
2004-01-01 05:43 pm UTC (link)
TDD is one of those things where an epiphany happens and all of a sudden the way you code is changed forever after (well, not forever, but you get the idea).

Think of it as defining pre and post conditions for the code you write before writing the code. The side effects are that it keeps you from taking short cuts, and all the weird stuff about emergent design starts actually happening.

I have found that if I have a vague idea and try to implement without TDD I wind up with a hackish prototype that I need to throw away and reimplement two more times before it gets clean. If I start with a vague idea and go with TDD I wind up with pretty clean code that is usable, refactorable, easy to test. I also have a damend good regression test suite thrown in. The best part about it is that the TDD method is faster to do!

IMHO the best intro to TDD I have found isn't in any of the TDD books, but is in the "Java Open Source Programming" book by Walnes, et. al. published by Wiley.

-Brian ( http://blog.skife.org )

(Reply to this)(Parent)(Thread)

Re: Longer answer
(Anonymous)
2004-01-02 02:18 am UTC (link)
Ewh, NOT a good book! I just wrote a review about it.

http://www.bileblog.com

(Reply to this)(Parent)

Agree
(Anonymous)
2007-07-27 08:17 am UTC (link)
If tdd was da answer to the software problems of da world then there would be perfect bug free software written 1st up, and every 1 wood b useing it! I think its overrated!

(Reply to this)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…