Friday, November 6, 2009

Ensuring your own destruction

When practicing Test Driven Development (TDD) that middle ‘D’ is way more important than the ‘T.’ Even if you don’t write test cases before implementation code, or don’t write formal test code at all, driving the design of your application with the goal of having your code be easily testable forces components to be decoupled, dependancies to be explicit, and functions to be small and focused.

It hurt me to read the post linked below. I could put a shameful checkmark next to most of the anti-patterns listed. I take comfort in the fact that you can’t really learn to avoid these problems until you have experienced, first hand, the extrordinary pain they can cause.

How To Write Untestable Code
http://googletesting.blogspot.com/2008/07/how-to-write-3v1l-untestable-code.html