270 likes | 569 Views
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. Inspections in General.
E N D
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
Inspection Fundamentals • Preparation • Led by a moderator • Recorded results
Inspection Roles • Moderator • schedules the inspection meeting • leads the meeting • Recorder • records results • publishes results • Reviewer(s) • prepares for inspection meeting • participates during meeting • Producer • one of the authors; distributes artifact • attends inspection meeting, but does not talk (except to answer questions)
Inspection Process • Planning • Preparation • Meeting • Reporting results • Rework
1. Planning • Schedule inspection meeting (time and place) [Moderator] • InviteReviewers [Producer] • Prepare materials [Producer] • Distribute materials to Reviewers [Producer]
2. Preparation • 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 • comments and commenters • Reviewers contribute comments • Producer attends, but remains silent unless asked a question
Moderating the Session • Don't go too fast -- may miss things • Don't go too slow • 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 • 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 • how many people participated • when the meeting took place, and for how long • how many issues were found (may be categorized) • Detailed results are sent to participants • all issues with annotations • action items
5. Rework • 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
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"
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
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
Sample Categories • Major -- require investigation • Minor -- may not need immediate attention • Cosmetic -- optional improvements
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
Why Do Inspections Work? • Preparation • reviewers find things that authors miss • Peer pressure • forces developers to work harder • Formal process • forces developers and reviewers to do a thorough job
Costs of Inspection • Time spent in preparation • Time spent in meeting • Overhead of scheduling meeting
How Could We Improve Inspections? (Some Ideas) • Reduce number of reviewers • Reduce time spent in meeting • Hold meeting asynchronously • Hold meeting via the web • What are the pros and cons to each of these?