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.

MediumTechnical
89 practiced
Technical coding (medium): Implement an LRU cache in Python with O(1) get and put operations and an interface `get(key)` and `put(key, value)`. The cache should support a maximum capacity and evict the least recently used item when full. Provide code and explain how it helps performance in front of a slow legacy function.
HardTechnical
61 practiced
Leadership (hard): A product deadline is approaching and your team needs time to refactor a fragile subsystem that frequently causes incidents. How do you negotiate with stakeholders for additional time or phasing so you can safely refactor, and how do you quantify the value of the delay versus shipping more features now?
MediumTechnical
88 practiced
Leadership: A product manager is pushing to add features while the engineering team wants to pay down technical debt. Describe a prioritization framework you would present to balance customer value and long-term maintainability. Include metrics you would use, how to present trade-offs, and how to get buy-in from stakeholders.
MediumTechnical
83 practiced
Medium technical coding: Design a backward-compatible wrapper API in either Java or Python that preserves the old method signature `process(data)` while delegating to a new signature `process(data, options)` and emitting a deprecation warning the first time a caller uses the old API per process. Provide code and explain how you ensure thread-safety of the deprecation warning emission.
EasyTechnical
84 practiced
You encounter a public function with 8 parameters used across the codebase: `processOrder(int id, String email, double discount, boolean priority, Date shipDate, Address bill, Address ship, String promo)`. Propose at least two refactorings to improve readability and maintainability, describe how to introduce them incrementally, and mention tests or safeguards you'd add before changing call sites.

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.