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
Explain the Liskov Substitution Principle (LSP) and provide a concrete example where a subclass violates LSP (for example a Rectangle and Square example). Describe how you would detect such violations in a large codebase and how to refactor to respect LSP while preserving client expectations.
HardSystem Design
0 practiced
System design (hard): You own a critical payment processing component with strong ACID needs and strict uptime. The component has grown complex and needs major refactoring. Compare the risks and benefits of a big-bang rewrite versus a strangler migration for this component, and propose a safe plan you would execute including testing, traffic migration, and rollback strategy.
HardTechnical
0 practiced
Hard technical domain: You must migrate stored user data from an old encryption algorithm to a stronger one without downtime. There are 100 million records and many read/write patterns. Propose a migration approach that guarantees reads remain possible, allows rollbacks, maintains security, and minimizes performance impact. Include key rotation considerations and verification steps.
MediumTechnical
0 practiced
Technical coding (medium): Write a Python script or describe a reliable approach (pseudocode acceptable) to find duplicate function bodies across a repository of Python files. The tool should use AST-based normalization to reduce false positives caused by whitespace or variable renaming. Explain assumptions and how to scale to large repos.
MediumTechnical
0 practiced
You discover duplicated business logic implemented across three services that should behave identically. Evaluate the trade-offs between extracting a shared library, creating a central service for that logic, or keeping duplication with stricter sync processes. Recommend a pragmatic plan for reducing duplication with minimal risk.

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.