Strangler fig
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Migrating a legacy system: strangler fig and anti-corruption layer: the 60-second story

    Strangler fig

    A junction station needs rebuilding. It can’t close for two years.

    So the railway opens one new platform and moves one route at a time. Your legacy system is that station.

    540

    changes a three-year rewrite must chase

    If legacy ships 15 changes a month (illustrative), a 36-month rewrite must absorb 15 × 36 = 540, or freeze the business. Then it all rides on one cutover weekend.

    One façade, one route at a time

    First release: 100% to legacy, just a new hop. Then move one capability’s route to new code, behind a flag that flips back in seconds.

    Legacy says WL/017. Your new code should never see it.

    An anti-corruption layer translates at the border, both ways, in one place. Unknown codes fail loudly there, not as silent guesses elsewhere.

    Refunds are mid-move. Who writes?

    Bad: Both accept writes

    Legacy cancels, new approves; the last sync silently wins.

    Good: One writer at a time

    Legacy owns, CDC copies. At the flip, new owns; a back-sync copies back.

    Legacy behaviour was never written down. How do you prove the new path matches?

    Parallel run

    Run both on sampled real traffic. Users get legacy’s answer; mismatches get logged. Some are legacy bugs.

    What do you carve first?

    1. Read-only first: a wrong search costs a retry
    2. Busy but low-stakes: search, 70% of requests
    3. A thin slice through façade, ACL and sync
    4. Core last: seat allocation or the ledger

    90% of traffic is on new. The mainframe bill hasn’t moved.

    Measure progress in deletion: legacy code, tables and jobs gone. Stop at 70% and you run two systems, two on-calls, two bills, indefinitely.

    The interview line

    Strangle, don’t rewrite: a façade moves one capability at a time, an ACL translates, and every step stays reversible.