Skip to content
tezvyn:
Menu

Explain the Strangler Fig pattern

Source: interviewMediumHow cards are made

Summary

incremental modernization strategy.

Key points

a facade routes traffic, new services gradually replace legacy features one slice at a time, and the old system is retired when fully strangled.

WHAT THIS TESTS This checks whether you favor incremental, low-risk modernization and understand the routing and data-coexistence mechanics that make it work.

A GOOD ANSWER COVERS The pattern, named after the strangler fig vine, replaces a legacy system gradually. You insert a facade, proxy, or gateway that intercepts incoming requests. Initially everything routes to the monolith. You then build new services that implement specific features and update the facade to route just those requests to the new implementation, while the rest still hit the legacy code. Repeat feature by feature until nothing routes to the old system, then decommission it. It suits large, risky legacy systems where a big-bang rewrite would be unacceptable and the business needs continuous operation. Prerequisites: a clean interception point to route by URL or function, features that can be cleanly bounded, and a strategy for the two systems to share or synchronize data during coexistence.

COMMON WRONG ANSWERS Describing a one-shot rewrite and cutover. Omitting the routing facade entirely. Ignoring data: both systems often need the same data, so you must address shared databases or synchronization. Assuming features are trivially separable.

LIKELY FOLLOW-UPS How do you split a shared database? How long can coexistence last? How do you route, by URL or by event? How do you roll back a migrated feature?

ONE CONCRETE EXAMPLE A monolithic e-commerce app sits behind an API gateway. The team builds a new checkout microservice and configures the gateway to send /checkout requests to it while /catalog and /account still go to the monolith. Both read the same orders database initially. Over months they migrate more endpoints until the monolith handles nothing and is shut off.

Interview question

What is the role of the facade or proxy in the Strangler Fig pattern?

  • a.It rewrites the entire legacy codebase automatically
  • b.It prevents any changes to the legacy system
  • c.It stores all application data during the migration
  • d.It intercepts requests and routes each to either the legacy system or its new replacementCorrect
Why?

The facade is the interception point that gradually shifts traffic from old to new as features are replaced. It does not rewrite code, act as the data store, or freeze the legacy system.

Just read this? Test yourself on what you have been reading.

Read the original → learn.microsoft.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles