Striking the Balance: Combining Self-Review and Peer Review for Code Excellence
LinkedIn
Facebook
Twitter

Before solution and implementation are merged into the upstream branch, a code review is a crucial stage in the software development cycle to obtain a second viewpoint. The majority of developers believe that this step is necessary, yet it frequently seems like bureaucracy or an imposed norm. But a professional developer loves the review process, which is one of the main distinctions between them and regular developers. They are content to participate in it because it is something they enjoy.

Code review, in my opinion, is more important than actual coding. 

Why should you do code review on others? 

Share knowledge and learning 
Even though many of us think that code quality and bug reduction are more important reasons to conduct reviews, I believe that sharing knowledge and facilitating learning are even more crucial. Often, I find myself thinking, “Oh, this is new, what does this thing do?” This is a scenario many of us encounter. 
Due to the review process, at least two developers will become acquainted with the code, and in the future, both will have the knowledge to make improvements or modifications. 
review code
Improved Code Quality 

Code quality is truly significant, and without maintaining it, the code quality will degrade over time. This is why code reviews contribute to enhancing code quality. 

 

  • Transparency and accountability: you will produce higher quality code because someone will review it. This includes tackling code duplication and adhering to coding standards. 
  • Reviewers will point out areas where the code is unclear or poorly documented. 
  • Reviewers will suggest optimizations and improvements. 
  • Reviewers will identify use cases that are not covered (e.g., error handling). 
  • A reviewer can catch bugs in your modified code. 
  • Reviewers can ensure that the code aligns with the business requirements and project goals. 
Improved Colaboration

Code review compels us to engage with others about the code. It serves as an organized method to provide and receive feedback and encourages communication among team members. 

Why should you do code review on your own code? 

Conducting self-code review involves a developer evaluating their code before submitting it for formal review by colleagues. Also, there will be instances when you are the sole developer on a project. 

In any project, whether alone or within a team, I perform a self-review of my code changes after preparing my pull request. I find that allowing a day to pass before conducting the review is the most effective approach. The reasons for this are as follows: 

 

  • Allowing my mind to rest and disconnect from the solution. 
  • If I read this code in a different environment (e.g., development using Visual Studio Code and review using GitLab or Github, I need the code to read consistently. My guiding principle is simple: whether looking at an aircraft during the day or at night, it should appear as an aircraft, maintaining its identity regardless of the time, rather than transforming into a spaceship at night. 

This self-review process should be accompanied by a checklist (plan) created before beginning development. This list can be adapted during development and should elucidate the thought process behind code changes. The list will help the developer not deviate from the task objective and help the reviewer understand what you want to do before it begins reading the code. 

In essence, code review is centred around honouring the art of programming. This is demonstrated by dedicating time and effort to enhance the quality of the code that has been created and positioning the team for success and professional growth. 

For optimal results, I believe a combination of self-review and peer review is most effective. Self-review can catch evident errors and enhance initial code quality, while peer review provides an alternate perspective and identifies subtler issues. The fusion of both approaches elevates overall code quality and enriches the development process. 

Read more tech topics