Code Review for Software Quality
A foolproof code review process.
Join the DZone community and get the full member experience.
Join For FreeSoftware code review plays an important role in software quality. The code review can happen in multiple stages, by multiple people, on multiple deliverables. Each one of them focuses on specific areas of software.
Peer Code Reviews
Peer review is mainly between two people. Developer and another teammate.
Code Review Process
For efficient code review, we have set up a pull request process for our code repository in git bitbucket. The developer will create a pull request after completing the coding, and assign code reviewers for the pull request. An email alert will be sent to the assigned reviewer.
The reviewer will review the code and approves the pull request or reject the pull request. Once the pull request is approved by the reviewer, the developer can merge the changes from the feature branch to the release branch.
Along with a mandatory reviewer, we have enlisted a few more people as optional reviewers. The Development Lead and Engineering Head are included as default reviewers for all the pull requests. An email alert is sent to the default reviewers as well. This setup helps managers to review the pull request, and to understand the quality of the code. It will also help the managers to be up to date on the code churn, and that the developers are putting out the highest quality code.
Review Period
It is done very dynamically as and when the code is ready. The developer will create a pull request and assign it to another team member. The default reviewers are also assigned automatically for all the pull requests.
What to Look for During the Review
The teammate must make sure it is reviewed very strictly. It should not be a blanket approval to merge the code. There are high chances that the teammates approve it for merely pushing the code to the release branch. A team member should feel proud to review and ensure the code is actually high quality, and decline the pull requests on not matching the checklist requirements established by the team.
The team members should look for
- Coding standards.
- Functional requirement validation.
- Logic implemented to achieve a feature.
- Static code analyzers are executed.
- Code commenting.
- Nonfunctional requirements like security.
By following this code review, it will help to identify the defects at the first level of code check-in. It will help us to maintain software quality.
Team Reviews
Team review is nothing but a group code review. The theme behind it is mainly on the principle that multiple minds will have different inputs for the same piece of code. In this review, developers, testers, architects, managers, and shared service teams (DB, RE, PE) are all involved.
Code Review Period
It is a weekly review process and all stakeholders will get together in a meeting to review the code developed that week.
Code Review Process
Below is the process followed in the code review meeting
- The developer will present the user story to the full team. The requirement of the user story will be explained to the review group.
- The design followed to implement the user story will be reviewed.
- The code implemented for achieving the user story will be discussed and reviewed by the review group.
- Test cases are compared with the business rules implemented in a user story.
- During the code walkthrough, each developer in the agile team will get a chance to understand the logic implemented and the code will be sanitized by multiple minds in the review group.
- SQE group will present the test cases written for the user story.
- DB team will review the database dependencies like table schema, initial data scripts, data upgrade scripts.
- Release Engineering team will discuss and review the dependencies on the deployment scripts.
- The performance team will get inputs on the criticality of the user story from the performance aspect. The same stories will be added for their backlog to execute the performance and test it.
What to Look for During the Review
Developers will look from the coding perspective and compare it with other user stories. Establish if there is a dependency on the code. It can help all developers to fill in the gaps.
Testers will compare the code implementation with their test cases and identify if there are any business rules implemented by developers that are not part of test cases.
The architect will review from the design perspective and ensure the code is implemented as per initial design. The best coding practices, design principles are checked to protect the software quality.
The shared services team like Database, Release Engineering, and Performance Engineering team members will identify the dependencies in their area of expertise.
Advantages of Team Code Review
There are many advantages of team code review.
- Functional Knowledge cross-pollination across the team. It will help with knowledge retention on a timely basis.
- Multiple views on the code quality. It will help to improve the code and design quality.
- The tester and test cases can help to identify the functional gaps. Also, improve the quality of test cases.
- The architect will ensure design quality is good. It will also help to gain more functional knowledge across the project.
- The shared services team will get inputs for executing the corresponding steps in their area of expertise.
Another big advantage of the team review is an opportunity for juniors to hear from the tech leads, managers, and architects. It is a great learning opportunity for them to understand the expectations, ideas of their seniors like architects and managers.
To conclude, code review is a bi-directional learning process. It helps in ensuring the code is symmetrical across the system and maintains the quality.
Further Reading
Opinions expressed by DZone contributors are their own.
Comments