Names and boundaries
Pretty code with the wrong boundary is still a defect.
Look at behaviour at the boundary first and style second. An empty name, zero, a repeat, a cancellation, a failing dependency. A model happily writes the happy path and leaves the boundary for later, which means for you, in production. If the request had a boundary and the code does not, the answer is not done.
Check names against the file, not against the model's taste. The neighbouring function is called userID, and the answer brings userId plus a second User type. A month later there are two languages in one package. Ask for names to match the neighbouring code, not a "widely accepted" style from another project.
The module boundary matters too. An answer that goes from a handler to the database, sends an email and formats HTML has mixed the layers. Even if each piece is neat on its own, it is expensive to test and change. Bring the model back to one layer: "input validation only, no database".
A comment that retells the code can go at once. A comment that explains an invisible domain rule can stay, if the rule really is invisible. Models add comments generously. Here generosity is noise.
Practice
Where to look first
The answer is nicely formatted. What should you check before style?
- Indentation and comments
- The edge case from your request
- The length of the answer
- Whether the explanation has emoji
What to check names against
Should names in the answer be checked against the neighbouring file or against the model's taste?
Which boundaries to ask about
Select the boundaries that are easy to lose on the happy path.
- Empty input
- A failing dependency
- A validator that writes to the database and sends an email itself
- A comment that repeats the function's name