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.

MediumTechnical
37 practiced

You are given a function that has grown to do five unrelated things (for example: parsing input, validating it, running business rules, persisting results, and sending notifications) in a single 400+ line block. Walk through how you would decompose it into small, well-named, independently testable pieces, and what you would check before and after to confirm you did not change behavior.

EasyTechnical
34 practiced

Define coupling and cohesion. Give an example of tight coupling and an example of poor cohesion from a typical backend service, and explain concretely what each costs you the next time you need to change something.

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?

HardTechnical
35 practiced

Design a small, composable validator library API for records that supports required and optional fields, type checks, custom predicates, and composition (and/or), with clear structured error reporting that includes field paths. Show example usage, discuss how you keep the implementation small, testable, and performant for streaming workloads, and include one concrete function built on top of it that validates a single record (required keys, a datetime-to-ISO8601 conversion, and a numeric field check) with no side effects.

MediumTechnical
32 practiced

You want to introduce mandatory linting and a consistent style guide across a codebase (or many repos) that has never had one, without drowning teams in noisy diffs or blocking urgent work. Describe your rollout plan: scope, sequencing, and how you handle legacy code that fails the new rules on day one.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.