Code review improves the quality of the code and makes code structure more stable. It also helps to build relationships with fellow programmers and teams.
However, it is also known that a review of the code will never go as planned as there might be chances to number of lines of code or complex logic or algorithm implementation.
So we need to establish code review practices to achieve good quality and effective code.
- Allocate max time to review code at a time
Our efficiency and attention to detail decrease significantly after an hour of work. It is best to review the code more often but in shorter sessions. Small break will give our brain a chance to recover and after a break we can resume to work again effectively.
- Limit checking of lines of code at a time
We should try to ensure that no review session is longer than 350 - 450 lines. So, trying to review too many lines of code at once will reduce the chance of finding errors. For sake of good review, setting the limit of lines of code is just as important as setting the time limit.
- Plan to look for effective and stable code
We should always look for crucial things when looking through the code like code structure, logic, test coverage, readability, serviceability, functionality, etc.
We need to plan for a checklist to review the right things and reduce testing time.
While reviewing we should check what code is doing, Is the code achieving the requirement, Is there any alternative or Is the code consistent with our code base and architecture, etc. The organized or planned checklist will help the reviewer to make sure the coherence of the code review. Hence reviewers will know what to look out for which will result in using their time to review the code wisely. - Plan to express meaningful thoughts
We should try to express ourselves in a meaningful way. We are reviewing code and not a programmer so ask questions, don’t make judgments. Sometimes taking review discussion offline will help to get personal feedback or review to understand and maintain good code quality.
- Positive code review culture
We will help the entire team appreciate the code review by promoting a positive culture. As code reviews play an important role in product quality. So it's important to create and maintain a positive culture in code reviews. It doesn’t matter who implements the bug first, the important thing is error to be found at the right moment.
Just remember, our code always needs a review. Adding some descriptive information about changes, issue link, any relevant screenshot after implementation will definitely add some value to code review process.
Nice article.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWell said,, learnings well expressed
ReplyDeletePost a Comment