how to fail at code reviews in 5 lessons

18
www.octo.com - www.usievents.com 1 @mdomenjoud #NCrafts #CultureCode @mdomenjoud #NCrafts #CultureCode HOW TO FAIL AT CODE REVIEW IN FIVE LESSONS Michel DOMENJOUD

Upload: michel-domenjoud

Post on 23-Jan-2018

477 views

Category:

Software


2 download

TRANSCRIPT

Page 1: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 1@mdomenjoud #NCrafts #CultureCode@mdomenjoud #NCrafts #CultureCode

HOW TO FAIL AT CODE REVIEW

IN FIVE LESSONSMichel DOMENJOUD

Page 2: How to fail at code reviews in 5 lessons

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

Page 3: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 3@mdomenjoud #NCrafts #CultureCode

Code review?

Of course we all know about it!

Page 4: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 4@mdomenjoud #NCrafts #CultureCode

An effective team practice to provide feedback about code quality

Page 5: How to fail at code reviews in 5 lessons

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

Page 6: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 6@mdomenjoud #NCrafts #CultureCode

Proven effective for many years

Page 7: How to fail at code reviews in 5 lessons

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

Page 8: How to fail at code reviews in 5 lessons

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

Page 9: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 9@mdomenjoud #NCrafts #CultureCode

Peer Review

Pair programmingCollective Review

Page 10: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 10@mdomenjoud #NCrafts #CultureCode

Fail #1 : We still have bugs everywhere !

Page 11: How to fail at code reviews in 5 lessons

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 ?

Page 12: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 12@mdomenjoud #NCrafts #CultureCode

Fail #2 My team does not progress

Page 13: How to fail at code reviews in 5 lessons

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 ?

Page 14: How to fail at code reviews in 5 lessons

www.octo.com - www.usievents.com 14@mdomenjoud #NCrafts #CultureCode

Fail #3 : Reviews look like a wrestling match

Page 15: How to fail at code reviews in 5 lessons

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 ?

Page 16: How to fail at code reviews in 5 lessons

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

Page 17: How to fail at code reviews in 5 lessons

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.

Page 18: How to fail at code reviews in 5 lessons

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