Code Inspections - Rose

Code Inspections
CSSE 376, Software Quality Assurance
Rose-Hulman Institute of Technology
March 22, 2007
Outline

Inspections in general

That is, for any type of artifact
Fagan's original work on code
inspections
 Benefits and Costs of Inspections

2
Inspections in General
Inspection Fundamentals



Preparation
Led by a moderator
Recorded results
4
Inspection Roles

Moderator



Recorder



records results
publishes results
Reviewer(s)



schedules the inspection meeting
leads the meeting
prepares for inspection meeting
participates during meeting
Producer


5
one of the authors; distributes artifact
attends inspection meeting, but does not talk (except to
answer questions)
Inspection Process
1.
2.
3.
4.
5.
6
Planning
Preparation
Meeting
Reporting results
Rework
1. Planning




7
Schedule inspection meeting (time
and place) [Moderator]
Invite Reviewers [Producer]
Prepare materials [Producer]
Distribute materials to Reviewers
[Producer]
2. Preparation



8
Reviewers read artifact
Reviewers annotate listing with
comments
Reviewers keep track of time spent in
preparation
3. Inspection Meeting

A square or octagonal table is
recommended

Moderator runs the meeting
Recorder keeps minutes:
 preparation time of Reviewers




9
comments and commenters
Reviewers contribute comments
Producer attends, but remains silent unless
asked a question
Dilbert on Moderating
10
Moderating the Session


Don't go too fast -- may miss things
Don't go too slow





11
may not cover all of artifact
reviewers may lose concentration
Keep group on task
Record important events
Keep session to 1-2 hours in length
Wrapping Up


Ask for final comments
Review action items



12
Recorder: send minutes to
Moderator
Reviewers: send annotated listings
to authors
Recorder or Moderator: send reports
to participants and to management
4. Reporting Results

Summary data is sent to management




Detailed results are sent to participants


13
how many people participated
when the meeting took place, and for how
long
how many issues were found (may be
categorized)
all issues with annotations
action items
5. Rework




14
Authors review comments
Artifact is modified by Producers
Reviewers are notified of changes
Another inspection may be needed,
depending on the number and
severity of the original comments
Fagan’s Work on Code
Inspections
Overview of Fagan's Work
Proposed use of code inspections
 Demonstrated evidence that
inspections were cost effective

23% improvement in coding efficiency
 careful to avoid the "Hawthorne effect"

16
Code Inspection Checklist
Examples

Mistakes
improper use of programming
language
 errors in algorithm or declarations


Poor style
violations of standard coding style
 confusing or misleading expressions

17
Categorizing Defects
Some errors are more serious than
others
 Some errors are more common than
others
 Objective is not perfect classification,
but separation of major types

18
Sample Categories
Major -- require investigation
 Minor -- may not need immediate
attention
 Cosmetic -- optional improvements

19
20
How many LOC per inspection?

Remember, 1-2 hours is desired
length of inspection meeting
Generally 100-200 lines of code per
hour is the proper pace
 Thus, many inspection meetings are
likely needed for the entire source
code

21
Benefits and Costs
Why Do Inspections Work?

Preparation


Peer pressure


forces developers to work harder
Formal process

23
reviewers find things that authors miss
forces developers and reviewers to do
a thorough job
Costs of Inspection
Time spent in preparation
 Time spent in meeting
 Overhead of scheduling meeting

24
How Could We Improve
Inspections? (Some Ideas)
Reduce number of reviewers
 Reduce time spent in meeting
 Hold meeting asynchronously
 Hold meeting via the web


25
What are the pros and cons to each of
these?