LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

What are the best practices and checklist to follow while reviewing your code?

Can anyone please suggest me on some of the best practices and checklist one should to follow while reviewing your code?

Up Vote Down Vote 0 Votes
Posted 4 months ago

Answers


Being in the software industry you may have often heard the term code review. However, the concept of code reviewing is often misunderstood. Often it is overlooked in the software development life cycle as people feel performing testing should suffice the validation process. Just like coding and testing, you need to keep in mind some code review best practices as well. Let’s discuss them in details.

  • Know What You Are Looking For: Set up your goal before reviewing. Prepare a list which may include coding style, structure, the complexity of logic, readability. In short, include items which cannot be reviewed during automated testing and requires human intervention. Ask questions like “Do I know what this code is doing?” or “Does this code complies by client specified coding standards?” is considered as a great code review best practices and you will easily prepare the items to check for in the code.

  • Build & Test Prior To Review: In the current age of continuous integration and continuous delivery, it is ideal to build and test the code before manually reviewing it. This ensures that the code is stable and saves a lot of time. After a successful build, when the code passes all automated tests, it is a best practice to code review and ensure that a bug-free code has been pushed to the developer’s code line.

  • Don’t Take Too Long To Review: As a part of code review best practices, you need to ensure that you are not spending more than the average time in code review. It will be better if you review the code in short breaks to ensure that your brain gets the required interval and you can start again with a fresh mind. Frequently reviewing the code will also help you think about new scenarios and improve the code’s quality.

  • Your Review Must Not Hurt: Instead of being critical, be constructive in your review. Ask questions instead of making statements. Also, praise the developer for their job. Your feedback in the right tone must not hurt them, it should rather inspire them to correct their mistakes and make sure it does not happen again.

  • Communicate The Expectations & Goals: Be clear about the goal of the review as well as expectations of the reviewer. If the reviewers are working under you, then as a part of code review best practices, it is recommended for you to provide them with a checklist to help them check the mandatory stuff and ensure that the entire team’s code is reviewed in a consistent manner.

  • Include Your Entire Team: No matter how senior or experienced your programmers are. Everyone must review the codes along with getting their codes reviewed. The performance level will increase relatively when they will know that their code is going to be reviewed. Try to include an architect along with a developer while reviewing the code. Both of them will detect different issues, while will ultimately impact the overall application’s design.

(Read more…)

Up Vote Down Vote 0 Votes
Posted 3 months ago