how to get the most out of code reviews

30
HOW TO STOP WASTING YOUR TIME AND START PERFORMING USEFUL CODE REVIEWS Maria Khalusova, JetBrains @mariakhalusova

Upload: javadayua

Post on 08-Apr-2017

363 views

Category:

Software


3 download

TRANSCRIPT

Page 1: How to get the most out of code reviews

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

CODE REVIEW

Page 3: How to get the most out of code reviews

https://twitter.com/pcweenies/status/649954658794913792

Page 4: How to get the most out of code reviews

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

WHERE TO START

Page 6: How to get the most out of code reviews

THE TEAM

• Communicate clearly.

• Listen to concerns.

• Cultivate code review culture.

Page 7: How to get the most out of code reviews
Page 8: How to get the most out of code reviews

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

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

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

MAKING CODE REVIEWS USEFUL

Page 12: How to get the most out of code reviews

AUTOMATE WHAT CAN BE AUTOMATED

• Tests

• Continuous Integration

• Static code analysis

• Spellchecker

• etc.

Page 13: How to get the most out of code reviews

Code review is not a place for coding style wars

Page 14: How to get the most out of code reviews

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

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

KNOW WHAT TO LOOK FOR

Page 17: How to get the most out of code reviews

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

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

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

PERFORMANCE

• Performance requirements

• Performance tests

• Unnecessary network calls

• Potential memory leaks

Page 21: How to get the most out of code reviews

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

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

HUMAN FACTOR

Page 24: How to get the most out of code reviews

https://twitter.com/msdevUK/status/644136657311113216

Page 25: How to get the most out of code reviews

https://twitter.com/ankitsadana1/status/651473349319766016

Page 26: How to get the most out of code reviews

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
Page 28: How to get the most out of code reviews

LEARN TO RECEIVE FEEDBACK

• Contain your immediate reaction

• Consider suggestions

• Ask followup questions

Page 29: How to get the most out of code reviews

IT DOESN’T HAVE TO BE ALL CRITICISM

PRAISE GOOD WORK

Page 30: How to get the most out of code reviews

THANK YOU!QUESTIONS?

[email protected]@mariakhalusova