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
Leadership (hard): You are responsible for a cross-team initiative to reduce technical debt over 12 months. Draft a high-level roadmap that includes goals, quarterly milestones, staffing needs, how to allocate engineering capacity, metrics to track progress, communication plan with stakeholders, and how to handle emergency feature requests that conflict with the plan.
EasyTechnical
0 practiced
You inherit a small legacy Python module where three functions repeat the same input validation and logging steps before performing different actions. Example (inline): `def create_user(data): if not data.get('email'): raise ValueError; log('create', data); ...` and similar code exists in update_user and delete_user. Refactor the example to remove duplication, improve clarity and testability, and explain why your changes improve maintainability. Provide the refactored Python code and brief rationale.
HardTechnical
0 practiced
Hard technical coding: A recursive tree traversal in Java currently causes stack overflow for deeply unbalanced trees. Given a method `long sum(TreeNode root) { if (root == null) return 0; return root.val + sum(root.left) + sum(root.right); }`, rewrite this to an iterative approach that avoids recursion and explain performance and memory trade-offs.
EasyBehavioral
0 practiced
Behavioral: Tell me about a time you inherited a messy codebase and improved its maintainability. Use the STAR framework: describe the Situation, the Task you set, the Actions you took (technical and non-technical), and the Results including measurable outcomes and lessons learned.
MediumTechnical
0 practiced
Scenario: Your team wants to extract parts of a tightly-coupled monolith into separate services over the next 12 months. Describe an incremental migration plan using the strangler fig pattern, including how you would identify service boundaries, keep data consistent, test changes, and limit operational risk during gradual extraction.

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.