← technical essays
[ESSAY]
No. 7.82 Apr 18, 2026 short essay

How to Work With Legacy Code Without Contempt

Legacy is evidence of survival — read it before you rewrite it.

[ essay ]

Legacy code is evidence a system survived users. Contempt is a shortcut around reading it.

I wanted to sneer at mystic-bytes first. Ugly sort_key values. Leftover Jekyll plugins. Date formats that look like a dare. A rewrite would have been emotionally cheaper than an afternoon of characterization. It would also have broken the index. The strange branches were often production fires I never saw — cover paths, a numbering scheme that looks accidental until you watch listing order collapse without it. Before you change a module, pin its behavior: tests, logs, the user flow it still serves.1 Archaeology is slower than mockery. It is also how you avoid reproducing the fire with cleaner names.

Not every odd path needs deletion. Stable, low-churn modules can rest. When you do change legacy, leave breadcrumbs — an ADR, a comment that names the incident the branch survived, a test that fails if someone “cleans” the invariant. Contempt writes the rewrite. Curiosity writes the test.

Someday your code will be someone else’s inheritance. Write the kind you wish you had found, starting with the respect of reading it.

— JV · Dark Heart Labs.

  1. Michael Feathers, Working Effectively with Legacy Code (Prentice Hall, 2004) — characterization tests before change; legacy as code without tests, not code without virtue. ↩

№ 7.82 — JV · Dark Heart Labs.