Bhumika Jaiswal

What reviewing juniors' code taught me about my own

· 5 min read

Part of my role at Accenture is to review code and mentor junior developers. I expected it to be about finding bugs. Mostly, it taught me how to write code and comments that other people can follow.

Read the description first

Before the diff, I read what the pull request is for. If the description is empty, that is my first comment. I ask for three things: what changed, why, and how to test it. A reviewer who does not know the goal can only review style.

Run it

Five minutes with the branch running finds things that a diff never shows: a layout that breaks at phone width, a loading state that flashes, a button that does nothing on the second click.

Label every comment

I start each comment with what kind of comment it is:

Without labels, a new developer treats every comment as an order, and fixes the nits first.

Ask, then explain

“Why is this in a useEffect?” teaches more than “Move this out of the useEffect.” Sometimes the answer is a reason that I did not know. When it is not, I explain the rule and link the docs, for example React's page You Might Not Need an Effect. Then the next pull request gets it right without me.

Turn repeated comments into tools

If I write the same comment three times, it is not a review comment any more. It becomes one of these:

Pair on the first few

For a new joiner, the first two or three reviews happen on a call. We read the diff together, and they explain their choices. It takes longer once, and it saves a week of comments back and forth.

Say what is good

When something is well done, I say so, and I say why: “Nice, this hook makes the component easy to test.” People repeat what you point out.

What it changed in my own code