code_inspection


Code Inspections

A code inspection is a set of procedures and error-detection techniques for group code reading. It lasts from one to two hours in length and allows the programmer to verbally explain the program statement by statement.

How do we do that?

o Assign a moderator to do the following: - distribute the program source & design specification - schedule the session - lead the session - record all errors found - ensure errors are corrected - update "frequently encountered" error checklist

This person must be a competent programmer but not the programmer.

o Assemble the group with the following functions. - test specialist - program designer (may be the same as the programmer) - the programmer


Preparation

The moderator distributes the program and design specifications several days before the code inspection. The group should come after having read and become familiar with the design and code.


Inspection Activity

The programmer narrates, statement by statement, the logic of the program. Questions can be raised and pursued during the narration to find any errors in logic.

Experience has shown that many of the errors in a program will be found by the programmer during such activity.

Analyze the code with respect to a checklist of historically common programming errors. The moderator is responsible for ensuring the discussions proceed along productive lines and that the participants focus their attention on finding errors, not correcting them.

NOTE: Some design issues lend themselves to group discussion and can improve the product as the group collectively explores the issues. The moderator should be open to that activity.


Follow Up Activity

The moderator compiles a list of errors for the programmer. The list should be analyzed, categorized, and used to refine the error checklist which improves Code Inspection Activity.

The moderator should assign another code inspection if the error list warrants another detailed look. The moderator ensures that the error list is corrected by the programmer.


Inspection Statistics

Management issues and management reporting do not belong in code inspection sessions. The programmer should not feel uneasy about looking openly at the code. If statistics are gathered from session to session, they should be gathered as a collective group over a period of time.

Organizations report:

150 line of code per hour is typical Optimal time to be 90 to 120 minutes Exposure to other programming styles benefits the group Identifies early the most error-prone sections of code

1