Assignment Each team should perform a code review Select a section of code Select your more difficult code sections Other members of the team and the instructor will be given copies of the code to review at least 48 hours ahead of time ID: 600808
Download Presentation The PPT/PDF document "Code Reviews" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Code Reviews
Assignment
Each team should perform a code review
Select
a section of code
Select
your more difficult code sections.
Other members of the team and the instructor will be given copies of the code to review at least 48 hours ahead of time.
The code review should last about 1 hour.
Don’t select too much code – about 300 lines is good Slide2
Code Reviews Objectives
Find bugs in the least costly manner
Ensure that coding standards are maintained
Train staff and disseminate knowledge of system implementation
Make sure code is readable and maintainableSlide3
Formal Inspection
All participants are given copies of the code to be reviewed before the review (usually a couple of days ahead of time)
The reviewers review the code before the meeting
The code author and other team members gather to review the code
The principal goal is to find bugs (defects), not fix themSlide4
Formal Inspections Roles
Moderator
Sets the pace
Arranges meeting and manages materials
Reports Results
Follows up
Author
Answers questions
Explains things that are unclear (and will obviously have to be changed.)Slide5
Formal Inspection Roles ContInued
Reviewer
Fellow programmer
Tester
High-level architect
Scribe
Records problems (the official record of the review)
Records action items
Management must be excluded from the meetingSlide6
How much Code should Be Reviewed in one Meeting?
Enough to consume about an hour’s time
Number of lines of code varies significantly with code complexitySlide7
Inspection Meeting
Someone other than the moderator or author reads or paraphrases the code
Reviewers make relevant comments as the code is read
Remember you are looking for bugs
Address the code – not the programmer
(“The code does” … rather than “You did…”)
“Egoless” is the goal, but seldom the reality
Reviewers don’t recommend fixesSlide8
Inspection Report
Issued within 24 hours of the meeting
Report is a record of what was found
“What was found” provides statistics for management on efficacy
What was found provides opportunity for follow-upSlide9
Reworks and Follow-up
Rework
The author fixes the defects
Follow-up
The moderator is responsible for seeing that the defects have been addressed, but it is up to the author to make decisions about what needs to be changed.
Review the code again
Review relevant sections only
No formal reviewSlide10
Third-Hour Meeting
Optional informal meeting in which reviewers discuss solutions. This meeting should only be held if the author requests it, or if there are significant urgent problems.Slide11
Alternatives
Over-the-shoulder Reviews
Author walks through code with one peer
Less formal
Less documentation/assurance of completion
No formal
followup
Email (pass-around) reviews
Not constrained to place/time
Can be difficult to track the conversation
Pair-Programming
Pairs can be too close to the code to see problems
May be more time-consuming/expensive
Can be combined with formal reviews