Member-only story
Questions to ask yourself during a code review
Disclaimer: All opinions are my own
You’re starting your morning with a delicious cup of coffee and a plan to check your email and chats. After that, you’ll dive into a code change you were planning to make today. Everything is planned out and going great when suddenly you get a dreaded message from a teammate, “Can I get a quick review on this change? I’d like to merge it today.”
Code reviews are tough. It’s hard to know if you’re providing value, it’s hard to understand a change you’re seeing for the first time, and it’s hard to know if the change will throw an exception and break everything. So here are some questions I ask myself when I’m reviewing code.
What does this change do?
If you’re working with a really helpful teammate, the change will come with a description (or commit message) that explains what it does and why, the goals, and why it’s a good change to make. That can be a great starting point.
But I find it useful to scroll through the files in somewhat random order. I usually just start at the top of the code review page because that’s usually random enough. For every line change, ask yourself if you can explain why it’s necessary.