Peer code review has proven to be the pinnacle of software quality assurance, but the top 10 best practices of peer code review are not what you'd think. These numbers do not lie.
2. 2@SmartBear @CollaboratorSB #CodeReview
1. Review Fewer Than 400 Lines Of
Code At A Time
• Reviewing 200-400 lines of code over
60 to 90 minutes, should yield 70-90%
defect discovery.
• Reading beyond 400 lines of code, the
ability to find defects diminishes
4. 4@SmartBear @CollaboratorSB #CodeReview
2. Aim For An Inspection Rate Of Less
Than 300-500 Lines Of Code Per Hour
Code reviews that happen in a
reasonable quantity and at a slower
pace for a limited amount of time
results in the most effective code
review.
6. 6@SmartBear @CollaboratorSB #CodeReview
3. Do Not Review For More Than
60 Minutes At A Time
• Performance starts dropping off after
about 60 minutes of work – reviewers
wear out and stop finding defects.
• Studies show that taking breaks
over a period of time can
improve the quality of work.
7. 7@SmartBear @CollaboratorSB #CodeReview
4. Authors Should Annotate Source
Code Before The Review Begin
• Annotations should be directed at other
reviewers to ease the process and provide
more depth in context.
• As an added benefit, the author will often find
additional errors before the peer review even
begins.
• More bugs found prior to peer review will yield
in lower defect density because fewer bugs
exist overall.
9. 9@SmartBear @CollaboratorSB #CodeReview
5. Set Quantifiable Goals & Capture
Metrics To Improve Processes
• Decide in advance the goals of the code
review process and how you will
effectively measure them.
• Include internal process metrics such
as inspection rate, defect rate, and
defect density.
10. 10@SmartBear @CollaboratorSB #CodeReview
6. Use A Checklist For Both Reviewers
& Authors
Checklists are the most effective way
to eliminate frequently made errors and
to combat the challenges of omission
finding.
11. 11@SmartBear @CollaboratorSB #CodeReview
7. Establish A Process For Fixing
Defects Found
To ensure that bugs get fixed, use a
collaborative code review tool that
allows reviewers to log bugs, discuss
them with the author and approve
changes.
12. 12@SmartBear @CollaboratorSB #CodeReview
8. Foster A Positive Code Review
Culture
• In order for peer code review to be
successful, it’s extremely important that
mangers create a culture of collaboration
and learning in peer review.
• Peer review also allows junior team
members to learn from senior
leaders and for even the most
experienced programmers to
break bad habits.
13. 13@SmartBear @CollaboratorSB #CodeReview
9. Embrace The Subconscious
Implications Of Peer Review
• "Spot checking" 20% to 33% of the code
resulted in lower defect density with minimal
time expenditure.
• Lessen the likelihood of the
“Big Brother” effect by using
metrics & reports to help
improve a developers work
14. 14@SmartBear @CollaboratorSB #CodeReview
10. Practice Lightweight Code Reviews
• To fully optimize your team´s time and to
effectively measure its results, a lightweight,
tool-assisted process is recommended.
• Lightweight code review
takes less than 20% the time
of formal reviews and finds
just as many bugs