The 'joined a legacy codebase' story: learning an unfamiliar system fast, mapping risk and pain with data (change frequency, incidents, build time), characterisation tests, strangler-fig and boy-scout improvements alongside features, and proving the result with numbers.
I treat a legacy codebase as a working system that earns money, not a mess to replace. First I learn before changing: run it locally, read the incident history and ship a small fix in the first week or two. Then I find the hotspots with data: files that change often and are complex, plus the ones behind incidents and slow builds.
I put characterisation tests around a hotspot before refactoring it, and improve it alongside feature work (boy-scout rule, strangler fig) inside a budget agreed with the product owner. I show the result with numbers: lead time, change failure rate, incidents, build time. The trade-off: small steady steps are slower to look impressive than a rewrite, but they never stop delivery and they rarely fail.
"When I joined [company], the core system was [a 12-year-old ASP.NET MVC 5 / WebForms application, around 400k lines, on .NET Framework 4.8]. Releases took [a full day with a manual checklist], and [roughly one in four] caused a hotfix. Nobody wanted to touch [the pricing module].
For the first [three weeks] I didn't change anything structural. I got it running locally, which alone took [two days] and turned into a setup script, read [six months] of incident reports, and fixed [two small bugs] so I'd been through the whole release path. Then I pulled git history to find files that changed most often and were also the most complex. [Three files in pricing] were in the top ten on both lists and behind [40%] of incidents. That data made the conversation with [the product owner] easy: I asked for [about 15%] of each sprint and promised every change would ride along with feature work.
Before touching pricing I wrote [around 60] characterisation tests that pinned its current behaviour, including two bugs customers relied on. Then I extracted it behind an interface, one rule at a time, while the team kept shipping. After [six months], [release time went from a day to under an hour], [hotfixes dropped from about one in four releases to one in fifteen], and pricing changes went from [the most feared ticket] to routine. The lesson I took: in legacy code, earning trust with small safe wins comes before any big idea."
| Phase | What I do | Output |
|---|---|---|
| Weeks 1–2: learn | Run it locally, read incidents and ADRs, pair with the longest-serving dev, ship a small fix | Setup script, a map of the system, trust |
| Weeks 3–4: measure | Churn × complexity hotspots, incident tags, build/deploy time, test coverage of hotspots | A ranked list with evidence |
| Month 2: agree | Show the data to the product owner and lead; agree a budget and 2–3 goals | A visible plan with targets |
| Month 2–3+: improve | Characterisation tests, extract and replace in small steps, automate the release | Measurable change each sprint |
| Signal | Tool | Why it matters |
|---|---|---|
| Change frequency (churn) | git log --format=format: --name-only counts, CodeScene |
Debt you never touch costs nothing |
| Complexity | Visual Studio code metrics, NDepend, cyclomatic complexity | Hard to change safely |
| Incidents per component | Incident tracker tags, Application Insights failures | Direct customer cost |
| Build/test/deploy time | Pipeline history | Taxes every change |
Code that is ugly but stable and rarely changed stays as it is. A rewrite is only worth considering when the platform itself is end-of-life or blocks the business, and even then it is done as a strangler fig, not a big bang.
"Over [six months]: release time [1 day → 45 minutes], hotfix rate [~25% → ~7%] of releases, pricing incidents [from about 4 a month to fewer than 1], with feature delivery [unchanged or up] on the team's burn-up."
Checks whether the candidate can get productive in an unfamiliar system, choose improvements by evidence, change it safely while delivery continues, and prove the result.
Green flags
Red flags
pick hotspot ──► pin behaviour ──► small refactor ──► release ──► measure
▲ (characterisation (one seam, (normal │
│ tests, approval one rule) pipeline) │
│ tests) │
└────────────────────────────────────────────────────────────────────┘
Michael Feathers' definition is useful in the answer: legacy code is code without tests. The technique is to find a seam (a place where you can change behaviour without editing the code there, such as an interface or virtual method), get the code under test, then change it.
| Pattern | Use it when |
|---|---|
| Characterisation (golden master) tests | You don't know the correct behaviour, only the current one |
| Strangler fig | Replacing a module or the whole app piece by piece behind a facade or YARP proxy |
| Branch by abstraction | Swapping an implementation inside the codebase while trunk stays releasable |
| Boy-scout rule | Small tidy-ups in files you're already changing for a feature |
| Feature flags | Releasing the new path to a fraction of traffic first |
Spend about 15% on the situation, 60–70% on your actions, and finish with a result that has a number and a lesson.
| Score | What it sounds like |
|---|---|
| Weak | "The code was terrible so we rewrote it" or a list of patterns with no result |
| OK | Sensible actions, but "we", no data on why those areas, vague result |
| Strong | Learned first, chose by evidence, made change safe, kept delivery going, numbers before and after, a lesson |
The same story answers: "How do you handle technical debt?", "Tell me about getting buy-in", "How do you onboard to a new team?" and "Tell me about improving a system". Change the emphasis, not the facts: for buy-in, lead with the data and the product owner conversation; for onboarding, lead with the first two weeks.
git log --since="12 months ago" --format=format: --name-only | sort | uniq -c | sort -rn | head -20.[placeholder], then fill in the ones you can prove.Fill-in answer template (not code):
S Joined [company] / [team]; system: [age, size, stack]; pain: [release time, hotfix rate, feared module].
T [My role]: get productive fast and make [the system] safer and faster to change, without stopping features.
A Weeks 1–2: ran it locally ([setup script]), read [N months] of incidents, shipped [small fix].
Measured: churn × complexity + incidents → [top hotspots] behind [X%] of incidents.
Agreed [~15%] of each sprint with [PO], tied to feature work.
[N] characterisation tests on [hotspot]; extracted it in small steps; automated [release step].
R After [period]: [release time A → B], [hotfix rate A → B], [incidents A → B]; features [kept pace].
Lesson: [earn trust with small safe wins before big ideas].
Illustrative only (not a real history):
Joined a team with a 10-year-old MVC 5 app; pricing caused most incidents.
Hotspot analysis + 60 characterisation tests, then extracted pricing rule by rule over 6 months.
Hotfixes fell from ~1 in 4 releases to ~1 in 15; releases from a day to under an hour.
What makes this sound senior is judgement about where not to spend effort, and influence: you turned a vague feeling ("the code is bad") into evidence a product owner could act on, got a budget, and delivered results without stopping features. Mention what you deliberately left alone, and how you made the improvement stick (tests in the pipeline, an ADR, the team owning the hotspot list), so it doesn't depend on you.
A senior also looks at risk the business can't see. Legacy systems often run on out-of-support components (.NET Framework versions before 4.6.2, old NuGet packages with known CVEs, Windows Server versions past end of support), keep secrets in web.config, and deploy by hand. Running dotnet list package --vulnerable (or a Dependabot / Defender for DevOps scan), moving secrets to Azure Key Vault, and getting the release into an Azure DevOps or GitHub Actions pipeline with tests as a gate are often the highest-value first steps, and they map directly to the ACSC Essential Eight (patch applications, restrict admin privileges) and to APP 11 security obligations if personal data is involved. The modernisation path to .NET 10 (the .NET Upgrade Assistant, or a YARP-based strangler fig with System.Web adapters) comes after that, once the code is under test.
Measure with the four DORA metrics where you can (lead time for changes, deployment frequency, change failure rate, time to restore) plus a local one such as incidents for the hotspot. Numbers you can explain beat impressive numbers you can't.
| Approach | When it fits | Cost | When not to |
|---|---|---|---|
| Boy-scout tidy-ups with features | Debt spread across actively changed code | Low, continuous | Hotspot too risky to touch without tests |
| Dedicated budget (10–20% per sprint) | Clear hotspots with evidence | Visible capacity trade-off | No measurable target to report against |
| Pipeline and security first | Manual releases, vulnerable or unsupported dependencies | Days to weeks | Already automated and patched |
| Strangler fig to .NET 10 | Module or platform blocks the business | Months; two paths run side by side | Code is stable and rarely changed |
| Full rewrite | Almost never; platform truly end-of-life and small enough | Very high risk | Almost always |
Good enough means the tests would notice if your change broke something. Check three things. Coverage of the change area (not the codebase): every branch you'll touch is executed, including the input grid of any golden master, the set of input combinations whose outputs you snapshot, which should include boundary values. Sensitivity: run Stryker.NET on the changed files only (--since) and explain or kill surviving mutants, or break a line by hand and confirm a test fails. Reliability and speed: run the new tests repeatedly to prove they are deterministic, and keep them fast enough to run in the PR pipeline on every commit, because a safety net that is flaky or only runs nightly won't protect the change.
Technical debt is the future cost of a shortcut, and the interest is the extra effort or risk it adds every time we work near it. I make it visible in a debt register with each item's impact, how often we pay its interest (change frequency, incidents, delays) and a rough cost to fix. I prioritise by interest, not by how ugly the code is: debt in a hotspot that slows every feature beats a messy module nobody touches. I get time by explaining it in business terms (lead time, incident risk, cost), by reserving a steady share of capacity, and by pairing debt fixes with features that touch the same area.
I'd use a strangler approach, not a rewrite. First, characterisation tests around the code I'll touch first. Then a single composition root (the Generic Host in modern .NET, or ServiceCollection built in the old entry point) and a bridge: the legacy ServiceLocator.Get<T>() delegates to the real IServiceProvider, so old and new code share the same instances.
From there I convert from the edges inwards: new code and any class I touch takes constructor dependencies; statics get thin adapters behind interfaces. I track locator call count as a metric and block new usages with an analyser.
The trade-off: for months the codebase is half old, half new, which is uglier than a rewrite plan but keeps shipping.
How to tell it (STAR)
**S:** When I joined [company], the core system was [a 10-year-old MVC app]; releases took [a day] and [one in four] needed a hotfix, mostly from [pricing]. **T:** As [senior engineer] I wanted to make it safe to change without stopping feature work. **A:** I spent [three weeks] learning: I scripted the local setup, read [six months] of incidents and shipped two small fixes. Then I crossed git churn with complexity and incidents, and showed [the product owner] that [three pricing files] caused [40%] of incidents. We agreed [15%] of each sprint. I wrote [60] characterisation tests, then extracted pricing rule by rule alongside features. **R:** After [six months], hotfixes fell from [one in four releases to one in fifteen] and releases from [a day to under an hour], with features still on plan. I learned to earn trust with small safe wins first.
Last updated 23 Nov 2026.