how to fail at code reviews in 5 lessons
TRANSCRIPT
www.octo.com - www.usievents.com 1@mdomenjoud #NCrafts #CultureCode@mdomenjoud #NCrafts #CultureCode
HOW TO FAIL AT CODE REVIEW
IN FIVE LESSONSMichel DOMENJOUD
www.octo.com - www.usievents.com 2@mdomenjoud #NCrafts #CultureCode
Développeur, in love with code since 2003.
Tech Lead – Coach Craft @OctoTechnology
@mdomenjoud #CultureCode
MICHEL DOMENJOUD
www.octo.com - www.usievents.com 3@mdomenjoud #NCrafts #CultureCode
Code review?
Of course we all know about it!
www.octo.com - www.usievents.com 4@mdomenjoud #NCrafts #CultureCode
An effective team practice to provide feedback about code quality
www.octo.com - www.usievents.com 5@mdomenjoud #NCrafts #CultureCode
Software Craftsmanship : essential practices
+ Continuous integration, Coding standards, Refactoring,
Design, etc.
Feedback
Clean Code AutomatedTesting
Test DrivenDevelopment
Code Review
www.octo.com - www.usievents.com 6@mdomenjoud #NCrafts #CultureCode
Proven effective for many years
www.octo.com - www.usievents.com 7@mdomenjoud #NCrafts #CultureCode
Proven effective for many years
http://sail.cs.queensu.ca/publications/pubs/msr2014-mcintosh.pdf
http://www.reviewtechnik.de/NationalSoftwareQualityExperiment.pdf
Objective : detect defects early
Up to 65% of detected defects
ROI of 4 to 11h of review → 4h of debug saved
www.octo.com - www.usievents.com 8@mdomenjoud #NCrafts #CultureCode
Proven effective for many years
Other substantial benefits
Shared coding standards
Reinforce collective code
ownership
Facilitate learning
Improve communication about
code
www.octo.com - www.usievents.com 9@mdomenjoud #NCrafts #CultureCode
Peer Review
Pair programmingCollective Review
www.octo.com - www.usievents.com 10@mdomenjoud #NCrafts #CultureCode
Fail #1 : We still have bugs everywhere !
www.octo.com - www.usievents.com 11@mdomenjoud #NCrafts #CultureCode
Go as fast as you
can !
Do not prepare
anything !
Do not ask how to
do it !
- Take your time, at a sustainable pace
- Ask for code review as soon as possible
- Prepare the review beforehand
- Share coding standards and checklists
- Train together
To miss defects And to detect them ?
www.octo.com - www.usievents.com 12@mdomenjoud #NCrafts #CultureCode
Fail #2 My team does not progress
www.octo.com - www.usievents.com 13@mdomenjoud #NCrafts #CultureCode
Do not speak to
each other !
Correct the defects
in place of the
author !
Do not write you
coding standards
- Talk with your teammates during reviews
- The author fixes the defects, using pair
programming if necessary
- Write your coding standards down
- Reevaluate them over time
Not to progress And to progress ?
www.octo.com - www.usievents.com 14@mdomenjoud #NCrafts #CultureCode
Fail #3 : Reviews look like a wrestling match
www.octo.com - www.usievents.com 15@mdomenjoud #NCrafts #CultureCode
Criticize people first
Always start a
debate or language
/ framework war !
To be sure to have a fight
- Criticize the code, not the developer
- Rely on Egoless Programming principles
- This is not the time
- Find compromises
- Pick a standard and write it down
And for a peaceful review ?
www.octo.com - www.usievents.com 16@mdomenjoud #NCrafts #CultureCode
Three complementary formats
Peer reviewPair
programming
Start a User Story,
Complex code,
Legacy code, debug,
Learning
Define coding standards
Critical code
New technologies
All the timeOn a
regular basisOn demand
For every code change
Collective
review
www.octo.com - www.usievents.com 17@mdomenjoud #NCrafts #CultureCode
5 lessons to be learned for successful reviews
1 – Take your time
Prepare the review beforehand
Sustainable pace (max 1h30 &
300 LoC at a time)
2 – Progress together
Talk with your teammates during
reviews
The author fixes the defects,
using pair programming if
necessary
3 – Use coding standards
Share standards and checklists
Reevaluate them over time
4 – Criticize the code, not the
developer
Egoless Programming principles
5 – Find the format(s) which fit
your team and adapt them.
www.octo.com - www.usievents.com 18@mdomenjoud #NCrafts #CultureCode
Culture CodeSoftware Craftsmanship : Better Places with Better Code
A collective book about Software
Craftsmanship’ culture and practices
(in French)
Freely available for download
http://blog.octo.com/tag/software-craftsmanship
http://www.octo.com/fr/publications/20-culture-code