DevPrep

All topics › Behavioral & Soft Skills

What do you do when you spot bad code outside your task?

Middle

What is being assessed

The balance between caring about quality and respecting task boundaries and other people's code. Red flags: "I silently rewrite it" (bloated PRs, conflicts, resentment) and "not my business" (indifference to the codebase).

Answer skeleton

Example answer

S: While building a feature on the profile screen I noticed, in the neighbouring notifications module, a DispatchQueue.main.sync inside a handler that was sometimes invoked from the main thread.

T: A potential deadlock, but not my module and outside my task.

A: I didn't fix it in my PR. I messaged the author with a minimal reproduction — it turned out they didn't know the handler could arrive on main. I filed a ticket tagged "hang risk" with the stack trace attached. The author fixed it the same day with a MainActor.assumeIsolated check and Task { @MainActor in }.

R: My PR stayed within scope, the bug was fixed before it reached production, and the team agreed to enable -warn-concurrency so the compiler would catch similar cases.

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store