News for hackers. Stuff that matters.
Re:Good code needs few unit tests by youngian on Friday March 19, 2010 @05:39PM (#1205355)
So how do you write a test for a case you couldn't foresee?

You don't, but once you discover it, you write a regression test to make sure it doesn't come back.

However, IANATDD, I am not a test-driven developer - I don't see any reason to be dogmatic, but I do think unit tests can be extremely valuable. So this answer might not be TDD-approved.

Re:Good code needs few unit tests by InclinedPlane on Friday March 19, 2010 @07:42PM (#1205582)
"So how do you write a test for a case you couldn't foresee?"

"You don't, but once you discover it, you write a regression test to make sure it doesn't come back."

Sure, that's SOP in any good dev. house that does testing. But you've failed to address a key weakness in TDD. The real question is how do you discover these sorts of defects given that a single developer writing in a TDD style is unlikely to do so? TDD is clearly not a cure all, and this is a major weakness of it. Other development techniques, many of which can complement TDD, such as formal code reviews and beta testing can do a better job of getting you to higher product quality than TDD alone.

Re:Good code needs few unit tests by chuckm on Friday March 19, 2010 @11:26PM (#1205907)
"TDD is clearly not a cure all"

Who said it was?

Re:Good code needs few unit tests by binspace on Saturday March 20, 2010 @12:50AM (#1206000)
Exactly!! There is no such thing as a cure all. Anybody angry over a technique that does not solve all problems is clearly suffering from the Silver Bullet Syndrome.
Re:Good code needs few unit tests by devinj on Saturday March 20, 2010 @02:17AM (#1206090)
What? Why does something have to be perfect for somebody to get angry over it?
Re:Good code needs few unit tests by binspace on Sunday March 28, 2010 @05:57PM (#1225317)
Not exactly sure what you are asking. I mainly meant any tool you use will not solve all of your problems. Pretty basic common sense, IMO.