A rewritten piece of mass does nothing if it sits in isolation.
Before diving into specific habits, you must understand the framework.
Do not rewrite the whole call graph. Start with read-only operations that have no side effects. incremental mass rewritten guide
GET /user/profileMost existing guides (Fowler’s StranglerFig, Feathers’ Working Effectively with Legacy Code) assume sequential replacement. The Rewritten Guide is not a first-edition how-to. It is a meta-guide – a guide that has itself been incrementally rewritten to reflect real-world failures. Key revised principles:
| Original Guide (2008) | Rewritten Guide (2025) | | :--- | :--- | | "Start with the smallest module." | "Start with the highest-traffic, lowest-business-risk API endpoint." | | "Rewrite then route." | "Route then rewrite (dual-write + comparison)." | | "Maintain perfect parity." | "Tolerate temporary functional drift with feature flags." | | "One team, one codebase." | "Enable parallel modular teams with contract testing." | Internal Link Cascade: From your newly rewritten guide,
| Exercise | Week 1 | Week 2 | Week 3 | Week 4 | | --- | --- | --- | --- | --- | | Squat | 100 kg | 102.5 kg | 105 kg | 107.5 kg | | Deadlift | 120 kg | 122.5 kg | 125 kg | 127.5 kg | | Bench Press | 80 kg | 82.5 kg | 85 kg | 87.5 kg |
Abstract Legacy code is a liability, but a "big bang" rewrite is often a suicide mission. This paper presents Incremental Mass Rewriting (IMR) , a hybrid strategy that combines the architectural purity of a rewrite with the safety of incremental refactoring. We provide a step-by-step guide to strangling a legacy system by rewriting it in parallel, routing traffic gradually, and measuring success via objective metrics. Part 1: The Philosophy of Incremental Rewriting Before
In traditional rewrite strategies, the entire system is considered the unit of change. This fails when the system’s inertia (mass × resistance to change) exceeds project tolerance. We propose:
[ \textRewrite Inertia = \sum_i=1^n ( \textLOC_i \times C_i \times D_i ) ]
Where:
High mass means high risk. Incremental reduction of mass via molecular replacement is the only viable path for systems >1M LOC.