SlideShare a Scribd company logo
Code Reviews
@ Quatico
Jan Wloka
Quatico Solutions AG
Code Reviews, again?
Why do we review code?
• Find bugs
• Transfer knowledge
• Lower project cost
• [ Hiring a candidate ]
How would you review?
• Branch —> Code —> Assign Pull Request!
• Create a feature branch
• Implement the feature
• Create a pull request
• Assign a reviewer
• Discuss (and add changes to)

pull request
• Approve and merge pull request
PR, really? You also
could…
• Code —> Push —> Assign Ticket!
• Implement the feature
• Commit with message
• Push changes
• Assign ticket w/ commits 

to review
Sure, but how do I review?
• Read the issue ticket: “the why”
• Checkout the code/branch
• Run the tests w/ coverage
• Check the console
• Review the change
What should I be reviewing?
•Change
• Complexity: Shape of change = complex
• Test Coverage
•Code
• Naming, Functionality, Control Structures, Error Handling
• Tricky things (Thread Safety, Resource Leaks, Timezones)
• No obvious things: Performance, Security
•Design
• Single Responsibility Principle (Implicit dependencies)
• Data lifecycle (Cache invalidation, Reentrancy)
•Everything else: Tests, Builds, Deployment scripts, Configurations
Whoa. We should make
checklist!
So, what’s hard about it?
• Process is more difficult than the result
• Discuss your code with your peers
• How to disagree?
• Don’t just agree on the issue —> Silent Commitment.
• No fear of conflict —> Be curious!
• Agree to disagree —> Ask and learn.
• Form a strong code review culture!
Okay, but what
can I do?
Authors: Provide Context!
• What problems are we solving?
• Pull Request / Commit message:
• Add 2 paragraphs of context.
• Annotate source code.
• Describe changes, defending reasons and
methods.
• Re-think and explain every change.
Background: Prepare
your code.
SmartBear Study
300 reviews,
about 15%
random samples
Guidelines for Authors
• The primary reviewer is the
author, i.e. YOU.
• Review your own code
BEFORE commit.
• Create a checklist for
yourself.
• You are not your code.
Good code is…
Reviewers: Ask don’t tell
• What have you learned?
• Critique the code, instead of people
• Ask questions, rather than make statements
• “What do you think …”
• “Did you consider …”
• “Can you clarify …”
• Avoid ‘why’ questions, be more specific!
• Don’t forget to praise.
Background: How many
LOCs to review?
Defect density
dramatically decreases
when the number of
lines of inspection
goes above 200, and
is almost zero after 400.
Background:
Inspection rate
If you don’t spend
enough time, you
won't
find many defects.
Faster than
400-500 LOC/hour
results in severe
drop-off
in effectiveness.
Guidelines for Reviewers
• Review fewer than 400
LOC at a time.
• Aim for less than 500
LOC / hour.
• Take your time, but quit
after 60mins.
• Establish quantifiable
goals. Capture metrics.
Goal: Structured
feedback
• Must Haves: “How to get your approval”
• Customer facing incompleteness and inconsistencies
• Obvious bugs, and everything on the checklist
• Nice To Haves: “How to improve the code base”
• New design flaws, or known code smells
• Reduced test coverage, performance
• Everything you can live with, but don’t want to
• Superhero Deeds: “How to show love to your team”
• What are your peers working on? Can you help?
• Extra test data, mocks, anything done easily that helps.
We all make mistakes, but…
• Verify that defects are actually
fixed!
• Managers foster good code
reviews.
• ‘Big Brother Effect’ versus

‘Ego Effect’.
• Authors never merge own Pull
Requests.
• Tech leads aren’t gatekeepers.
Next Steps
• Authors: “Provide more context”
• Favour pull requests, over direct commits.
• Annotate your change, explain the ‘why’
• Maintain a personal checklist.
• Review every modification, before push.
• Reviewers: “Provide structured feedback”
• Critique the code, not the coder.
• Use the checklist.
• Be specific, and helpful.
• Don’t forget to praise.
Goal: Strong Review
Culture
• Better code.
• Better developers.
• Team ownership > Code ownership.
• Healthy debate > No silent agreement.
Thank You.
jan.wloka@quatico.com
@crashtester
References
• Best Practices for Code Reviews

http://www.smartbear.com/docs/
BestPracticesForPeerCodeReview.pdf
• The Ten Commandments of
Egoless Programming

http://www.codinghorror.com/blog/2006/05/the-
ten-commandments-of-egoless-programming.html
• Effective Code Reviews Without
the Pain

http://www.developer.com/java/other/article.php/
3579756
Thanks to geek-and-poke.com & commadot.com

More Related Content

What's hot

Clean Code Talk (draft)
Clean Code Talk (draft)Clean Code Talk (draft)
Clean Code Talk (draft)
Daniel Deutsch, LL.M. (WU)
 
The importance of testing in a web design & build project
The importance of testing in a web design & build projectThe importance of testing in a web design & build project
The importance of testing in a web design & build project
Building Blocks
 
An Overview of automated testing (1)
An Overview of automated testing (1)An Overview of automated testing (1)
An Overview of automated testing (1)Rodrigo Lopes
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolatorMaslowB
 
Style guide driven development
Style guide driven developmentStyle guide driven development
Style guide driven development
Arvid Torset
 
Practical TDD Demonstrated
Practical TDD DemonstratedPractical TDD Demonstrated
Practical TDD Demonstrated
Alan Christensen
 
Points.com fisheye crucible code reviews 2011
Points.com fisheye crucible code reviews 2011Points.com fisheye crucible code reviews 2011
Points.com fisheye crucible code reviews 2011
pointstechgeeks
 
TDD In Practice
TDD In PracticeTDD In Practice
TDD In Practice
Alan Christensen
 
Crucible
CrucibleCrucible
Crucible
Brian Repko
 
Code reviews
Code reviewsCode reviews
Code reviews
Robert Lee
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
Benjamin Baumann
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
Trisha Gee
 

What's hot (12)

Clean Code Talk (draft)
Clean Code Talk (draft)Clean Code Talk (draft)
Clean Code Talk (draft)
 
The importance of testing in a web design & build project
The importance of testing in a web design & build projectThe importance of testing in a web design & build project
The importance of testing in a web design & build project
 
An Overview of automated testing (1)
An Overview of automated testing (1)An Overview of automated testing (1)
An Overview of automated testing (1)
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
 
Style guide driven development
Style guide driven developmentStyle guide driven development
Style guide driven development
 
Practical TDD Demonstrated
Practical TDD DemonstratedPractical TDD Demonstrated
Practical TDD Demonstrated
 
Points.com fisheye crucible code reviews 2011
Points.com fisheye crucible code reviews 2011Points.com fisheye crucible code reviews 2011
Points.com fisheye crucible code reviews 2011
 
TDD In Practice
TDD In PracticeTDD In Practice
TDD In Practice
 
Crucible
CrucibleCrucible
Crucible
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 

Similar to Code Reviews @ Quatico

A Second Set Of Eyes: Getting The Most From Code Reviews
A Second Set Of Eyes: Getting The Most From Code ReviewsA Second Set Of Eyes: Getting The Most From Code Reviews
A Second Set Of Eyes: Getting The Most From Code Reviews
Ben McCormick
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
nextbuild
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
.NET Conf UY
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
Shawn Jones
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
Camille Bell
 
Tdd
TddTdd
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
Steven Smith
 
Code Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and reviewCode Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and review
Simon Price
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) review
Ida Aalen
 
You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
Peter Gfader
 
"How do I Architect?" - Quick Introduction to Architecture for Salesforce Ad...
"How do I Architect?"  - Quick Introduction to Architecture for Salesforce Ad..."How do I Architect?"  - Quick Introduction to Architecture for Salesforce Ad...
"How do I Architect?" - Quick Introduction to Architecture for Salesforce Ad...
Steven Herod
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx
AmalEldhose2
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascript
Michael Yagudaev
 
Hindsight lessons about API testing
Hindsight lessons about API testingHindsight lessons about API testing
Hindsight lessons about API testing
Viktor Slavchev
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016
Steven Smith
 
Testable requirements
Testable requirementsTestable requirements
Testable requirements
Wyn B. Van Devanter
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
FreekDB
 
2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview
Arnaud Héritier
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements
Bharti Rupani
 
An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
Blue Elephant Consulting
 

Similar to Code Reviews @ Quatico (20)

A Second Set Of Eyes: Getting The Most From Code Reviews
A Second Set Of Eyes: Getting The Most From Code ReviewsA Second Set Of Eyes: Getting The Most From Code Reviews
A Second Set Of Eyes: Getting The Most From Code Reviews
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
 
Tdd
TddTdd
Tdd
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
 
Code Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and reviewCode Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and review
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) review
 
You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
 
"How do I Architect?" - Quick Introduction to Architecture for Salesforce Ad...
"How do I Architect?"  - Quick Introduction to Architecture for Salesforce Ad..."How do I Architect?"  - Quick Introduction to Architecture for Salesforce Ad...
"How do I Architect?" - Quick Introduction to Architecture for Salesforce Ad...
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascript
 
Hindsight lessons about API testing
Hindsight lessons about API testingHindsight lessons about API testing
Hindsight lessons about API testing
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016
 
Testable requirements
Testable requirementsTestable requirements
Testable requirements
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
 
2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview2014 August - eXo Software Factory Overview
2014 August - eXo Software Factory Overview
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements
 
An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 

Code Reviews @ Quatico

  • 1. Code Reviews @ Quatico Jan Wloka Quatico Solutions AG
  • 3. Why do we review code? • Find bugs • Transfer knowledge • Lower project cost • [ Hiring a candidate ]
  • 4. How would you review? • Branch —> Code —> Assign Pull Request! • Create a feature branch • Implement the feature • Create a pull request • Assign a reviewer • Discuss (and add changes to)
 pull request • Approve and merge pull request
  • 5. PR, really? You also could… • Code —> Push —> Assign Ticket! • Implement the feature • Commit with message • Push changes • Assign ticket w/ commits 
 to review
  • 6. Sure, but how do I review? • Read the issue ticket: “the why” • Checkout the code/branch • Run the tests w/ coverage • Check the console • Review the change
  • 7. What should I be reviewing? •Change • Complexity: Shape of change = complex • Test Coverage •Code • Naming, Functionality, Control Structures, Error Handling • Tricky things (Thread Safety, Resource Leaks, Timezones) • No obvious things: Performance, Security •Design • Single Responsibility Principle (Implicit dependencies) • Data lifecycle (Cache invalidation, Reentrancy) •Everything else: Tests, Builds, Deployment scripts, Configurations
  • 8. Whoa. We should make checklist!
  • 9. So, what’s hard about it? • Process is more difficult than the result • Discuss your code with your peers • How to disagree? • Don’t just agree on the issue —> Silent Commitment. • No fear of conflict —> Be curious! • Agree to disagree —> Ask and learn. • Form a strong code review culture!
  • 11. Authors: Provide Context! • What problems are we solving? • Pull Request / Commit message: • Add 2 paragraphs of context. • Annotate source code. • Describe changes, defending reasons and methods. • Re-think and explain every change.
  • 12. Background: Prepare your code. SmartBear Study 300 reviews, about 15% random samples
  • 13. Guidelines for Authors • The primary reviewer is the author, i.e. YOU. • Review your own code BEFORE commit. • Create a checklist for yourself. • You are not your code. Good code is…
  • 14. Reviewers: Ask don’t tell • What have you learned? • Critique the code, instead of people • Ask questions, rather than make statements • “What do you think …” • “Did you consider …” • “Can you clarify …” • Avoid ‘why’ questions, be more specific! • Don’t forget to praise.
  • 15. Background: How many LOCs to review? Defect density dramatically decreases when the number of lines of inspection goes above 200, and is almost zero after 400.
  • 16. Background: Inspection rate If you don’t spend enough time, you won't find many defects. Faster than 400-500 LOC/hour results in severe drop-off in effectiveness.
  • 17. Guidelines for Reviewers • Review fewer than 400 LOC at a time. • Aim for less than 500 LOC / hour. • Take your time, but quit after 60mins. • Establish quantifiable goals. Capture metrics.
  • 18. Goal: Structured feedback • Must Haves: “How to get your approval” • Customer facing incompleteness and inconsistencies • Obvious bugs, and everything on the checklist • Nice To Haves: “How to improve the code base” • New design flaws, or known code smells • Reduced test coverage, performance • Everything you can live with, but don’t want to • Superhero Deeds: “How to show love to your team” • What are your peers working on? Can you help? • Extra test data, mocks, anything done easily that helps.
  • 19. We all make mistakes, but… • Verify that defects are actually fixed! • Managers foster good code reviews. • ‘Big Brother Effect’ versus
 ‘Ego Effect’. • Authors never merge own Pull Requests. • Tech leads aren’t gatekeepers.
  • 20. Next Steps • Authors: “Provide more context” • Favour pull requests, over direct commits. • Annotate your change, explain the ‘why’ • Maintain a personal checklist. • Review every modification, before push. • Reviewers: “Provide structured feedback” • Critique the code, not the coder. • Use the checklist. • Be specific, and helpful. • Don’t forget to praise.
  • 21. Goal: Strong Review Culture • Better code. • Better developers. • Team ownership > Code ownership. • Healthy debate > No silent agreement.
  • 23. References • Best Practices for Code Reviews
 http://www.smartbear.com/docs/ BestPracticesForPeerCodeReview.pdf • The Ten Commandments of Egoless Programming
 http://www.codinghorror.com/blog/2006/05/the- ten-commandments-of-egoless-programming.html • Effective Code Reviews Without the Pain
 http://www.developer.com/java/other/article.php/ 3579756 Thanks to geek-and-poke.com & commadot.com