SlideShare uma empresa Scribd logo
1 de 71
—
Trisha Gee (@trisha_gee)
Developer & Technical Advocate, JetBrains
Code Review
Best Practices
This code works
Having Opinions On Code Is An
Occupational Hazard
Having Opinions On Code Is An
Occupational Requirement
Are we harder on other people’s code
than our own?
What to look for in a code review
http://jb.gg/book/codereview
• Gateway Reviews
• Knowledge Sharing
• Early Design Feedback
Different workflows
https://blog.jetbrains.com/upsource/tag/code-review-workflows/
What should you look for when
reviewing code?
It Depends
My First Code Review
My job is to Find Problems
Anti-Pattern
Nit picking
Anti-Pattern
Design changes when the code works
Anti-Pattern
Inconsistent feedback
Anti-Pattern
The Ghost Reviewer
Anti-Pattern
Ping pong reviews
Developers hate code reviews
Code Reviews are a
Massive Waste of Time
1. Why?
Ensure code meets standards
Find bugs
Share knowledge
Check code is understandable
Ensure code does what it’s supposed to
Collaborate on design
Evolve application code
2. When?
• During implementation?
• When it’s ready to merge?
• After it’s been merged?
When do you review?
• When everyone agrees?
• When a gatekeeper agrees?
• When all comments are addressed?
When is the review complete?
3. Who?
Who reviews the code?
Who signs it off?
4. Where?
Pairing
Showing code to a colleague at a
computer
Mob reviewing in a conference room
Remote screen-sharing
In the IDE, checking out a commit or
branch
Using code review software
5. What?
1. Why
2. When
3. Who
4. Where
Requires you to know:
• Fit with the overall architecture
• SOLID principles, Domain Driven Design, Design Patterns or other paradigms of choice
• New code follows team’s current practices
• Code is in the right place
• Code reuse
• Over-engineering
• Readable code and tests
• Testing the right things
• Exception error messages
• Subtle bugs
• Security
• Regulatory requirements
• Performance
• Documentation and/or help files been updated
• Spelling, punctuation & grammar on user messages
What to look for
https://blog.jetbrains.com/upsource/tag/what-to-look-for/
Human reviewers should be doing what
cannot be automated
Understand the constraints
Why: Knowledge Sharing
Purpose isn’t to reject the code
Why: Knowledge Sharing
Focus is on how easy it is to understand
the code
When: At the end
Too late for design
When: At the end
Should have specific checks
6. How?
Automate Everything You Can
Submitting for review
Annotate your code
Submitting for review
Reviews should be small
Reviewing
Should be clear Who is reviewing
Reviewing
Respond in a timely fashion
Reviewing
Checklist of What to look for
Comments
Bear in mind Why, When and What
Comments
Be constructive
Comments
Be specific
Accept or Reject
Accept or Raise Concern
Next steps should be clear
Making changes
Respond in a timely fashion
Making changes
Respond to comments
Resolving
The goal is to accept the review
Resolving
Should be clear Who signs it off
Resolving
…and When
Have Clear Objectives
1. Why
2. When
3. Who
4. Where
5. What
6. How
Clarity Comes From Understanding
Not to prove how clever you are
The Goal Is To Ship The Code
http://bit.ly/CRGood

Mais conteúdo relacionado

Mais procurados

SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?Cigital
 
functional testing
functional testing functional testing
functional testing bharathanche
 
Testing concepts ppt
Testing concepts pptTesting concepts ppt
Testing concepts pptRathna Priya
 
Agile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User GroupAgile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User Groupsuwalki24.pl
 
Agile Testing Strategy
Agile Testing StrategyAgile Testing Strategy
Agile Testing Strategytharindakasun
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualityLarry Nung
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architectureThe Software House
 
Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual TestingDirecti Group
 
Software Quality Assurance
Software Quality Assurance Software Quality Assurance
Software Quality Assurance ShashankBajpai24
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
Software Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSoftware Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSyed Hassan Raza
 

Mais procurados (20)

SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?SAST vs. DAST: What’s the Best Method For Application Security Testing?
SAST vs. DAST: What’s the Best Method For Application Security Testing?
 
Introduction to Agile Testing
Introduction to Agile TestingIntroduction to Agile Testing
Introduction to Agile Testing
 
Testing fundamentals
Testing fundamentalsTesting fundamentals
Testing fundamentals
 
Code Review
Code ReviewCode Review
Code Review
 
functional testing
functional testing functional testing
functional testing
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Testing concepts ppt
Testing concepts pptTesting concepts ppt
Testing concepts ppt
 
Agile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User GroupAgile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User Group
 
Agile Testing Strategy
Agile Testing StrategyAgile Testing Strategy
Agile Testing Strategy
 
DevSecOps
DevSecOpsDevSecOps
DevSecOps
 
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code QualitySonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
 
Test Strategy
Test StrategyTest Strategy
Test Strategy
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
 
Track code quality with SonarQube
Track code quality with SonarQubeTrack code quality with SonarQube
Track code quality with SonarQube
 
Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual Testing
 
Software Quality Assurance
Software Quality Assurance Software Quality Assurance
Software Quality Assurance
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
Manual testing ppt
Manual testing pptManual testing ppt
Manual testing ppt
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Software Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s GuideSoftware Testing Life Cycle – A Beginner’s Guide
Software Testing Life Cycle – A Beginner’s Guide
 

Semelhante a Code Review Best Practices

Automated Code Reviews with AI and ML - DevOps Next
Automated Code Reviews with AI and ML - DevOps NextAutomated Code Reviews with AI and ML - DevOps Next
Automated Code Reviews with AI and ML - DevOps NextPerfecto by Perforce
 
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdf
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdfcode_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdf
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdfsarah david
 
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptx
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptxcode_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptx
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptxsarah david
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Maven Logix
 
Code review best practice
Code review best practiceCode review best practice
Code review best practiceOren Digmi
 
Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and MannersTrisha Gee
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviewsnextbuild
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionJosh Gough
 
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 sucksPeter Gfader
 
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 DevelopmentShawn Jones
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and WhenPaul Gower
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoftMichaela Greiler
 
Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0The Linux Foundation
 
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 201810 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018Lemi Orhan Ergin
 

Semelhante a Code Review Best Practices (20)

Effective Code Review
Effective Code ReviewEffective Code Review
Effective Code Review
 
Automated Code Reviews with AI and ML - DevOps Next
Automated Code Reviews with AI and ML - DevOps NextAutomated Code Reviews with AI and ML - DevOps Next
Automated Code Reviews with AI and ML - DevOps Next
 
Code review at large scale
Code review at large scaleCode review at large scale
Code review at large scale
 
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdf
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdfcode_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdf
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pdf
 
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptx
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptxcode_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptx
code_review_checklist_6_actions_to_improve_the_quality_of_your_reviews.pptx
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
Code review best practice
Code review best practiceCode review best practice
Code review best practice
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and Manners
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
 
Code Reviews
Code ReviewsCode Reviews
Code Reviews
 
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
 
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
 
Peer review
Peer reviewPeer review
Peer review
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoft
 
Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0
 
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 201810 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
 

Mais de Trisha Gee

Career Advice for Architects
Career Advice for Architects Career Advice for Architects
Career Advice for Architects Trisha Gee
 
Is boilerplate code really so bad?
Is boilerplate code really so bad?Is boilerplate code really so bad?
Is boilerplate code really so bad?Trisha Gee
 
Career Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET LondonCareer Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET LondonTrisha Gee
 
Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?Trisha Gee
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarTrisha Gee
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9Trisha Gee
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9Trisha Gee
 
Career Advice for Programmers
Career Advice for Programmers Career Advice for Programmers
Career Advice for Programmers Trisha Gee
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9Trisha Gee
 
Becoming fully buzzword compliant
Becoming fully buzzword compliantBecoming fully buzzword compliant
Becoming fully buzzword compliantTrisha Gee
 
Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Trisha Gee
 
Java 9 Functionality and Tooling
Java 9 Functionality and ToolingJava 9 Functionality and Tooling
Java 9 Functionality and ToolingTrisha Gee
 
Java 8 and 9 in Anger
Java 8 and 9 in AngerJava 8 and 9 in Anger
Java 8 and 9 in AngerTrisha Gee
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Trisha Gee
 
Migrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from EclipseMigrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from EclipseTrisha Gee
 
Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)Trisha Gee
 
Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)Trisha Gee
 
Staying Ahead of the Curve
Staying Ahead of the CurveStaying Ahead of the Curve
Staying Ahead of the CurveTrisha Gee
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated TestsTrisha Gee
 
Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Trisha Gee
 

Mais de Trisha Gee (20)

Career Advice for Architects
Career Advice for Architects Career Advice for Architects
Career Advice for Architects
 
Is boilerplate code really so bad?
Is boilerplate code really so bad?Is boilerplate code really so bad?
Is boilerplate code really so bad?
 
Career Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET LondonCareer Advice for Programmers - ProgNET London
Career Advice for Programmers - ProgNET London
 
Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?Is Boilerplate Code Really So Bad?
Is Boilerplate Code Really So Bad?
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains Webinar
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Career Advice for Programmers
Career Advice for Programmers Career Advice for Programmers
Career Advice for Programmers
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Becoming fully buzzword compliant
Becoming fully buzzword compliantBecoming fully buzzword compliant
Becoming fully buzzword compliant
 
Real World Java 9 (QCon London)
Real World Java 9 (QCon London)Real World Java 9 (QCon London)
Real World Java 9 (QCon London)
 
Java 9 Functionality and Tooling
Java 9 Functionality and ToolingJava 9 Functionality and Tooling
Java 9 Functionality and Tooling
 
Java 8 and 9 in Anger
Java 8 and 9 in AngerJava 8 and 9 in Anger
Java 8 and 9 in Anger
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)
 
Migrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from EclipseMigrating to IntelliJ IDEA from Eclipse
Migrating to IntelliJ IDEA from Eclipse
 
Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (QCon New York)
 
Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)Refactoring to Java 8 (Devoxx UK)
Refactoring to Java 8 (Devoxx UK)
 
Staying Ahead of the Curve
Staying Ahead of the CurveStaying Ahead of the Curve
Staying Ahead of the Curve
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)Java 8 in Anger (JavaOne)
Java 8 in Anger (JavaOne)
 

Último

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Code Review Best Practices

Notas do Editor

  1. argh my eyes
  2. And it’s tested. And performance doesn’t really matter
  3. I think we’re harder on code when we read it than when we write it Reading code is hard We could use some guidelines and ideas
  4. This is what people automatically think of And this is the first blog post I was asked to write for Upsource
  5. In fact, turned out to be such a big topic that I wrote a whole series of blog posts, that got turned into a book The more I looked into it the more I realised that this was impossible. No-one could list everything that needs to be checked, no code could pass every check
  6. The real answer is, it depends One size does not fit all
  7. STORY: Code Review at UBS - Didn’t know what I should be looking for - Took it as my opportunity to forward my own ideas (e.g. unit testing, clean code)
  8. Can be solved with automation
  9. Understand when the review happens
  10. Inconsistent between reviewers, but even from the same reviewer Happens when there’s no guidelines or goals
  11. Because reviewing code is hard and boring And because we generally don’t get rewarded for reviewing code
  12. No understanding of what “Done” looks like I could go on but that is not this talk
  13. As an author you’re already in a place of vulnerability And as a reviewer it just break your flow and it’s hard to read code you didn’t write. - Stops code going into production - Code doesn't necessarily get better - We don’t get better Code reviews massive waste of time
  14. Which is why everyone focuses on telling you how important it is to do them, instead of how to do them well
  15. Couldn’t this be automated? What are the standards?
  16. Much can be automated but mission critical systems obviously benefit from human reviewers as well Look for gotchas: people experienced in the codebase can see if someone’s doing something that seems right but will have unintended consequences If your code is clean and easy to reason about, if you have good automated tests, you should need to spend very little time on this
  17. To increase the bus factor
  18. Not necessarily the same Here one or more people check the code to see if it could theoretically be understood by others
  19. Can’t be automated
  20. To evolve the code together
  21. Could use code reviews to enforce cleaning of tech debt as you go, or migrating a legacy system. Rules like: - Cleaning the method you’re in - addressing any warnings (or suppressed warnings) for this code - also may need rules about what’s committed and how (e.g. formatting changes / warnings changes are a separate commit) You can’t automate any of this!
  22. This depends upon the goals
  23. When we’re so bored we give up?
  24. Who reviews the code? Who’s responsible for signing off? Is a single “no” a veto, or is there another process?
  25. Is it the same people every time? A set of experts? Or a rotating pool? Do people have areas of expertise? Assignment can be automatic based on: - who’s the author - which code was touched - which branch was touched Watchers vs reviewers
  26. One person? A committee? Is it all or nothing? Or a veto system? How are deadlocks resolved?
  27. Where the team is located and where the reviewers are located impacts your code review process And where you do the code review
  28. My favourite
  29. If you’re located in the same office Forces you to be nice
  30. Forces input from many Forces resolution of deadlock?
  31. Via skype or slack or hangouts Don’t have to be collocated but have to have overlapping timezones
  32. Can be fully async, works for remote and unfriendly timezones
  33. Also includes GitHub pull requests Also fully async
  34. To look for in a code review We can only identify this once we know the answers to the other questions And it shouldn’t be a wishlist of everything
  35. For example, if the code is related to Orders, is it in the Order Service? If so, should it be refactored to a more reusable pattern, or is this acceptable at this stage? How does the team balance considerations of reusability with YAGNI? Are confusing sections of code either documented, commented, or covered by understandable tests (according to team preference)? Is the code going to accidentally point at the test database, or is there a hardcoded stub that should be swapped out for a real service?
  36. System constraints: - Internal systems hosted on safe hardware don’t need the same level of security checks - Web applications don’t need (the same) low latency performance - If you do have regulatory requirements these should be worked into the code review (or automated) – e.g. audit
  37. Checking design needs to be factored into the process some other way Like up front design Or a whiteboarding session
  38. There shouldn’t be any surprises
  39. Formatting checks, applying formatting The build Testing - Unit, integration, end to end, performance, security Deployment
  40. Use due dates if possible
  41. And priority Aligned with code review goals and constraints MOSCOW - Must Should Could Would
  42. Why are we doing this code review When is it being done What are we looking for
  43. Be nice. If you’re nice, the author is more likely to listen Comments should relate to the code, not the author Can also leave praise
  44. What actions need to be taken What priority are they (labels, colours)
  45. What actions need to be taken What priority are they (labels, colours)
  46. Concerns listed and prioritised Can’t reject without comments MOSCOW When you know Why, When, Who, Where, What it should be clear whether it’s accepted or not And what the next steps are
  47. Minimise cognitive load/context switching Prioritised feedback should make this easier And always respond to questions as fast as you can (even if it’s I’ll get back to you) – don’t be the ghost reviewer
  48. And resolve answered discussions
  49. Resolve as fast as possible. The goal is to accept the code, not to make it wait in line
  50. Who decides when the code is good to go? All reviewers or some? Any power of veto
  51. If next steps / actions were clear, if priorities were clear, it should be easy to understand when the review is good to go
  52. Objectives = consistency Objectives means fewer surprises, greater consistency Also can lead to code that meets those requirements before entering review
  53. You can’t have sensible answers to any of these without knowing why first Only when you’ve answered the first 4 can you sensibly know what to look for and create guidelines on how to do the code review. If you have no control over the code review process but don’t know the asnwers to these questions, ask someone.
  54. Does it do what it’s supposed to do? Is there anything horribly wrong with it? Does adding this feature/fixing this bug add more value than any debt introduced by maintaining this code?