Code Review and Inspection Techniques
Code Review: Peer review of code helps detect faults early, reducing correction costs. Analyzing errors early in development is crucial for defect detection and mitigation of risks like budget and planning deviations. It improves quality, visibility, and the ability to analyze changes quickly, reducing testing effort.
Types of Code Reviews
- Informal: Conducted between pairs of developers.
- Formal: Planned reviews with assigned responsibilities, becoming more necessary as project size increases.
Code Inspections
Inspections: A formal assessment technique where requirements, design, or code are analyzed in detail by a group different from the author to identify defects, problems, and areas for improvement.
Objectives of Inspections
- Detect and correct defects early and efficiently.
- Prevent errors.
- Serve as a training and improvement mechanism.
Features of Inspections
- Formal process for detecting errors.
- Detects more errors than other techniques.
- Generates documentation about the results.
- More expensive than other techniques.
Roles in Inspections
- Moderator: Plans and coordinates the inspection.
- Author: Creator of the item under inspection.
- Reviewer: Examines the item to find defects.
- Recorder: Documents the inspection results.
- Reader: Reads the items, guiding the inspectors during the meeting.
Inspection Process Steps
Step 1: Planning
- Author:
- Gathers documentation for the inspection.
- Verifies that the documentation satisfies input criteria.
- Collaborates in selecting inspectors.
- Distributes documentation to participants.
- Recommends or not the overview session.
- Moderator:
- Verifies that the product satisfies input criteria.
- Decides to perform an overview session and plans it.
- Selects the inspectors.
- Plans the meeting.
- Prepares and distributes information to the team.
Step 2: Overview
- Inspectors:
- Ask questions to clarify the product.
- Do not analyze design or implementation alternatives.
- Focus on understanding the product.
- Author:
- Prepares a technical presentation of the product.
- Presents all information so that inspectors can understand the work.
- Moderator:
- Organizes and conducts the presentation.
- Focuses the presentation on information exchange, minimizing the effort to detect errors or improve the product.
Step 3: Preparation
- Inspectors:
- Analyze the product using checklists.
- Write down the time used in preparation.
- If the reader role is assigned, prepare the reading of the product.
Step 4: Meeting
- Author:
- Be objective and do not defend yourself.
- Explain the techniques and parts that have not been understood by the inspectors.
- Write down comments that can help you to improve.
- Moderator:
- Never the author.
- Avoid discussions about alternative solutions.
- Plan and conduct the meeting.
- Inspectors:
- Be active and objective.
- Prepare the meeting properly.
- Reader:
- Never the author, the moderator, or the recorder.
- Select the sequence for presenting the product.
- Describe the product in detail.
- Answer the questions of the inspectors.
- Recorder:
- The moderator could act as recorder.
- Knowledge on defect classification.
- Write down the defects and classify them.
Step 5: Correction
- Author:
- Correct the defects.
- Communicate to the moderator.
Step 6: Follow-Up
- Moderator:
- Verify that the defects have been corrected.