News for hackers. Stuff that matters.
Re:Pledging for unit tests by tomjen3 on Friday October 29, 2010 @04:29PM (#1848892)
>IMO, the basic principle of TDD is solid: write the tests, then write the code.

This is where we disagree: the value of the code is secondary to the tests (this shouldn't be that big a point of disagreement: would you rather have no tests and the code of a functional program, or great tests and no program?), but if you design the tests first, you are going to design the program such that it is easy to write tests for.

Write the program first, then write tests for it in the places where it is reasonably worth your time to do so.

Re:Pledging for unit tests by dstorrs on Saturday October 30, 2010 @02:04AM (#1850240)
Ok. I'm not actually that wedded to the order you do the two operations in. I think there is some value in writing tests first, so that you can verify they fail (before the code is written) and then work (once it is complete). But I think it's less important to do them first than to do them.

IMO, the "killer app" for unit tests is regression testing. If I make a change and the test suite still passes, I can be reasonably sure that I didn't break anything. All the other benefits are "nice to haves" in my mind.