How to review code

Source: Internet
Author: User
We call code review a cr, that is, code review. It is an important quality assurance activity from project progress to coding stage. However, many times, our Cr work is in the form, and we cannot find essential problems in the CR process, mainly due to the following four reasons:
First, the purpose of Cr is not strong, and there is a lack of pertinence. The fundamental purpose of Cr is to ensure quality, but it cannot be the direct goal of a cr activity. Such a goal is too general, so that we can not grasp the key points during the CR activity.
2. unreasonable roles involved in CR activities. Most of the participants in CR activities are technically qualified, but the business is not qualified. This makes it difficult to find some complicated business logic problems, making these business logic problems under the umbrella of CR, the secret.
3. Cr activities are too concentrated, and the amount of code for one Cr operation is too large. In a limited few hours, when faced with thousands of lines or even more code, people with patience will inevitably suffer visual fatigue.
4. Insufficient preparation and lack of necessary review specifications and standards for codes to be cr. In the code review process, we often only write code standards, but the code design specifications, business logic specifications and standards are not prepared enough.
So what should we do to ensure the quality and efficiency of Cr work? A standard Cr activity can be divided into three phases:
I. preparations in advance. Before a cr operation, make the following preparations.
1. Cr object. When preparing Cr code objects, we need to pay attention to the number of codes. If the code volume is large, we need to break down the code, determine the key code, and Cr the key code, it can be used in the opposite way.
2. Cr content. We review a lot of code content, such as code writing standards (annotation writing formats, naming rules, etc.), technical processing specifications (Exception Processing, log processing, code organization structure, etc) and business implementation. We do not wish to review all such content through a cr activity, so we must set the content boundaries of this Cr activity to determine the review focus;
3. Review specifications and standards. Prior to Cr design, it is necessary to determine the review specifications and standards. through standards and standards, we can follow the rules and rules in the review process, and ensure that the standards are consistent.
4. Select the participants of the CR activity. Prior to the beginning of Cr, all participants must be informed of the objects, content and specifications and standards of this Cr activity.
5. Select the implementation method of Cr activity. There are many forms of Cr activities available for us to choose from. We can choose desktop Cr, demo Cr, one-to-one seat Cr and so on based on the actual situation.
2. implementation stage. Adequate preparation is only a prerequisite for Cr activities. During Cr implementation, we must do the following.
1. Accurate record. For the problems found in the CR process, we must keep a clear and accurate record. We can use the problem point record to clearly record the items and content.
2. In the CR process, the author of the Code should be used to explain and the examiner should ask questions. The examiner should not only ask questions when identifying the issue, but also ask the code author to explain a specific issue according to the content of this review.
3. pre-determined review content should be reviewed one by one, and cannot be swept away due to factors such as insufficient time.
4. During the implementation of the review, we should create an atmosphere for discussing and solving the problem. We should not make the review a critical meeting, which will affect the enthusiasm of relevant personnel.
3. Follow up later. After Cr is completed, you must first determine the following content for the problems found.
1. difficulty of the problem points and scope of impact;
2. Those responsible for resolving the problem and those who confirm the rectification results of the problem points;
3. Time limit for solving the problem.
Second, the responsible person should record three aspects in the correction process.
1. cause of the problem;
2. countermeasures to solve the problem;
3. Modified content.
As a confirmation of the amendment result, the amendment result must be fully confirmed in a timely manner according to the time limit agreed in advance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.