You are on page 1of 28

Code Inspection

SENG 426, Summer 2009


Overview
y Code Inspection Process
◦ Participants
◦ Process Steps
◦ Inspection Metrics
◦ Forms
y Sample Code Inspection
y Project Part One:
◦ Use cases & Sequence Diagrams, Application
Design, and Report Outlines.
CODE INSPECTION
Code Inspection
y refers to peer review of any work
product by trained individuals who look
for defects using a well defined process.

y The goal of inspection is to identify


defects.
y A defect is any part of the work product
that will keep an inspector from
approving it.
Participants
y Author: The person who created the work
product being inspected.
y Moderator: This is the leader of the inspection.
The moderator plans the inspection and
coordinates it.
y Inspector: The ones who raise questions,
suggest problems, and criticize the document .
y Recorder: The person that documents the
defects that are found during the inspection.
Inspection Process Overview
Process Description
y Planning: The inspection is planned by the moderator.
y Overview meeting: The author describes the background of
the work product.
y Preparation: Each inspector examines the work product to
identify possible defects.
y 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.
y Rework: The author makes changes to the work product
according to the action plans from the inspection meeting.
y Follow-up: The changes by the author are checked to make
sure everything is correct.
Inspection Metrics
y Many different metrics can be calculated during an
inspection process:
y The number of major and minor defects found
y 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)
y The size of the artifact (pages, LOC, ...)
y The rate of review - the size of the reviewed artifact
divided by time (normally expressed in hours) (e.g., 15
pages /hour).
y The defect detection rate - the number of major defects
found per review hour.
Inspection Metrics (continue…)
y Total Defects Found:
x A+B–C
x ( A=defects found by inspector 1, B=defects found
by inspector 2, C=common defects found by 1 & 2)
y Defect Density:
x Total Defects Found / Size
x (size=total no of pages or lines of code or some
other measure)
Inspection Metrics (continue…)
y Estimated Total Defects:
x (A x B) / C
x ( A=defects found by inspector 1, B=defects found
by inspector 2, C=common defects found by 1 & 2)

y Yield (Defect Removal Efficiency):


x (Total Defects Found / Estimated Total Defects) x
100
Inspection Metrics (continue…)
y Inspection Rate:
x Size / Total Inspection Time
x Total Inspection Time = the sum of each reviewers
review time plus the total person time spent in
each meeting

y Defect Detection Rate:


x Total Defects Found / Total Inspection Time
Inspection Forms
y 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
y JWP class: OfficeHelp
y Code Inspection Checklist
y Java Code Conventions
y Individual Log Form
y Overall Log Form
OfficeHelp
Sample Code Inspection
y Java Program: LinkedTwoEndedList
y Inspection Checklist
y Individual Log Form
y Overall Log Form
Minor/Major Defects
y Missing class, function and variable
comments.
y Line 32: (OfficeHelp Constructor):
◦ Literal string should be made constant
y Lines 32: (OfficeHelp Constructor):
◦ Variables are not checked
y Lines 62: (iceMethodCall):
◦ Variables are not checked.
Minor/Major Defects
y Lines 21: start_loc
◦ Variable should be local to constructor.
◦ Name does not follow convention.
y Lines 44-49:
◦ Execution of code after exception
y Lines 87 – 99 redirectOutput:
◦ FileStream is not closed.
y Line 87 redirectOutput():
◦ Unused Function.
PROJECT PART ONE
Use Cases Diagrams
y Document Handling.
y Document Editing.
y Format Document.
y Application Customization.
Use Cases Diagram
Use Case Description
Sequence Diagram
Comments on the Application
Design & Architecture
y What is the proper design pattern for
JWP?
y Is JWP follows a specific design pattern?
y Package Structure and Dependency?
y Comments on the JWP usability
Report Outlines
y Introduction.
y Informal Description
y Class Diagram
y Use Cases
◦ Diagrams
◦ Descriptions
y Sequence Diagrams
y Package Diagram and Class Table.
y Package and Class Descriptions.
y Application Design Comments.
QUESTIONS??

You might also like