This post was previously on the Pathfinder Software site. Pathfinder Software changed its name to Orthogonal in 2016. Read more.

Many developers I talk to say they have tried Test Driven Development (TDD), but it “didn’t work for them”. Why is this so often the case? I believe that the main reasons are 1) it wasn’t done correctly 2) the effort was too quickly abandoned 3) the benefits were not obvious to the developer.

1) It wasn’t done correctly.
Doing TDD the right way is beyond the scope of this post. The best ways to learn are pairing with a TDD expert and reading some of the good books on the subject. I really like The RSpec Book and Test Driven.

2) Abandoning the effort too quickly.
At first, development time will increase until proficiency in TDD is obtained. This improvement ravine is very well documented by Martin Fowler.

3) TDD benefits
Though the TDD benefits at the micro-level are significant, the macro-benefits are outstanding! Preventing or fixing bugs early provides a huge cost benefit to the customer. The cost of fixing design or coding bugs exponentially increases with time from bug authoring.

Some argue that the same benefits can be achieved with Test After Development (TAD). In my experience, TDD is much better than TAD for the following reasons: