Explain unfamiliar code line-by-line
Understand code you didn't write before changing it.
Explain the following code as if to a competent developer who is unfamiliar with this specific codebase. For each logical block (not each line — group sensibly): 1. What it does in one sentence. 2. Why it might be written this way (the non-obvious motivation). 3. Any side effects, hidden state, or gotchas. At the end, list: - Three questions I should ask the original author before changing it. - One thing that looks like a bug or smell, if any. Language/framework: language and framework Code: """ paste code here """
- Why it works
- Demanding the 'non-obvious motivation' is what separates a real review from line-by-line narration.
- What to swap
- Always state language_and_framework — generic explanations miss idioms.