Cory Foy has a post on evidence from at least one project that unit tests may be in fact free, as long as you do TDD. The point is that they wrote 35,000 lines of source code for a project and 35,000 lines of test code and they delivered in about 9 months with 8 people. According to some numbers from McConnell this would be pretty good if you just count the lines of source code. If you count the 75,000 overall lines the team performed at an extraordinary level. So in essence the extra quality baked in with unit tests kept them on schedule and didn’t actually add any time to the schedule, essentially making it free. This is similar to the idea I’ve heard from JB Rainsberger and others that everyone believes that:
- You need to go faster to code faster.
- Actually you need to slow down to go faster.