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
36 practiced

What is cyclomatic complexity, and what does it (and other maintainability metrics like duplication or coupling) actually tell you versus not tell you about a codebase's health? How would you use it to decide what to refactor next, without letting people game the number?

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
35 practiced

What is idempotency in the context of ETL and data pipelines? Give two concrete strategies to make a batch job idempotent, for example file-based output versus a database upsert, explain how each strategy achieves idempotency, and discuss the trade-offs. Then extend this to a distributed streaming system with at-least-once delivery, where multiple retries can create duplicate downstream writes: design a robust approach to deduplicated writes that accounts for idempotent keys, transaction support, late arrivals, and eventual compaction, and describe the trade-offs and failure modes.

MediumTechnical
52 practiced

Describe a defensive-programming strategy to detect and handle schema drift for JSON records arriving in a streaming pipeline. Include which runtime checks you would implement (field presence, types, unexpected fields), when you would fail fast versus degrade gracefully, and how you would surface schema issues to monitoring and alerts without overwhelming the team with noisy spikes.

MediumTechnical
36 practiced

How would you structure a complex analytical SQL query to maximize readability and maintainability? Rewrite a hard-to-follow query using CTEs, descriptive aliases, and modular views, and explain what made the original version hard to follow.

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.