Thursday, December 25, 2014

Two kinds of safety

While comparing the use of tests to catch bugs vs. improve design, I had a thought about safety (also inspired by Anzeneering).

The "catch bugs" approach provides one kind of safety - if I screw up, the tests will catch my mistake before it has a chance to do any harm.

The "improve design" approach provides a different kind of safety - I look for hazards and eliminate them, so the mistake doesn't happen.

To use a metaphor: if you have a high-wire to cross, the first kind of safety would come from a safety net under the wire; the second would come from replacing the wire with a wide, stable platform.

The wire + net is quick to install/change/remove; I can practice my balance on it; it's exciting. If I fall, I have to crawl back and try again.

The wide platform is expensive, but I can traverse it without taking great care; I can run across.

Working in untested legacy code is like living in a tree city where each home is connected by high wires.

No comments: