TDD is Proven to Improve Quality and Productivity. Allegedly.
Phil Haack recently wrote about a paper published in the Proceedings of the IEEE Transactions on Software Engineering entitled “On the Effectiveness of Test-first Approach to Programming”. The paper reported the results of an experiment into the relative merits of the test-then-code approach over the code-then-test approach and proudly concluded:
We found that test-first students on average wrote more tests and, in turn, students who wrote more tests tended to be more productive. We also observed that the minimum quality increased linearly with the number of programmer tests, independent of the development strategy employed.
As Phil’s post explains, the results are not the end of the discussion, but they appear to provide the much requested evidence that TDD is a cost-effective and worthwhile tool that ought to be used when developing software.
However the conclusion above and the paper’s results don’t quite tie up. Jacob Proffitt writes an excellent critique of the paper and its conclusions. He points out that the results show better quality and productivity when unit tests are written after the code.
So does this mean that Test Driven Development isn’t all it’s cracked up to be? I’d argue no, it doesn’t mean that. Both Phil and Jacob seem to miss the fundamental advantage that TDD brings to an organisation: developers actually write unit tests when doing TDD. The idea of writing the code and then the tests is both an old idea and an idea thoroughly proven to never (or very rarely) happen in my view. The paper is fundamentally flawed and compares a “code after test” verses “test after code” strawman. A real-life experiment would need to compare “code after test” versus “code and run out of time for testing”.
When someone carries out studies into whether TDD leads to more unit tests being written and whether more unit tests leads to increased quality and productivity, we’ll know the answer for sure. Until then, the notion that TDD is better than no testing is a subjective, rather than empirical, conclusion. However most managers aren’t experts on the scientific method and so the distinction is likely to be lost on them. In my view at least, it is and will remain a perfectly sensible conclusion that should stand until someone objectively shows otherwise.
Share This Post...
2 Comments so far
Leave a reply

You state “However the conclusion above and the paper’s results don’t quite tie up. Jacob Proffitt writes an excellent critique of the paper and its conclusions. He points out that the results show better quality and productivity when unit tests are written after the code.”
I am a co-author of the study, but no, I am sorry, this third-hand account is wrong. The results point to no such thing. The paper would not have survived a stringent academic peer view process if they did. There is a lot of over-interpretation and counter-interpretation of this paper in the cyberspace. It’s quite interesting to follow. But it’s best to read the paper itself. I also posted a replies to Jacob’s post. Jacob later posted a post-comment himself.
Hakan,
I accept I’m wrong to claim “However the conclusion above and the paper’s results don’t quite tie up.” It would be much better to claim that some - such as Jacob - claim they do not add up. I’ wasn’t seeking to make the assertion myself after all.
Jacob Proffitt is a strong advocate of test-after methods, and so it is no surprise that he finds fault in your study. However he does argue his case well and I’m afraid “The results point to no such thing. The paper would not have survived a stringent academic peer view process if they did.” doesn’t hold water as a rebuttal of his points.
I still stand by my remark that you didn’t study what really needed studying. When few do unit test, whether test-before or test-after is better is of little consequence. What we really need to know is what are the real benefits of unit testing versus not unit testing.