You Left the Sauna Early: On Refactors, Regret, and the Cold Bucket of Half-Done Code
Photo: MKFI, Public domain, via Wikimedia Commons
There's a specific kind of shame that comes from finding your own branch from eight months ago. You know the one. It's called refactor/user-service-cleanup-v2-FINAL, it touches 40 files, and it compiles exactly zero percent of the time. You left the sauna early, friend. And now you're standing in the hallway, sticky, half-dressed, with nothing to show for the heat.
The Sauna Doesn't Reward Half-Measures
In Finland, the sauna ritual has a shape. You go in. You sweat — genuinely, uncomfortably sweat. You endure past the point where you'd like to leave. Then you rinse, cool off, and emerge reset. The discomfort isn't a bug; it's the mechanism. The cleanliness only comes after the heat.
Refactoring legacy code follows the same physics. The middle of a refactor — the part where the old abstraction is gone but the new one isn't wired up, where the tests are red and the build is angry — is the heat. It is supposed to be uncomfortable. If you exit there, you've paid full price for a product you never received. Your codebase is dirtier than when you started, because now it's half in two paradigms and your teammates have to understand both.
Half-finished refactors are the technical debt equivalent of a sauna you leave at minute two: all the shock, none of the reset.
How to Know You're Hot Enough
The amateur mistake is treating discomfort as a stop signal. In the sauna, the urge to leave at minute four is not information about the sauna. It's information about you. Same with the refactor. Here are the actual signals that you've reached temperature:
-
The old pattern is fully dead. Not deprecated, not mostly-migrated, not "there's one caller left we'll handle later." Dead. Grep returns nothing. If a comment says "TODO: remove old path," you are not done. You are at minute six.
-
The new pattern is boring. The sign of a successful refactor isn't cleverness — it's that the new code reads like it was always there. If you're still a little proud of it, you might still be in the heat. Boring is the rinse.
-
The tests describe behavior, not mechanics. When your test names stop referencing the old implementation ("TestLegacyPaymentAdapterRetries") and start describing what the system does ("Payment retries twice on timeout"), you've crossed into clean.
-
You can explain it to a new hire in one coffee. Not a whiteboard session. One coffee. If it takes two, you've built a new abstraction that needs its own refactor, and friend, you're about to re-enter the sauna.
The Full Cycle, Committed
If you're going to enter the heat, commit to the whole ritual. Here's the framework — call it the Löyly Loop, because we're contractually obligated to say something Finnish:
1. Enter small, but enter honestly. Don't open a 40-file mega-branch. Open a PR that deletes one thing or moves one thing. Small sessions in the sauna are still legitimate sessions. What's not legitimate is a "small" PR that leaves the old path half-wrapped behind a feature flag nobody will ever remove.
2. Declare the exit temperature before you sit down. Write down, in the PR description, what "done" means: which module dies, which tests must pass, which migration script runs. A refactor without a defined exit is just tourism in a hot room.
3. Endure the red. The middle phase will feel worse than the original code. This is the point where most engineers flee back to feature work, telling themselves the refactor "stalled." It didn't stall. You stood up. Sit back down.
4. Rinse in public. Delete the dead code in the same cycle. Update the docs. Kill the feature flag. The rinse is the part everyone skips, and it's the part that makes the sweat worth it. An unclean exit means the next person to touch the file inherits your sweat.
5. Cool off outside. Ship it, then walk away. Don't immediately refactor the refactored thing. The Finns don't do a second sauna session to fix the first one. They drink a beer by the lake. You should open a ticket for the next cleanup and go touch grass, ideally near a lake, ideally with a beer.
The Counterargument, Addressed
"But sometimes you have to abort a refactor." Sure. Business priorities shift, the acquisition lands, the intern deletes the staging database. Aborting with discipline — reverting fully, documenting why, leaving the map clean — is different from abandoning in place. The sauna closes sometimes. That's fine. But you don't get to leave the door open and the heat running for eight months while the v2-FINAL branch quietly rots.
The next time you feel the pull to bail on a refactor because it's uncomfortable, remember: the discomfort is the work. Stay in the room. Delete the old path. Rinse. Then, and only then, are you allowed to go back to writing new features — which, let's be honest, is just the cold plunge before the next sauna.