Pure Danger Tech


navigation
home

Unit tests are a drop cloth

28 Jul 2007

So, here’s my software analogy of the day. I was doing some painting last night and this analogy occurred to me:

Unit tests are to refactoring     like a
Drop cloth is to painting

That is, unit tests provide a form of protection such that you can modify your code as desired with the protection provided by a good unit test suite. In painting, the drop cloth serves the same purpose – it protects your floor or furniture, allowing you to paint while protecting your stuff.

More importantly, both unit tests and drop cloths feel like more work at first but ultimately save you time by allowing you to move faster.