Chapter 4 Defect Management U is a defect
u Defect Find Technology
u code review
u Defect prediction
4.3 code review
The code review is to study the source code and find errors from it. The code review is more effective because it sees the problem itself instead of the sign. When reviewing the code from the head to tail, consider what the program should do. Therefore, when seeing certain places is incorrect, you can see what a possible problem is, and immediately verifying the code. The disadvantage of review is that it is very time consuming, and it is difficult to properly; a skill in review, of course, can be improved by learning and practice.
The first step in code review is to understand the types of defects they introduced, which is the main reason for collecting defect data. Because the types of defects introduced in the next program are generally similar to the front, as long as the same software development method is used, the situation will continue. On the other hand, when you have skills and experience or change the process, the type and number of defects will change. But after a certain degree, improvements become very difficult. This is, you must study the defects, which can help you find a better way to find and repair defects.
How to review the code. The goal of code review is to discover defects as much as possible during the software, the less resistant to the defect discovery time. The code review before the compilation is compiled, and is the best way to complete the target before compiling.
Table 4.3 Code review script
Entrance condition
Before review, check if the following products are ready:
u demand specifications;
U program design document;
The source code list of the U program;
u Code standard;
u code review checklist;
General description
Use the code review checklist;
Follow the instructions for check the inspection table in accordance with the code;
At the end of the review, fill in the accumulated, accumulated percentage and summary columns;
1 review procedure
First, complete the source program encoding;
Then, print a source list before compiling and testing;
Next, check the code;
When performing code review, carefully check each line source to discover and repair defects as much as possible;
2 repair defect
Repair each of the defects found;
Make sure the repairs are correct;
Log in to the defect record log.
3 coverage review
Verification program is designed to cover each function described in the demand specification;
The verification program code implements all the design.
4 program logic review
Verification program is logically correct;
The verification program code correctly implements logic in the design.
5 Names and Type Check
Verify that all names and types have been correct;
Check if integer, long integer and floating point are correct.
6 variable check
Make sure each variable is initialized;
Check the overflow, underflow or offshore problem.
7 Program syntax check
Verify that the program code meets the specifications of the programming language
Export condition
At the end of the review, it should be:
Complete, repaired source program list;
Fill in the full time record log;
Fill in the completed defect record log.
Before compiling. There are several reasons that the code review should be performed before compiling: No matter the time before or after compiling, the time for complete code review is about the same; whether it is compiled or compiled, the effect of checking the validity of the syntax is the same; The review will save a lot of compile time. If you do not do code review, it is generally taken 12% to 15% development time to compile. Once the code review is used, the compilation time can be shortened to 3% or less; after the compiler, the code is general The review is difficult to complete; experience proves that there is a lot of defects in the test phase when there is a lot of defects during the compilation phase. Establish a personal code review checklist. If you want to discover and correct each of the procedures, you must follow a precise procedure. The checklist ensures that this procedure is followed, which includes a series of steps. When you go to the checklist, you know how to review the code.
If you can use a checklist correctly, you can also know how much defects have been found. This will measure the efficiency of the complex check process and further improve the checklist. Checklist includes personal experience. By constantly use and improve your personal checklist, you can help you find these defects with less time. Table 4.4 is an example of a C program code review table.