Legacy Modernization and Architecture Evolution Questions
Evolving an existing system rather than designing greenfield. Covers the modernization patterns (strangler fig, anti-corruption layers, facades and protocol adapters), choosing between rehosting, replatforming, incremental refactoring and a full rewrite, data migration and coexistence (dual-running, change-data-capture versus bulk cutover, reconciliation and drift), cutover readiness and decommissioning, recovering undocumented behavior from legacy code and stored procedures, instrumenting a migration so you can tell in real time whether it is working, and the organizational and risk management of long migrations across many teams. The scope is the migration itself: not quantifying or prioritizing technical debt, not code-level refactoring craft, not how to decompose a system into microservices, and not cloud migration or deployment and rollback mechanics as topics in their own right.
Compare rehosting, replatforming, incremental refactoring, and a full rewrite as ways to modernize an existing system. When does each one actually win, and what does 'winning' mean differently for each?
Sample Answer
Direct answer
Rehosting moves a system as-is onto new infrastructure and wins on speed when the goal is escaping unsupported hardware or a data center exit deadline. Replatforming makes small, targeted changes (a managed database instead of a self-hosted one) and wins when you want some operational benefit without touching application logic. Incremental refactoring decomposes and modernizes the system piece by piece and wins when the system needs to keep evolving and the team can invest in an ongoing effort. A full rewrite replaces the system outright and wins only when the existing system's structure is so far from what's needed that incremental change would cost more than starting over, and the business can tolerate the risk of an all-or-nothing delivery.
Structured elaboration
The real differentiator between these isn't just cost or time, it's what risk each one is willing to accept:
- Rehosting (lift-and-shift): lowest technical risk (nothing about the application changes), fastest to execute, but it changes nothing about the underlying problems (scaling limits, unmaintainable code, licensing costs tied to the old platform). It's a stopgap, not a fix, and it's the right first move when there's a hard deadline (end-of-life hardware, a data center closing) that leaves no time for anything deeper.
- Replatforming: moderate risk, moderate benefit. You get real operational wins (managed backups, autoscaling) without the risk of touching business logic, but you're still carrying whatever architectural debt the application has.
- Incremental refactoring: this is the strangler-fig territory, higher effort spread over a longer timeline, but continuously shippable and reversible at almost any point. It's the right choice when the system needs to keep serving traffic and evolving, and the org can sustain the discipline of an ongoing migration rather than a one-time project.
- Full rewrite: highest risk, because you're betting the whole effort on an estimate for a system whose exact current behavior nobody has fully mapped, the same problem that makes writing "characterization tests first" so important for any legacy work. It sometimes wins on relative cost and time if the existing system is small enough, or so entangled that incremental extraction genuinely doesn't have a viable seam.
Pairing the approach with a rollout strategy that matches its risk profile: rehosting and replatforming can usually go through a single cutover with a tested rollback plan, since the application behavior itself hasn't changed. Incremental refactoring needs the parallel-run and gradual-traffic-shift discipline strangler-fig migrations use. A full rewrite needs the most conservative rollout of all: extensive parallel-run validation against the old system before the new one is trusted with any real traffic, since there is no incremental fallback if a whole rewritten system turns out to be subtly wrong.
Worked example
A 15-year-old monolith running on infrastructure the vendor is discontinuing support for in six months:
- Rehost first: the deadline leaves no time for anything else, so the team moves it to modern infrastructure unchanged, buying time.
- Then decide the target: with the deadline pressure gone, they evaluate the system properly. It has clear, separable modules (billing, notifications, reporting), so incremental refactoring via strangler fig is viable, and they start extracting the highest-pain module (notifications, which changes often and causes frequent incidents) first, using canary rollout (releasing the change to a small slice of traffic first, so a problem shows up as an early warning instead of a full outage) and parallel-run validation to de-risk each extraction.
- They explicitly rule out a full rewrite: the modules are separable enough that strangling costs less in both time and risk than a rewrite would, given the amount of undocumented behavior a rewrite would have to somehow rediscover from scratch.
Trade-offs and pitfalls
The mistake that costs the most is picking based on which approach sounds most technically satisfying rather than which one matches the actual constraint (a hard deadline favors rehosting regardless of its long-term limitations; a system that genuinely cannot be decomposed favors a rewrite regardless of the risk). The second most common mistake is pairing a high-risk approach (a full rewrite) with a rollout strategy suited to a low-risk one (a single cutover), which is how a rewrite that was individually well-executed still causes an incident, because nobody validated it against real production behavior before trusting it fully.
Explain the strangler fig pattern for retiring a legacy system incrementally. What are the most common ways teams get it wrong in practice, and what signals tell you strangling is the right call versus a full rewrite?
Sample Answer
Direct answer
Strangler fig retires a legacy system by growing a new one around it: you put a routing layer (a proxy, gateway, or facade) in front of the legacy system, move one capability at a time behind that layer to a new implementation, and let the old and new code paths coexist until every capability has moved and the legacy system can be turned off. The name comes from the strangler fig vine, which grows around a host tree until the host is no longer needed. It is popular precisely because it avoids the two failure modes of a big-bang rewrite: shipping nothing for a year, and cutting over everything at once with no way back.
Structured elaboration
The mechanics, in order:
- Put a seam in front of the legacy system. Usually an API gateway, reverse proxy, or a facade inside the monolith itself, so callers do not know or care whether a request lands on old or new code.
- Pick the first capability to extract, usually the one that is both low-risk and high-pain (a module that changes often but is not the most business-critical, so mistakes are cheap to learn from).
- Build the new implementation and route a slice of traffic to it, verifying its output matches the old path before trusting it fully.
- Repeat, capability by capability, until nothing is left behind the seam pointing at the legacy system.
- Decommission the legacy code only once nothing routes to it and you have confirmed there are no hidden callers.
The most common ways teams get this wrong, in rough order of how often they show up:
- Never actually finishing. The easy 80% of capabilities get strangled in the first few months, and the hard 20% (the ones with the messiest coupling to legacy state) get deferred indefinitely. Two years later the org is paying to run and secure both systems forever, which is worse than either a rewrite or leaving the legacy system alone. This is the single most common failure and the reason a strangler effort needs a decommission target with a rough date attached, not just a start.
- Building a permanent adapter instead of a temporary one. The seam is meant to shrink as capabilities move; if it keeps growing new special cases instead, it has quietly become a second system to maintain, not a migration path.
- Not enforcing a hard boundary between the shared state. If the new service and the legacy system both write to the same tables without a clear ownership rule, you get silent data corruption long before anyone notices a functional bug.
- Treating the seam as free. Every hop through a translation layer costs latency and adds a new thing that can fail; teams who never measure this get surprised when the "temporary" adapter becomes the slowest part of the system.
Strangling is usually the right call when the system has to keep serving traffic throughout the change (most production systems), when you can identify genuinely separable capabilities, and when the org can tolerate running two systems for a while. A full rewrite becomes more attractive when the legacy system's capabilities are too entangled to peel apart one at a time, when the business can tolerate a real code freeze, or when the legacy code is so far from correct that incrementally wrapping it just preserves its bugs behind a nicer API.
Worked example
Say a monolith handles catalog, cart, checkout, and recommendations for an e-commerce site. A team decides to strangle it:
- They put an API gateway in front of all four capabilities.
- They pick recommendations first: it changes often, has no write path into the order/payment data, and a bug there degrades the experience rather than losing money.
- They build a new recommendations service, route 5% of traffic to it behind a flag, compare its output to the legacy path for a few weeks, then ramp to 100% and delete the legacy recommendations code.
- They repeat for catalog, then cart, and leave checkout, the most state-heavy and highest-risk capability, for last, once the team has practiced the pattern three times on lower-stakes capabilities.
- Eighteen months in, nothing routes to the legacy monolith and it is decommissioned.
The order matters: doing checkout first, before the team has proven the pattern on anything, is exactly the kind of decision that produces the abandoned-halfway failure mode above.
Trade-offs and pitfalls
Strangling trades speed for safety: you ship value continuously and can stop or reverse at almost any point, but you pay for it in the ongoing cost of running two systems and maintaining the seam between them, and in the discipline required to actually finish rather than stall. A full rewrite is the opposite bet: faster in principle if nothing goes wrong, but an all-or-nothing wager on a fixed-price estimate for a system whose exact behavior nobody has fully mapped, which is exactly the situation legacy modernization starts from. The senior mistake to watch for is choosing strangling for the safety story and then never applying the same rigor to actually retiring the legacy code, which converts a migration strategy into permanent architectural debt.
Design a decommissioning plan for shutting down a legacy system after its replacement has taken over. What has to be true before you actually delete anything?
Sample Answer
Direct answer
Before you delete anything, you need proof the migration actually succeeded (not just that the new system is live), a defined retention and archival plan for whatever legal or audit obligations outlive the system itself, a rollback path in case something surfaces after decommission that the pre-cutover testing missed, and a communication plan that reaches every stakeholder who might still depend on the old system, including the ones you do not already know about.
Structured elaboration
A decommissioning plan has four parts, and skipping any of them is how "the migration is done" turns into "we deleted data we needed":
- Verification that the migration is actually complete. Not "the new system works," but "nothing depends on the old one anymore." This means auditing traffic and access logs on the legacy system for weeks after the cutover, not just at the moment of cutover, because low-frequency dependencies (a monthly batch job, a quarterly report) will not show up in a one-week traffic sample.
- Legal and audit retention requirements. Many systems have data that has to remain queryable for years after the system itself is gone, for regulatory or contractual reasons. That means an archival strategy decided before decommission, not scrambled together after someone asks for five-year-old records the week after you deleted the database.
- A rollback plan for the decommission itself, distinct from the rollback plan for the original migration. If something surfaces after you have shut the legacy system down (a caller nobody knew about, a data discrepancy only visible under a rare condition), you need a defined path back, even if that path is "restore from the last verified backup and re-enable the legacy code path for a bounded window," not "we have no idea, we deleted it."
- Third-party integrations and stakeholder communication. External partners often integrate with systems in ways your internal traffic logs cannot see (a partner polling an API you exposed to them specifically). The communication plan needs to reach them with enough lead time to migrate on their side, not just notify internal teams.
Worked example
A team decommissioning a legacy order-management system after a successful migration:
- They keep the legacy system read-only (not deleted) for 90 days post-cutover, monitoring access logs the whole time. In week six, they find a quarterly compliance report job still reading directly from the legacy database, which nobody had flagged as a dependency because it only runs four times a year.
- They export the full historical dataset to a queryable archive with a retention period matching the company's seven-year audit requirement, and verify a sample of archived records against the live system before the live system goes away, since an archive nobody has tested is not actually a safety net.
- They notify the three external partners who integrate with the legacy system's API directly, giving them 60 days' notice and a migration guide, rather than assuming internal migration alone covers everyone with a dependency.
- Only after all of this, and after a final confirmed zero-traffic week on the legacy system, do they actually shut it down, with the archived data and a documented restore procedure kept in case something surfaces later.
Trade-offs and pitfalls
The tempting shortcut is to declare victory the moment the new system handles 100% of live traffic and decommission immediately, but "no traffic this week" is not the same as "no dependencies," and the cost of being wrong (deleted data you needed, a partner integration silently broken) is far higher than the cost of a monitored grace period before deletion. The other common mistake is treating archival as a technical afterthought rather than a compliance requirement with its own sign-off, which is how companies end up unable to produce records a regulator or auditor asks for.
After twelve months and real engineering investment, you conclude a major platform rewrite has to be abandoned. Walk through how you'd handle the decision itself: what you tell engineering, customers, and executives, and what happens to the system the rewrite was supposed to replace.
Sample Answer
Direct answer
The real question when abandoning a major rewrite after significant investment isn't just how to communicate it, it's how to convert a sunk-cost decision into a credible plan that stabilizes what exists, protects the team's credibility, and gets real value out of whatever was learned and built, rather than the abandonment reading as pure loss.
Structured elaboration
- Be honest and specific about why, without relitigating the original decision endlessly. Stakeholders (engineering, customers, executives) need to understand what changed or what was learned that makes continuing not worth it, stated plainly, not buried in caveats that make it sound like the team is unsure whether this was the right call. The depth and framing differ by audience: engineering gets the full technical root cause in detail, since they need it to avoid repeating the same failure mode and to trust the assessment is honest rather than face-saving; executives get the same root cause summarized against business impact and the go-forward ask; customers get only what's changing for them and by when, without the internal post-mortem detail that isn't theirs to carry.
- Stabilize the existing system first, as an explicit, separate work stream. The system the rewrite was meant to replace still needs to keep running, and often has been getting less investment while the rewrite was underway; a stabilization plan for the current system needs its own resourcing and timeline, not an assumption that it'll be fine because it's been fine so far.
- Re-allocate resources deliberately, not just disperse the team. Decide explicitly what the freed-up engineering capacity goes toward: incremental improvement of the existing system (the strangler-fig alternative, keep the old system running and move one capability at a time behind a routing layer instead of a single big-bang cutover, that might have been the better initial call), a different priority entirely, or a narrower, better-scoped follow-up effort that learned from what went wrong the first time.
- Salvage what's genuinely reusable from the abandoned work. A rewrite that's cancelled rarely produced zero value: some components, some newly-gained team expertise, or some architectural insight is usually worth carrying forward, and naming that explicitly helps the narrative be "we're redirecting effort" rather than "we wasted a year."
- Define KPIs and timelines that support the decision and minimize disruption, so stakeholders see a credible go-forward plan (what stabilizes by when, what capacity is available for what) rather than open-ended uncertainty following an admission of failure.
Worked example
A team recommending abandoning a 12-month internal platform rewrite:
- Communication: leadership is told directly that the rewrite's scope grew to underestimate the complexity of a specific legacy subsystem that turned out to encode far more undocumented business logic than the original estimate accounted for, the same class of risk that makes rewrites harder to estimate than incremental work, and that continuing under the current approach would extend the timeline past what the business can absorb. Customers relying on features the rewrite was meant to eventually deliver are told what's changing about the roadmap, in plain terms, with a revised realistic timeline for anything they were expecting. The engineering team that built the rewrite gets that same root cause in full technical depth, including exactly which assumptions about the legacy subsystem turned out wrong, is told explicitly this is being treated as a scoping and estimation failure rather than a reflection on individual or team performance, and is given clarity up front on where they're being reassigned so the news isn't followed by weeks of uncertainty about what happens to them.
- Stabilization: the existing platform, which had been getting minimal maintenance investment during the rewrite effort, gets a dedicated two-engineer stabilization track for the next quarter, addressing the highest-risk known issues that accumulated during the period of reduced investment.
- Re-allocation: rather than a full second rewrite attempt, the team pivots to an incremental, strangler-fig-style approach targeting the same underlying problems the rewrite was meant to solve, using the domain understanding gained during the rewrite attempt (which is real and valuable, even though the code itself is being set aside) to inform which capability to extract first.
- KPIs and timeline: the revised plan commits to a specific, smaller first milestone (one capability incrementally modernized) within two months, giving stakeholders a concrete, near-term proof point that the new approach is actually delivering, rather than another open-ended multi-quarter commitment right after the previous one failed to land.
Trade-offs and pitfalls
The trade-off is the short-term cost to team and organizational credibility of admitting a major effort didn't work out against the much larger cost of continuing to sink resources into an approach that's already shown it isn't working; the earlier this decision is made once the evidence is clear, the smaller that cost is. The pitfall is under-investing in the stabilization work stream because attention naturally gravitates to "what's next" rather than "what got neglected while we were focused on the now-cancelled effort," leaving the existing system in worse shape than before the rewrite was even attempted.
How does Conway's Law show up when you're migrating a system and deciding how to carve it up? When does aligning the new architecture to existing team boundaries help, and when does it lock in a bad design?
Sample Answer
Direct answer
Conway's Law says a system's architecture ends up mirroring the communication structure of the organization that builds it, and during a migration that cuts both ways: aligning new service boundaries to existing team boundaries accelerates the migration because ownership and decision-making stay clear, but it locks in whatever boundaries the org happens to have today, which may not be the technically sound ones if the org structure itself grew for historical or political reasons rather than around the actual domain.
Structured elaboration
When alignment helps: if a team already owns a coherent piece of business capability and communicates efficiently internally, extracting a service along that exact boundary means the people best positioned to understand its behavior are the ones building and owning it, decisions can be made quickly without cross-team negotiation, and the resulting service boundary has a natural, sustainable owner from day one. This is usually the fastest path during an active migration, because you're not fighting the org's existing communication patterns.
When it creates suboptimal boundaries: if the org structure predates the domain understanding you have now (teams split by historical accident, by who was hired first, or by a previous reorg that no longer reflects how the business actually works), forcing the new architecture to match that structure bakes a bad boundary into the system for the sake of migration speed. A classic version: a team owns "everything related to orders" because that's how the org chart happened to be drawn years ago, even though order creation and order fulfillment are genuinely separate domains with different scaling and consistency needs, and splitting them would produce a better architecture at the cost of also having to split (or renegotiate) team ownership.
Governance and organizational techniques to balance this:
- Decide the target service boundaries from the domain first, independent of current team structure, then explicitly evaluate the gap between that target and the org's current shape, rather than letting the current org shape silently define the target.
- Where the gap is small, align and move fast. Where it's large, make a deliberate call: either accept a suboptimal near-term boundary to keep the migration moving and plan to fix it later (a real cost, since re-splitting a service after the fact is its own migration), or invest in the reorg alongside the technical migration, accepting it will be slower.
- Use a cross-functional architecture review (not owned by any single team) to catch the case where a proposed service boundary looks convenient for the current org chart but doesn't hold up as a coherent domain boundary, before it's built and becomes expensive to undo.
Worked example
A team migrating an e-commerce monolith discovers that "the orders team" currently owns order creation, payment processing, and fulfillment tracking, three domains that grew together historically because one early engineer built all of it. Aligning the new service boundaries to this existing team would mean one large "orders service" doing all three, fast to build because ownership is unambiguous, but it recreates a version of the same coupling problem the migration was meant to solve, since payment processing has very different compliance and scaling needs than fulfillment tracking.
The team instead decides the domain-correct boundary is three separate services, and explicitly plans the organizational change alongside the technical one: the orders team splits into two teams (payments, and order-and-fulfillment) over the following two quarters, with the split sequenced to match which service gets extracted first, so a team never owns a service that doesn't exist yet, and the migration and the reorg reinforce each other rather than one blocking the other.
Trade-offs and pitfalls
The trade-off is migration speed against long-term architectural soundness: aligning to the current org is almost always faster in the near term, and for many boundaries that's a perfectly reasonable trade to make deliberately. The pitfall is making that trade unconsciously, letting the org chart silently define the architecture without ever asking whether it's actually the right domain boundary, which is exactly how Conway's Law produces an architecture nobody consciously designed.
Unlock Full Question Bank
Get access to all 16 Legacy Modernization and Architecture Evolution interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.