how to get the most out of code reviews
TRANSCRIPT
![Page 1: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/1.jpg)
HOW TO STOP WASTING YOUR TIME AND START PERFORMING USEFUL CODE
REVIEWSMaria Khalusova, JetBrains
@mariakhalusova
![Page 2: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/2.jpg)
CODE REVIEW
![Page 3: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/3.jpg)
https://twitter.com/pcweenies/status/649954658794913792
![Page 4: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/4.jpg)
CONTENTS
• Smooth start
• Making code reviews useful
• What to look for in a code review
• Human factor
![Page 5: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/5.jpg)
WHERE TO START
![Page 6: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/6.jpg)
THE TEAM
• Communicate clearly.
• Listen to concerns.
• Cultivate code review culture.
![Page 7: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/7.jpg)
![Page 8: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/8.jpg)
PROCESS• Decide on the process
• Keep workflow simple
• Iterations are good
• Average of 2 reviewers
• Do reviews often
![Page 9: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/9.jpg)
NEW TOOL• Yes, you need a code review tool
• Find the right tool for you:
Fits in your environment
Supports chosen workflow
Meets your particular needs
Keeps you in the loop without spamming
![Page 10: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/10.jpg)
SUMMARY
• Have an open dialog with the team
• Have a good plan
• Find a tool
![Page 11: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/11.jpg)
MAKING CODE REVIEWS USEFUL
![Page 12: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/12.jpg)
AUTOMATE WHAT CAN BE AUTOMATED
• Tests
• Continuous Integration
• Static code analysis
• Spellchecker
• etc.
![Page 13: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/13.jpg)
Code review is not a place for coding style wars
![Page 14: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/14.jpg)
AS A CODE AUTHOR
• Review your own code
• Commit small changes
• Document your code
• Write meaningful commit message
![Page 15: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/15.jpg)
AS A REVIEWER
• Don’t delay the review
• Don’t spend too much time
• Apply your expertise
![Page 16: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/16.jpg)
KNOW WHAT TO LOOK FOR
![Page 17: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/17.jpg)
GENERAL AND BUSINESS LOGIC
• Correctness
• Coding errors
• Business logic and rules
• User-facing messages
![Page 18: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/18.jpg)
ARCHITECTURE AND DESIGN
• Is the code in the right place?
• Complexity
• Reusability
• Data structures
![Page 19: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/19.jpg)
READABILITY & MAINTAINABILITY
• Naming
• Readability
• Test coverage
• Documentation
Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.- John F. Woods (1991), Martin Golding (1994)
![Page 20: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/20.jpg)
PERFORMANCE
• Performance requirements
• Performance tests
• Unnecessary network calls
• Potential memory leaks
![Page 21: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/21.jpg)
SECURITY• Review potential problems
• Third party libraries
• Authentication
• Data encryption
• Proper management of passwords, encryption keys, etc.
• …
![Page 22: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/22.jpg)
SECURITY: USEFUL READ
• Common weakness enumeration: CWE.mitre.org
• OWASP.org
Code Review Guide Book v. 2.0 ALPHA
![Page 23: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/23.jpg)
HUMAN FACTOR
![Page 24: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/24.jpg)
https://twitter.com/msdevUK/status/644136657311113216
![Page 25: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/25.jpg)
https://twitter.com/ankitsadana1/status/651473349319766016
![Page 26: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/26.jpg)
LEARN TO GIVE FEEDBACK• Don’t be rude
• Don’t dictate, ask questions, engage in a discussion
• It’s ok to disagree and argue
• Do not teach
• Be sensitive to cultural differences
![Page 27: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/27.jpg)
![Page 28: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/28.jpg)
LEARN TO RECEIVE FEEDBACK
• Contain your immediate reaction
• Consider suggestions
• Ask followup questions
![Page 29: How to get the most out of code reviews](https://reader031.vdocuments.us/reader031/viewer/2022030307/58e8d7cb1a28abb3398b632f/html5/thumbnails/29.jpg)
IT DOESN’T HAVE TO BE ALL CRITICISM
PRAISE GOOD WORK