ScaledByDesign/Insights
ServicesPricingAboutContact
Book a Call
Scaled By Design

Fractional CTO + execution partner for revenue-critical systems.

Company

  • About
  • Services
  • Contact

Resources

  • Insights
  • Pricing
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service

© 2026 ScaledByDesign. All rights reserved.

contact@scaledbydesign.com

On This Page

The Most Dangerous Question in SoftwareThe Rewrite Fantasy vs RealityThe Decision FrameworkScore Each Dimension (1-5)ScoringThe Refactor PlaybookThe Strangler Fig PatternThe Boy Scout Rule (Continuous Refactoring)The Critical Path RefactorThe Rewrite PlaybookRule 1: Ship Incrementally, Not Big BangRule 2: Feature Freeze the Old SystemRule 3: Set a Kill DateThe Decision MeetingThe One Rule
  1. Insights
  2. Architecture
  3. When to Rewrite vs Refactor: The Decision Framework

When to Rewrite vs Refactor: The Decision Framework

December 22, 2025·ScaledByDesign·
refactoringrewritetechnical-debtstrategy

The Most Dangerous Question in Software

"Should we rewrite it?" This question has killed more startups and derailed more engineering teams than any technical decision. Joel Spolsky called it "the single worst strategic mistake that any software company can make." Netscape rewrote their browser and lost the browser war. Basecamp rewrote and it took 3x longer than estimated.

But sometimes rewrites ARE the right call. The key is knowing when.

The Rewrite Fantasy vs Reality

The fantasy:
  Month 1-2: Design the perfect new system
  Month 3-6: Build it (cleanly this time!)
  Month 7:   Migrate and launch
  Month 8+:  Fast, clean development forever

The reality:
  Month 1-2:  Design the new system
  Month 3-8:  Build it (discovering all the edge cases the old system handled)
  Month 9-12: Try to reach feature parity (it's harder than expected)
  Month 13-16: Both systems running, bugs in both, team split
  Month 17:   Launch new system (missing 30% of old features)
  Month 18-24: Backfill missing features while fixing new bugs
  Month 25:   Finally at parity. 2 years behind on new features.

The Decision Framework

Score Each Dimension (1-5)

A. Business Context
  1. Can the business wait 12-18 months for the rewrite? ___
     (5 = yes, plenty of runway. 1 = no, existential pressure)

  2. Is the current system blocking revenue-critical features? ___
     (5 = yes, we literally can't build what we need. 1 = annoying but functional)

  3. Can we afford to split the team? ___
     (5 = yes, large team. 1 = no, skeleton crew already)

B. Technical Assessment
  4. Can the current system be changed incrementally? ___
     (5 = no, fundamental architecture is wrong. 1 = yes, just messy code)

  5. How much institutional knowledge is in the old system? ___
     (5 = very little, well-documented. 1 = massive, undocumented)

  6. Are the core abstractions wrong, or just the implementation? ___
     (5 = abstractions are wrong. 1 = abstractions fine, code is messy)

C. Team Assessment
  7. Does the team understand WHY the old system is the way it is? ___
     (5 = yes, they built it. 1 = no, original team is gone)

  8. Has the team shipped a system of similar complexity before? ___
     (5 = yes, experienced team. 1 = no, first time)

Scoring

Total score: ___ / 40

32-40: Strong case for rewrite
  The business can afford it, the architecture is fundamentally
  wrong, and the team can execute. Proceed with guardrails.

24-31: Consider the Strangler Fig approach
  Rewrite incrementally. Replace pieces one at a time behind
  an abstraction layer. Get benefits gradually.

16-23: Refactor aggressively
  The system is messy but the architecture is sound.
  Dedicated refactoring sprints will get you further, faster.

8-15: Do not rewrite
  Too risky given business context, team capacity, or both.
  Focus on the highest-pain refactors only.

The Refactor Playbook

When the score says refactor, here's how to do it effectively:

The Strangler Fig Pattern

Named after the strangler fig tree that grows around
a host tree, eventually replacing it entirely.

Phase 1: Introduce an abstraction layer
  Old code → New interface → Old implementation
  (Nothing changes functionally, but now you have a seam)

Phase 2: Build new implementation behind the interface
  Old code → New interface → New implementation (for some cases)
                           → Old implementation (for rest)

Phase 3: Route traffic to new implementation gradually
  10% → 25% → 50% → 75% → 100%

Phase 4: Remove old implementation
  When 100% of traffic uses new code, delete the old code.

Timeline per module: 2-4 weeks
Risk: Low (old system is always available as fallback)

The Boy Scout Rule (Continuous Refactoring)

"Leave the code better than you found it"

Every PR that touches a file:
  ✓ Fix one thing that bothers you (rename, extract, simplify)
  ✓ Add a test if there isn't one
  ✓ Update documentation if it's wrong

What this looks like:
  Sprint 1:  Feature work + minor cleanup in touched files
  Sprint 3:  Touched files are noticeably cleaner
  Sprint 6:  Most-changed files are well-tested and readable
  Sprint 12: The "messy" codebase is significantly better

Cost: 10-15% overhead per sprint
Benefit: Never need a "refactoring sprint" (it's built in)

The Critical Path Refactor

Don't refactor everything. Refactor what hurts.

Step 1: Identify your "hot files"
  git log --format=format: --name-only --since="6 months ago" | \
    sort | uniq -c | sort -rn | head -20

  These 20 files are changed the most. They're where
  technical debt causes the most friction.

Step 2: Rank by pain
  For each hot file:
  - How long does a typical change take? ___
  - How often do changes cause bugs? ___
  - How many people avoid touching this file? ___

Step 3: Refactor the top 3-5 highest-pain files
  One file per sprint. Dedicated refactoring with full test coverage.

Step 4: Measure improvement
  Track: time per change, bug rate, developer satisfaction

The Rewrite Playbook

When the score says rewrite, here's how to not die:

Rule 1: Ship Incrementally, Not Big Bang

Bad: Build the entire new system, then switch.
Good: Ship the new system in vertical slices.

Slice 1: User authentication (new system)
  → Users log in via new system
  → Everything else still on old system

Slice 2: Product catalog (new system)
  → Product pages served by new system
  → Checkout still on old system

Slice 3: Checkout (new system)
  → Full purchase flow on new system
  → Admin still on old system

Each slice ships to production independently.
Each slice is validated with real traffic.
If a slice fails, only that slice rolls back.

Rule 2: Feature Freeze the Old System

During a rewrite, the #1 risk is "moving target":
  - New features added to old system while rewriting
  - New system is always chasing old system's features
  - You never reach parity because the target keeps moving

The rule:
  Old system: Bug fixes and critical security patches ONLY
  New system: All new feature development

This creates pain (customers want new features)
but it's the only way the rewrite finishes.

Rule 3: Set a Kill Date

"This rewrite will be complete by [date] or we stop."

If you're not at 80% parity by the kill date:
  → Stop the rewrite
  → Take what you've learned
  → Apply it as refactoring to the old system
  → Try again in 12 months if still needed

Kill dates prevent rewrites from becoming multi-year
boondoggles that drain the team while shipping nothing.

The Decision Meeting

Agenda (60 minutes):

1. Present the scoring framework (10 min)
   Everyone scores independently, then share

2. Discuss outlier scores (15 min)
   Where do people disagree? Why?

3. Identify what we know vs what we're guessing (10 min)
   Can we get data on the guesses?

4. Decide: Rewrite, Strangler Fig, or Refactor (15 min)
   Based on aggregate scores and discussion

5. Define the plan (10 min)
   Timeline, team allocation, kill date (if rewrite)

The One Rule

Whether you rewrite or refactor, the principle is the same: ship value to production continuously. A rewrite that ships nothing for 12 months is failing, regardless of how clean the code is. A refactor that improves developer experience every sprint is succeeding, even if the code isn't perfect.

The best engineering teams don't debate rewrite vs refactor. They ship improvements continuously — sometimes that's a refactor, sometimes it's replacing a module entirely, and very rarely it's a full rewrite. The decision framework helps you pick the right tool. The discipline of shipping continuously keeps you honest.

Next
The Rate Limiting Strategy That Saved Our Client's API
Insights
Why You Should Start With a MonolithEvent-Driven Architecture for the Rest of UsThe Real Cost of Microservices at Your ScaleThe Caching Strategy That Cut Our Client's AWS Bill by 60%API Design Mistakes That Will Haunt You for YearsMulti-Tenant Architecture: The Decisions You Can't UndoCI/CD Pipelines That Actually Make You FasterThe Rate Limiting Strategy That Saved Our Client's APIWhen to Rewrite vs Refactor: The Decision Framework

Ready to Ship?

Let's talk about your engineering challenges and how we can help.

Book a Call