InterviewStack.io LogoInterviewStack.io

Maintainability and Legacy Code Questions

Covers strategies and principles for evolving codebases safely and keeping them easy to understand and change over time. Topics include design principles such as Single Responsibility, Open Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, removing duplication, establishing appropriate abstraction boundaries, separation of concerns, identifying and remediating code smells, incremental refactoring approaches, regression risk mitigation via tests and feature toggles, backward compatibility and migration strategies, and prioritizing technical debt reduction. Interviewers assess the candidate ability to plan pragmatic refactors, minimize risk during change, and improve long term health of a codebase.

HardTechnical
0 practiced
Design a consumer-driven contract testing strategy for a large organization where teams use multiple languages. Explain contract storage, provider verification workflows, CI/CD integration, contract versioning, and strategies to handle flaky or network-dependent contracts.
MediumSystem Design
0 practiced
Design a CI/CD pipeline specifically tailored to support incremental refactors. Include steps for characterization tests, contract tests, linters, security scans, canary release, feature-flag gating, metrics validation, and automated rollback criteria.
HardTechnical
0 practiced
A hot-path Java method in a high-throughput service allocates many short-lived objects causing GC pressure. Refactor or propose optimizations for the following code to reduce allocations and explain how you'd measure the improvement.
java
public String formatUser(User u) {
    StringBuilder sb = new StringBuilder();
    sb.append("Name:").append(u.getName()).append(";");
    sb.append("Age:").append(u.getAge()).append(";");
    sb.append("City:").append(u.getCity()).append(";");
    return sb.toString();
}
Discuss trade-offs between micro-optimizations and maintainability.
MediumTechnical
0 practiced
How would you estimate effort and risk to refactor a complex module of ~5000 lines with many callers? List concrete metrics you'd gather (e.g., cyclomatic complexity, coupling, callers), the process to build an estimate, and how you'd express uncertainty to stakeholders.
MediumTechnical
0 practiced
You're supporting sales and engineering: a refactor will delay a feature requested by a top customer. How do you structure the conversation with product and sales, what trade-offs do you propose (quick patch + backlog refactor, phased delivery with toggles, or postpone refactor), and how do you document the risk and acceptance criteria for the chosen approach?

Unlock Full Question Bank

Get access to hundreds of Maintainability and Legacy Code interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.