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.

EasyTechnical
33 practiced

Explain the Single Responsibility Principle. What does 'responsibility' mean precisely (a reason to change, not merely 'does one thing'), and how do you recognize an SRP violation in a class or module you're reading for the first time?

EasyTechnical
36 practiced

What does good version-control hygiene look like day to day: commit granularity and messages, branch naming and PR size, and how you'd handle large binary or generated files if your project has them? Give one example of a commit message that helps a future reader and one that doesn't.

EasyTechnical
28 practiced

Define defensive programming in your own words, then walk through the concrete patterns you would actually apply in a real codebase to reduce production risk. For each pattern you name, explain how it prevents a specific class of production failure and give a short example of an outage it would have avoided.

MediumTechnical
27 practiced

Implement a retry decorator named retry_with_backoff that can be applied to a flaky network-call function. It should accept parameters for max_retries, base_delay_seconds, and jitter, preserve the original function's signature and return value, implement exponential backoff plus jitter, and raise the last exception if all retries are exhausted. Provide production-ready decorator code.

EasyTechnical
34 practiced

When should you write a comment versus refactor the code so it explains itself? Given a trivial restating comment like // increment i by 1 above i += 1, explain whether it should be removed, and give one example each of a comment that legitimately belongs (explains WHY) and one that's a smell (explains WHAT).

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.