InterviewStack.io LogoInterviewStack.io

Clean Code, Refactoring, and Maintainability Questions

Writing code that other people can read, change, and keep alive over time: naming, function and module decomposition, avoiding duplication, readability, disciplined use of language idioms and design patterns, and recognizing code smells, extending into working effectively in large, aging, or unfamiliar codebases through safe incremental change, refactoring under test coverage, and managing technical debt. Covers both authoring professional-grade code beyond mere correctness and improving code you cannot rewrite without breaking it. Spans the coding-round quality signal and the seniority signal of leaving a codebase healthier than you found it.

HardTechnical
38 practiced

Find and fix the memory leak in a React hook example (or a component that attaches an event listener/subscription and never cleans it up). Explain why the leak happens and how you'd detect it in production before a user reports it.

HardSystem Design
52 practiced

Design a progressive-enhancement strategy for a public-facing app that must function with JavaScript disabled or on a poor connection. Specify which features must work purely server side, how you would structure server-rendered markup and forms, how you would progressively enhance with client-side JavaScript (for example partial hydration or islands), the SEO implications, and the tests you would add to verify graceful degradation.

MediumTechnical
31 practiced

Write a TypeScript function parseUserResponse(response: any): User that validates an external API payload and returns a typed User. It must validate the required fields id: number, name: string, and email: string, normalize email to lowercase, and throw a typed InvalidResponseError with details when validation fails. Include the User and InvalidResponseError type definitions and a brief rationale for your approach.

HardTechnical
30 practiced

Plan a migration of a large React codebase from class components to functional components with hooks. What would you automate (codemods) versus convert by hand, and how do you sequence it so the app stays shippable throughout?

HardTechnical
38 practiced

An API your frontend relies on changed its response shape unexpectedly. Describe strategies to handle API contract mismatches robustly on the frontend: runtime schema validation (for example with zod or io-ts), defensive parsing, feature detection and fallbacks, graceful-degradation UIs, and observability to surface the mismatch. Discuss the trade-offs between runtime guards and strict compile-time types, and how you would coordinate the fix with the backend team.

Unlock Full Question Bank

Get access to all 23 Clean Code, Refactoring, and Maintainability interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.