You're viewing the readable version of this site. The interactive extras (search, diagrams, read-aloud) need JavaScript and a current browser. Enable JavaScript; if it is already enabled, update your browser.

Learn · Hidden Machines · Part VIII

budding

Leave the Tangle Standing

When recognition does not justify refactoring.

refactoring, restraint, software-design, maintenance, learn

You will use reachability, used laws, lifetime, and second-consumer evidence to refuse an abstraction while still strengthening local tests.

The recognized machine that should not ship

A migration shim has idle and copied states and one event. It will disappear when the old store is removed. The machine is real. A reusable framework would also be real—and worse.

Restraint — decide whether recognition earns extraction.

Apply the adequacy tiebreak one last time. Reachability: the larger object eliminates no reachable state. Law count: the shim uses only one transition, not composition or reuse. Second consumer: none exists. Add the smallest local type or assertion that makes the invariant visible, preserve one minimized failure fixture, and leave the duplication uncoupled.

Restraint also protects package boundaries. Every exported primitive creates a name, documentation, compatibility surface, and future search result. A deep local function may hide more complexity behind less interface than a shallow framework assembled from fashionable nouns.

Declining today is not permanent. Record the signal that would reopen the decision: a second consumer, a reachable contradiction, repeated divergent fixes, or an observation impossible to preserve locally.

The complete method

The machinery was there before it had a name. Recovery made its states, operations, owners, observations, carrier, laws, and refusal boundary explicit. Sometimes that evidence earns a sum type, machine, semilattice, region, zipper, or solver. Sometimes it earns only a better local test.

The machinery was always there; elegance began when we learned to see it—and restraint began when seeing it stopped being enough.

Lessons

  • Recognition and extraction are separate decisions.
  • A local invariant may capture all the value without a public abstraction.
  • Deletion horizon and coupling cost belong in the evidence.
  • Record what future signal would reopen the decision.

Practice

  1. Recover a structure from a temporary migration and argue against extraction.
  2. Compare deliberate duplication with a shared abstraction whose consumers change for different reasons.
  3. Revisit unfamiliar code after one month using the Retrieval Route.

Return to the contents and choose a chapter by the next tangle you meet.

References

  1. John Ousterhout, /A Philosophy of Software Design/.” — module depth and the cost of interface complexity.
  2. Martin Fowler, “Rule of Three”.” — a practical threshold for resisting premature generalization.