Should you TDD when flying solo?


A couple of weeks ago a question came up on the ALT.NET message board:

Does TDD make sense when you’re the only developer in your company?

To me, this is akin to the following questions:

  • Is quality important?
  • Is maintainability important?
  • Is design important?

Remember, TDD is all about design.  Unit tests are icing on the cake.  TDD shows me where I violate the Dependency Inversion Principle.  TDD shows me if my design makes sense from the client’s perspective.  TDD encourages low coupling and high cohesion (but doesn’t guarantee it).  TDD gives me immediate visibility into the pain points of my system.  TDD gives me confidence that my design is right.  TDD gives me confidence to refactor carefully or recklessly.

Without TDD, I have zero confidence in my design is both what I intended nor what is needed.  Without client code exercising concrete behavior for explicit contexts, I have no visibility into the “why” of the design.  Without TDD, I’m flying completely blind.  I can draw UML diagrams, sketch out code, even write little test applications.  But unless I can demonstrate behavior in specific contexts, I have no evidence that my design is right.

Now pair programming solo, that requires some extreme dexterity…

Auto-mocking container pitfalls?