Vladimir_Nesov comments on Coding Rationally - Test Driven Development - Less Wrong

25 Post author: DSimon 01 October 2010 03:20PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (82)

You are viewing a single comment's thread. Show more comments above.

Comment author: Darmani 28 September 2010 06:51:21PM 1 point [-]

It's confusing to think of TDD as its own rationality technique: testing your belief that a piece of code works is not fundamentally different from testing any other belief. Okay, so that part is just running unit tests once. Since whether a piece of code works is a different belief from whether that piece of code with a few modifications works, for efficiency, since writing tests is work, you need to keep that tests around and rerun them. So, that's unit testing. TDD is just writing your tests beforehand, which makes a difference in the process of designing software, but not really in how confident you should be that your code works.

Something more interesting to think about is how much information a test gives you that your code works. You can often tell from eyeballing whether switching an integer from positive to negative will make a meaningful difference whether the code produces the intended result.

This really turns into an approximate, poor-man's version of proving code correct, which typically proceeds by breaking down code into its paths and checking each against the mathematical model.

Which reminds me, I have to go prove a few Standard ML functions work by Friday.

Comment author: Vladimir_Nesov 28 September 2010 07:09:43PM *  5 points [-]

It's confusing to think of TDD as its own rationality technique: testing your belief that a piece of code works is not fundamentally different from testing any other belief.

No rationality technique is "fundamentally different" from fixing of any other kind of incorrect beliefs. You've just made an absolutely general counterargument.

(With TDD, you also test that the code didn't work before the bugfix (in the specific way), and started working as a result of it. It's too easy to fix nonexistent problems.)