Code reviews are a valuable practice for a larger team of developers. Not all tasks are optimum for pairing, and code review can be a way to get that second set of eyes that you would normally get if you had a pair sitting next to you.
The fundamental problem with code reviews — it’s a task that everyone despises, yet it’s fundamentally important to a healthy and thriving code base. Here are 3 tips to keep your code reviews in tip top shape!
1) Be objective AND subjective.
Opinions are welcome, but be tactful in the way you present them, and make sure they are represented as an opinion and not as a fact. Don’t be afraid to call in a third party for an additional opinion. Be careful of coming off as negative; it doesn’t hurt to throw in a positive comment every now and then.
2) Give it your all.
While your name isn’t directly on the commit, your approval of a code review makes you just as guilty of bugs and mistakes as the author. I recommend doing a once-through of the code, reading it at a high level to get a gist of the implementation, then taking a break. After you’ve had some time for the code to sink in, come back to it later for a more thorough and detailed look.
3) Look for ways to improve your own code.
One of the most important parts of being a professional software developer and craftsman is that you always work on improving your skills. As software developers, we are constantly reading other peoples code, but most of the time it’s in the context of implementing a new feature — putting most of our attention on our own implementation.
Code review removes the distraction of what you are implementing and allows you to focus 100% on analyzing the code in front of you. Just keep in mind, code is not literature. You can learn things from both good and bad code!