SlideShare a Scribd company logo
THE ART OF GIVING AND
RECEIVING CODE REVIEWS
Alex Hill (Imperial College London)
alex.hill@gmail.com
@alexhillphd
Defect finding
● In a software-maintenance organization, 55% of
one-line maintenance changes were in error
before code reviews were introduced. After
reviews were introduced, only 2% of the changes
were in error.
● In a group of 11 programs developed by the same
group of people, the first 5 were developed
without reviews. The remaining 6 were developed
with reviews. After all the programs were released
to production, the first 5 had an average of 4.5
errors per 100 lines of code. The 6 that had been
inspected had an average of only 0.82 errors per
100. Reviews cut the errors by over 80%.
● A study of an organization at AT&T with more than
200 people reported a 90% decrease in defects
after the organization introduced reviews.
Further motivation
1. Learning opportunities
2. Future proofing:
● Increase your bus factor
● Increase your Hawaii factor
● Ensure code is readable
● Maintain code standards
Increase your bus factor
Review < 400 lines of code at a time
Defect density = number of defects found per
1000 lines of code.
Source: Cisco review study, https://www.ibm.com/developerworks/rational/library/11-proven-
practices-for-peer-review/
Review < 500 lines of code per hour
Source: Cisco review study, https://www.ibm.com/developerworks/rational/library/11-proven-
practices-for-peer-review/
Defect density = number of defects found per
1000 lines of code.
Use checklists
Are there unit tests?
Does it follow SOLID principles?
Do you understand it?
Are there integration tests?
Use checklists
Code reviews as dialogue
Source: https://m.xkcd.com/1833/
Understanding defensiveness
http://ragegenerator.com/pages/comic/sql-code-reviews
Minimising unneccessary conflict
● Have clear code conventions
● Automate wherever possible:
– Use a linter
– Unit tests
– Continuous integration
● Author reviews first
Conflict resolution styles
Lower defensiveness
Raise ego
As an organisation we can...
● Pair program
● Discuss tasks prior to implementation
● Never silo codebases
● Emphasize teamwork
● Evaluate the code, not the coder
● Use ‘we’ instead of ‘you’
e.g. “You should have re-used this function” →“We could re-use this function”
● Say ‘thank you’
● Raise code by a grade or 2, no more
e.g. C → B+, B → A
● Ask questions
e.g. “We could re-use this function” → “Could we re-use this function?”
● Justify requests
e.g. “Rename this to `getReportsWithFormattedDate`” → “Could we rename
`getReports` to `getReportsWithFormattedDate`, to make it clear that the
dates will already be formatted when it returns?”
As a reviewer we can...
Give positive feedback!
• “This is a cool library you found”
• “This refactor makes a lot of sense”
• “This is really easy to read”
• “I didn’t know this function existed,
thanks for bringing it to my
attention!”
Source:
http://geekandpoke.typepad.com/geekandpoke/
2010/11/how-to-make-a-good-code-review.html
As an author we can...
● Practice the ‘as if’ technique
– How would I respond if I were grateful for the
feedback?
– How would I respond if I were <Role model>?
– How would I respond if this code was not mine?
● Say ‘thank you’
● Annotate your review first
● Solicit feedback with specific questions
● Optimise reviewer effectiveness
● Minimise unneccessary conflict
● Understand feelings of ownership
● Nudge towards collaboration
● Be nice to each other
Summary

More Related Content

What's hot

Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...
Anton Shapin
 
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
 
From manual to automation
From manual to automationFrom manual to automation
From manual to automation
Anton Shapin
 
How to get reviewers to block your changes
How to get reviewers to block your changesHow to get reviewers to block your changes
How to get reviewers to block your changes
kevintbenton
 
Javascript interview questions and answers
Javascript interview questions and answersJavascript interview questions and answers
Javascript interview questions and answers
FeedGoCode
 
TDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and JasmineTDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and Jasmine
Luis Sánchez Castellanos
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
XPDays
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
Jason Harmon
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
Anton Shapin
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
Mikalai Alimenkou
 
Writing Testable Code
Writing Testable CodeWriting Testable Code
Writing Testable Codejameshalsall
 
API Testing
API TestingAPI Testing
API Testing
Bikash Sharma
 
Win at life with unit testing
Win at life with unit testingWin at life with unit testing
Win at life with unit testing
markstory
 
API Testing: Answers to Your Top 3 Questions
API Testing: Answers to Your Top 3 QuestionsAPI Testing: Answers to Your Top 3 Questions
API Testing: Answers to Your Top 3 Questions
QASource
 
Making a Mock by Kelsey Shannahan
Making a Mock by Kelsey ShannahanMaking a Mock by Kelsey Shannahan
Making a Mock by Kelsey Shannahan
QA or the Highway
 
Agile Testing
Agile TestingAgile Testing
Agile Testing
Sargis Sargsyan
 
Diffy : Automatic Testing of Microservices @ Twitter
Diffy : Automatic Testing of Microservices @ TwitterDiffy : Automatic Testing of Microservices @ Twitter
Diffy : Automatic Testing of Microservices @ Twitter
Puneet Khanduri
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
JAXLondon2014
 
Avoiding test hell
Avoiding test hellAvoiding test hell
Avoiding test hell
Yun Ki Lee
 

What's hot (20)

Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...Visualization, storage and comparison results of performance testing by using...
Visualization, storage and comparison results of performance testing by using...
 
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
 
From manual to automation
From manual to automationFrom manual to automation
From manual to automation
 
How to get reviewers to block your changes
How to get reviewers to block your changesHow to get reviewers to block your changes
How to get reviewers to block your changes
 
Api testing
Api testingApi testing
Api testing
 
Javascript interview questions and answers
Javascript interview questions and answersJavascript interview questions and answers
Javascript interview questions and answers
 
TDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and JasmineTDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and Jasmine
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
 
Writing Testable Code
Writing Testable CodeWriting Testable Code
Writing Testable Code
 
API Testing
API TestingAPI Testing
API Testing
 
Win at life with unit testing
Win at life with unit testingWin at life with unit testing
Win at life with unit testing
 
API Testing: Answers to Your Top 3 Questions
API Testing: Answers to Your Top 3 QuestionsAPI Testing: Answers to Your Top 3 Questions
API Testing: Answers to Your Top 3 Questions
 
Making a Mock by Kelsey Shannahan
Making a Mock by Kelsey ShannahanMaking a Mock by Kelsey Shannahan
Making a Mock by Kelsey Shannahan
 
Agile Testing
Agile TestingAgile Testing
Agile Testing
 
Diffy : Automatic Testing of Microservices @ Twitter
Diffy : Automatic Testing of Microservices @ TwitterDiffy : Automatic Testing of Microservices @ Twitter
Diffy : Automatic Testing of Microservices @ Twitter
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
 
Avoiding test hell
Avoiding test hellAvoiding test hell
Avoiding test hell
 

Similar to The Art of Giving and Receiving Code Reviews

presentation.pdf
presentation.pdfpresentation.pdf
presentation.pdf
caa28steve
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
phildenoncourt
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
André Pitombeira
 
Let's review it: What designers can learn from (code) review
Let's review it: What designers can learn from (code) reviewLet's review it: What designers can learn from (code) review
Let's review it: What designers can learn from (code) review
Ida Aalen
 
Agile_SDLC_Node.js@Paypal_ppt
Agile_SDLC_Node.js@Paypal_pptAgile_SDLC_Node.js@Paypal_ppt
Agile_SDLC_Node.js@Paypal_pptHitesh Kumar
 
Agile Development | Agile Process Models
Agile Development | Agile Process ModelsAgile Development | Agile Process Models
Agile Development | Agile Process Models
Ahsan Rahim
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
Josh Gough
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - Implementation
Blue Elephant Consulting
 
Backward thinking design qa system for quality goals
Backward thinking   design qa system for quality goalsBackward thinking   design qa system for quality goals
Backward thinking design qa system for quality goals
gaoliang641
 
Agile testingandautomation
Agile testingandautomationAgile testingandautomation
Agile testingandautomation
jeisner
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
ikram_ahamed
 
ODSC East 2020 : Continuous_learning_systems
ODSC East 2020 : Continuous_learning_systemsODSC East 2020 : Continuous_learning_systems
ODSC East 2020 : Continuous_learning_systems
Anuj Gupta
 
5 reasons you'll love to hate Agile Development
5 reasons you'll love to hate Agile Development5 reasons you'll love to hate Agile Development
5 reasons you'll love to hate Agile Development
Arin Sime
 
Continuous Learning Systems: Building ML systems that learn from their mistakes
Continuous Learning Systems: Building ML systems that learn from their mistakesContinuous Learning Systems: Building ML systems that learn from their mistakes
Continuous Learning Systems: Building ML systems that learn from their mistakes
Anuj Gupta
 
Three Interviews About Static Code Analyzers
Three Interviews About Static Code AnalyzersThree Interviews About Static Code Analyzers
Three Interviews About Static Code Analyzers
Andrey Karpov
 
Preparing for Enterprise Continuous Delivery - 5 Critical Steps
Preparing for Enterprise Continuous Delivery - 5 Critical StepsPreparing for Enterprise Continuous Delivery - 5 Critical Steps
Preparing for Enterprise Continuous Delivery - 5 Critical Steps
XebiaLabs
 
Peer review
Peer reviewPeer review
Peer review
Charuta Joshi
 
Building Continuous Learning Systems
Building Continuous Learning SystemsBuilding Continuous Learning Systems
Building Continuous Learning Systems
Anuj Gupta
 
Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applicationsnadeembtech
 
agility_principles.ppt
agility_principles.pptagility_principles.ppt
agility_principles.ppt
AteeqaKokab1
 

Similar to The Art of Giving and Receiving Code Reviews (20)

presentation.pdf
presentation.pdfpresentation.pdf
presentation.pdf
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
 
Let's review it: What designers can learn from (code) review
Let's review it: What designers can learn from (code) reviewLet's review it: What designers can learn from (code) review
Let's review it: What designers can learn from (code) review
 
Agile_SDLC_Node.js@Paypal_ppt
Agile_SDLC_Node.js@Paypal_pptAgile_SDLC_Node.js@Paypal_ppt
Agile_SDLC_Node.js@Paypal_ppt
 
Agile Development | Agile Process Models
Agile Development | Agile Process ModelsAgile Development | Agile Process Models
Agile Development | Agile Process Models
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - Implementation
 
Backward thinking design qa system for quality goals
Backward thinking   design qa system for quality goalsBackward thinking   design qa system for quality goals
Backward thinking design qa system for quality goals
 
Agile testingandautomation
Agile testingandautomationAgile testingandautomation
Agile testingandautomation
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
ODSC East 2020 : Continuous_learning_systems
ODSC East 2020 : Continuous_learning_systemsODSC East 2020 : Continuous_learning_systems
ODSC East 2020 : Continuous_learning_systems
 
5 reasons you'll love to hate Agile Development
5 reasons you'll love to hate Agile Development5 reasons you'll love to hate Agile Development
5 reasons you'll love to hate Agile Development
 
Continuous Learning Systems: Building ML systems that learn from their mistakes
Continuous Learning Systems: Building ML systems that learn from their mistakesContinuous Learning Systems: Building ML systems that learn from their mistakes
Continuous Learning Systems: Building ML systems that learn from their mistakes
 
Three Interviews About Static Code Analyzers
Three Interviews About Static Code AnalyzersThree Interviews About Static Code Analyzers
Three Interviews About Static Code Analyzers
 
Preparing for Enterprise Continuous Delivery - 5 Critical Steps
Preparing for Enterprise Continuous Delivery - 5 Critical StepsPreparing for Enterprise Continuous Delivery - 5 Critical Steps
Preparing for Enterprise Continuous Delivery - 5 Critical Steps
 
Peer review
Peer reviewPeer review
Peer review
 
Building Continuous Learning Systems
Building Continuous Learning SystemsBuilding Continuous Learning Systems
Building Continuous Learning Systems
 
Quality metrics and angular js applications
Quality metrics and angular js applicationsQuality metrics and angular js applications
Quality metrics and angular js applications
 
agility_principles.ppt
agility_principles.pptagility_principles.ppt
agility_principles.ppt
 

Recently uploaded

Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

The Art of Giving and Receiving Code Reviews

  • 1. THE ART OF GIVING AND RECEIVING CODE REVIEWS Alex Hill (Imperial College London) alex.hill@gmail.com @alexhillphd
  • 2. Defect finding ● In a software-maintenance organization, 55% of one-line maintenance changes were in error before code reviews were introduced. After reviews were introduced, only 2% of the changes were in error. ● In a group of 11 programs developed by the same group of people, the first 5 were developed without reviews. The remaining 6 were developed with reviews. After all the programs were released to production, the first 5 had an average of 4.5 errors per 100 lines of code. The 6 that had been inspected had an average of only 0.82 errors per 100. Reviews cut the errors by over 80%. ● A study of an organization at AT&T with more than 200 people reported a 90% decrease in defects after the organization introduced reviews.
  • 3. Further motivation 1. Learning opportunities 2. Future proofing: ● Increase your bus factor ● Increase your Hawaii factor ● Ensure code is readable ● Maintain code standards Increase your bus factor
  • 4. Review < 400 lines of code at a time Defect density = number of defects found per 1000 lines of code. Source: Cisco review study, https://www.ibm.com/developerworks/rational/library/11-proven- practices-for-peer-review/
  • 5. Review < 500 lines of code per hour Source: Cisco review study, https://www.ibm.com/developerworks/rational/library/11-proven- practices-for-peer-review/ Defect density = number of defects found per 1000 lines of code.
  • 6. Use checklists Are there unit tests? Does it follow SOLID principles? Do you understand it? Are there integration tests?
  • 8. Code reviews as dialogue Source: https://m.xkcd.com/1833/
  • 9.
  • 11.
  • 12.
  • 13.
  • 15.
  • 16.
  • 17. Minimising unneccessary conflict ● Have clear code conventions ● Automate wherever possible: – Use a linter – Unit tests – Continuous integration ● Author reviews first
  • 20. As an organisation we can... ● Pair program ● Discuss tasks prior to implementation ● Never silo codebases ● Emphasize teamwork ● Evaluate the code, not the coder
  • 21. ● Use ‘we’ instead of ‘you’ e.g. “You should have re-used this function” →“We could re-use this function” ● Say ‘thank you’ ● Raise code by a grade or 2, no more e.g. C → B+, B → A ● Ask questions e.g. “We could re-use this function” → “Could we re-use this function?” ● Justify requests e.g. “Rename this to `getReportsWithFormattedDate`” → “Could we rename `getReports` to `getReportsWithFormattedDate`, to make it clear that the dates will already be formatted when it returns?” As a reviewer we can...
  • 22. Give positive feedback! • “This is a cool library you found” • “This refactor makes a lot of sense” • “This is really easy to read” • “I didn’t know this function existed, thanks for bringing it to my attention!” Source: http://geekandpoke.typepad.com/geekandpoke/ 2010/11/how-to-make-a-good-code-review.html
  • 23. As an author we can... ● Practice the ‘as if’ technique – How would I respond if I were grateful for the feedback? – How would I respond if I were <Role model>? – How would I respond if this code was not mine? ● Say ‘thank you’ ● Annotate your review first ● Solicit feedback with specific questions
  • 24. ● Optimise reviewer effectiveness ● Minimise unneccessary conflict ● Understand feelings of ownership ● Nudge towards collaboration ● Be nice to each other Summary