DEV Community

Cover image for Back to Code | Ep 11: The Legacy Code Mine — Strangler Fig Pattern
Mehmet TURAÇ
Mehmet TURAÇ

Posted on

Back to Code | Ep 11: The Legacy Code Mine — Strangler Fig Pattern

The 15-week technical battle of LogiFlow — a company waking up from the illusion created by artificial intelligence and returning to real engineering.

The Story

It was impossible to delete the massive "Routing Monolith" AI had written — the business would stop. Big rewrite projects are suicide. Migration must be incremental.

Kerem had suggested it first: "Let's just rewrite the whole thing from scratch. We know what the system should do now. Give me 3 months." Defne's response was immediate and firm.

"The last words of every failed software project are: 'Let's just rewrite it from scratch.' We're not rewriting. We're strangling."

Technical Autopsy: The Strangler Fig Pattern

Like a strangler fig tree that wraps around an old tree and eventually takes its place, the new system would grow around the old one.

// API Gateway configuration
const routes = {
  // Old AI monolith (gradually decreasing)
  '/api/v1/routes': 'legacy-monolith',

  // Traffic shifting to new Hexagonal service
  '/api/v2/routes': 'new-hexagonal-service',

  // Canary release with feature flag
  '/api/routes': featureFlag('new-routing')
    ? 'new-hexagonal-service'
    : 'legacy-monolith'
};
Enter fullscreen mode Exit fullscreen mode

The plan was surgical:

  • Week 1-4: New service handles 5% of traffic. Monitor error rates.
  • Week 5-8: Increase to 25%. Compare latency with legacy.
  • Week 9-12: 50/50 split. Run shadow comparison tests.
  • Week 13-16: 90% new, 10% legacy (safety net).
  • Week 17-20: 100% new. Legacy decommissioned.

Each week, 5% of traffic was shifted. Error rates were monitored. After 20 weeks, the monolith was quietly buried. The business never stopped.

Why Big Rewrites Fail

Big Rewrite Strangler Fig
Business stops for months Business runs continuously
"All or nothing" risk Incremental, reversible risk
Scope creep guaranteed Scope controlled by traffic %
No production feedback Continuous production feedback
Team morale collapses Team sees progress weekly

Lessons from Episode 11

1. Big Rewrite = Suicide: Rewriting years of code all at once is a disaster.

2. Strangler Fig: Wrap around the old system and incrementally migrate to the new architecture.

3. Canary Release: Manage risk by routing a small percentage of traffic to the new service.


This is Episode 11 of the "Back to Code" series. Next up: Episode 12 — Observability: From Log Spaghetti to Traces.

Series: back.to.code · 2026

Top comments (0)