Code Inspection SENG 426, Summer 2009
Overview � Code Inspection Process ◦ Participants ◦ Process Steps ◦ Inspection Metrics ◦ Forms � Sample Code Inspection � Project Part One: ◦ Use cases & Sequence Diagrams, Application Design, and Report Outlines.
CODE INSPECTION
Code Inspection � refers to peer review of any work product by trained individuals who look for defects using a well defined process. � The goal of inspection is to identify defects. � A defect is any part of the work product that will keep an inspector from approving it.
Participants � Author: The person who created the work product being inspected. � Moderator: This is the leader of the inspection. The moderator plans the inspection and coordinates it. � Inspector: The ones who raise questions, suggest problems, and criticize the document . � Recorder: The person that documents the defects that are found during the inspection.
Inspection Process Overview
Process Description � Planning: The inspection is planned by the moderator. � Overview meeting: The author describes the background of the work product. � Preparation: Each inspector examines the work product to identify possible defects. � Inspection meeting: During this meeting the reader reads through the work product, part by part and the inspectors point out the defects for every part. � Rework: The author makes changes to the work product according to the action plans from the inspection meeting. � Follow-up: The changes by the author are checked to make sure everything is correct.
Inspection Metrics � Many different metrics can be calculated during an inspection process: � The number of major and minor defects found � The number of major defects found to total found. (If the proportion of minor defects to major defects is too large a moderator may request the reviewer repeat the review, focusing on major defects, prior to commencing the logging meeting) � The size of the artifact (pages, LOC, ...) � The rate of review - the size of the reviewed artifact divided by time (normally expressed in hours) (e.g., 15 pages /hour). � The defect detection rate - the number of major defects found per review hour.
Inspection Metrics (continue…) � T otal Defects Found: � A + B – C � ( A=defects found by inspector 1, B=defects found by inspector 2, C=common defects found by 1 & 2) � Defect Density: � Total Defects Found / Size � (size=total no of pages or lines of code or some other measure)
Inspection Metrics (continue…) � Estimated T otal Defects: � (A x B) / C � ( A=defects found by inspector 1, B=defects found by inspector 2, C=common defects found by 1 & 2) � Yield (Defect Removal Efficiency): � (Total Defects Found / Estimated Total Defects) x 100
Inspection Metrics (continue…) � Inspection Rate: � Size / Total Inspection Time � Total Inspection Time = the sum of each reviewers review time plus the total person time spent in each meeting � Defect Detection Rate: � Total Defects Found / Total Inspection Time
Inspection Forms � We will use two types of forms ◦ Individual Reviewer Form: used during Preparation Stage ◦ Log Form: used during Meeting Stage
Individual Reviewer Log Form used during Preparation Stage
Log Form used during Meeting Stage
SAMPLE CODE INSPECTION
Sample Code Inspection � JWP class: OfficeHelp � Code Inspection Checklist � Java Code Conventions � Individual Log Form � Overall Log Form
OfficeHelp
Sample Code Inspection � Java Program: LinkedTwoEndedList � Inspection Checklist � Individual Log Form � Overall Log Form
Minor/Major Defects � Missing class, function and variable comments. � Line 32: (OfficeHelp Constructor): ◦ Literal string should be made constant � Lines 32: (OfficeHelp Constructor): ◦ Variables are not checked � Lines 62: (iceMethodCall): ◦ Variables are not checked.
Minor/Major Defects � Lines 21: start_loc ◦ Variable should be local to constructor. ◦ Name does not follow convention. � Lines 44-49: ◦ Execution of code after exception � Lines 87 – 99 redirectOutput: ◦ FileStream is not closed. � Line 87 redirectOutput(): ◦ Unused Function.
PROJECT PART ONE
Use Cases Diagrams � Document Handling. � Document Editing. � Format Document. � Application Customization.
Use Cases Diagram
Use Case Description
Sequence Diagram
Comments on the Application Design & Architecture � What is the proper design pattern for JWP? � Is JWP follows a specific design pattern? � Package Structure and Dependency? � Comments on the JWP usability
Report Outlines � Introduction. � Informal Description � Class Diagram � Use Cases ◦ Diagrams ◦ Descriptions � Sequence Diagrams � Package Diagram and Class Table. � Package and Class Descriptions. � Application Design Comments.
QUESTIONS??
Recommend
More recommend