Wednesday, December 30, 2009

Measure Twice, Cut Once

This is an old proverb that means when we take care to do something in a thoughtful manner, we are less likely to make a mistake that wastes time and materials. It is normally thought of in terms of carpentry, but it can manifest itself in several ways for the software developer.

Measuring twice means taking the time to think through the repercussions of one implementation over another. It means identifying potential areas of weakness in a design that may affect the project’s success. It means making decisions based on your audience, not just the “business unit”.

A practical application of this adage is through the practice of unit testing, specifically writing tests first. Write a failing test (measure once). Then write code to pass that test (measure twice). Thus we have made certain our cuts (refactoring) will match our measurement.

Measure twice and cut once you fully understand the outcome of the decision.

No comments:

Post a Comment