Code Review
Code Review
Code Review
Code Review
Exercise Session
1
Reviews
• Review: examination of (software) artifacts, in
order to find mistakes and improve the quality
of the artifact
2
Purpose of code reviews
• Ensure that code has sufficient quality to be
released / committed
– Review formatting / documentation of code
– Review code correctness and efficiency
3
Why review?
• Reviewing is effective to find mistakes
4
Effectiveness of Reviews
• Inspection of design & code [Fagan 1976]
– 67% - 82% of all faults were found by inspections
– 25% time saved on programmer resources (despite inspections)
• [Fagan 1986]
– 93% of all faults were found by inspections
5
How to review?
Many different approaches, e.g.
• Personal review
– Author reviews her own code Not objective,
but available to every developer
• Over-the-shoulder
– Other developer looks „over the shoulder“ of the
code author; read / discuss code together
6
How to review?
Many different approaches (continued)
• Walkthroughs
– Scheduled meeting, chaired by a moderator
– Participants prepare for the meeting in advance
– Author presents and provides information
• Advantage: author knows the code best
• Disadvantage: author might feel attacked personally; tries to defend
the code
9
Best practices
• Use checklists for authors and reviewers
– Helps to limit discussion and focus on important aspects
11
Summary
• Very effective techniques to ensure higher
quality of code (and other software artifacts)
12
Sources
Slides based on material from:
• G. Engels; Slides: Software Quality Assurance – Chapter V; University of Paderborn;
2008; http://is.uni-paderborn.de/fachgebiete/fg-engels/lehre/ss08/software-
quality-assurance/lecture-notes.html
• SmartBear Software; White Paper; 11 Best Practices for Peer Code Review;
http://www.smartbear.com/PDF/11_Best_Practices_for_Peer_Code_Review.pdf
13