Code Comprehension · The method · Lesson 8 of 8
Say it out loud
The interviewer can only score what they hear. A simple script to talk through any debugging problem, what to say when you’re stuck, and how to sum up a full round.
On this page
A script that works for any bug
- The contract: “So this should return the items for one page, pages starting at 1.”
- The reproduction: “Let me reproduce it: five items, page 2, size 2. I expect 3 and 4… I get only 3.”
- The hypothesis: “One item short sounds like an edge: probably the slice end.”
- The check: “Start is 2, end is 4… and it slices to
end - 1, so it stops at index 3, exclusive. There it is.” - The fix: “
slicealready excludes the end, so it should beslice(start, end).” - The proof: “The test passes. Let me also try the last, partial page and an empty list.”
- The wider look: “Other places that compute page ranges might have the same mistake.”
When you’re stuck
Say what you’ve ruled out: “The input to total() is right, so the problem is inside it, not upstream.” That’s progress the interviewer can see, and it often unsticks you. It’s also fine to ask a question: “Is it OK to assume the list is sorted?” A good question is a sign of care, not weakness.
Sum up a full round
With a few minutes left, give the interviewer the whole story in four sentences: the cause and how you proved it, what the AI got right or wrong and how you knew, how the feature fits the code, and what the speed-up costs. If you ran out of time on a task, say what you would do next and how you’d test it. A clear summary of three finished tasks beats a rushed fourth.
- Contract → reproduce → hypothesis → check → fix → prove → look wider.
- Stuck? Say what you’ve ruled out, and ask a clear question.
- End a full round with a four-sentence summary, including what you’d do next.