If you have to conduct your first code review or you’ve been doing it for a while but feel like you could be better at it, you’re in the right place. These 6 tips, offered by engineers at The Muse, will help you sharpen your code review skills so you can offer meaningful, constructive, and impactful feedback to your fellow technologists.
1. Factor in the Big Picture and the Small Picture: While most pull requests will only affect a confined segment of the codebase, it’s important to keep the big picture in mind too. Consider how the code will affect both the big picture and the small picture, keeping in mind that there is nothing too big or too small to comment on.
2. Be a Team Player: Yes, you’re reviewing someone else’s code but, in a true team environment, everyone takes ownership of the codebase. A team player attitude will come in handy as you execute code reviews because you’ll be able to factor the team’s priorities into your feedback. If the deadline is close, putting to-do items on the backlog may be a better idea. And, when you’re reviewing code, you can ask if it would make sense to someone who has just joined the team. This will help keep everyone’s code more readable and understandable and give new hires a smoother transition.
3. Review the Tests Too: If you want to find or prevent bugs, you need to read the tests with the same importance as the rest of the code. While this won’t help you spot every bug under the sun, it will help you conduct a more thorough review and see things you may not have seen otherwise.
4. Test Functionality: A lot of code reviews won’t require you to run the app locally to test its functionality, but this step can help you identify bugs that don’t get noticed in previous test runs or in your regular code review. Although some reviewers don’t believe manual testing should be a part of the code review process, it can be a helpful way to determine if you need to invest more time reviewing and it will definitely slow the growth of a bugs backlog.
5. The Process is for Learning & Knowledge Sharing: One of the best things about the code review process is that it gives everyone involved a place to get more insight and learn along the way. Whether you’re looking to share your knowledge or learn more, the code review process can help you and others better understand the codebase, languages, frameworks, and best practices. Keeping this learning mentality in mind as you make your comments will help you offer constructive, useful feedback that educates others.
6. Don’t Forget Security: Yes, there are some changes that may impact more than jus the codebase. Assess new features’ potential security implications and never forget to keep security in mind when you’re offering your feedback.
You can improve your code review skills if you keep the overall impact in mind, review like a team player who is trying to share their knowledge, and thoroughly test for bugs. Implement one or more of these 6 tips into your code review process today!