SlideShare a Scribd company logo
CODE
REVIEWS
Do’s and Don’ts
@raphaelawrede
We believe that by reviewing code,
the overall quality of software gets improved.
THE PAST
➤ < 10 years ago
➤ no good tooling
➤ not yet established as good
practice
TODAY
➤ tooling is very good
➤ established good practice
➤ Everybody does it!
CODE REVIEWS ARE NOT A DISTRACTION
FROM OUR JOB.
THEY ARE OUR JOB.
CODE REVIEWS ARE OFTEN
DYSFUNCTIONAL
➤ done inefficiently
➤ can even cause harm
WHAT IS WRONG?
➤ We concentrate on the wrong things.
➤ Technical part of the problem.
➤ We are not empathetic.
➤ Psychological part of the problem.
➤ The human factor involved.
WHAT IS WRONG?
➤ We concentrate on the wrong things.
➤ Technical part of the problem.
➤ We are not empathetic.
➤ Psychological part of the problem.
➤ The human factor involved.
WE CONCENTRATE ON THE WRONG THINGS
Which are:
➤ Syntax and coding styles
➤ discuss once and then move to the linter & automate
➤ Things that are matter to personal taste
➤ and are not severe code smells
WE CONCENTRATE ON THE WRONG THINGS
➤ We tend to do “bikeshedding discussions”
➤ You get 50 comments on a small change but none on a
large pull request.
➤ Low complexity => high amount of discussion
➤ Parkinson’s Law
Code reviews
Code reviews
Code reviews
BUT WHAT IS IMPORTANT?
MOST IMPORTANT:
CONCENTRATE ON EVERYTHING
THAT MAKES THE CODE HARD TO BE
CHANGED IN THE FUTURE.
WHAT IS IMPORTANT?
But what makes code hard to change?
➤ Too big things & too many things
➤ Concentrate on the size of things.
➤ Do one thing at a time = Single Responsibility Principle
WHAT IS IMPORTANT?
But what makes code hard to change?
➤ Dependencies
➤ One object changes, other objects need to change too.
➤ Dependencies in tests
➤ The tests break with every change, though the overall
functionality is not broken at all.
MORE ABOUT DEPENDENCIES AND SOFTWARE DESIGN
“Most of these dependencies are usually
unnecessary. They are a side effect of
our coding style.”
- Sandi Metz
WHAT PRACTICAL THINGS
CAN WE DO NOW?
… while we continuously improve our OOP design skills…
WHAT CAN WE DO NOW?
1. Define a code review checklist with your team.
➤ Start the discussion
➤ What is important in your special case, in your team
setup, in your project?
CHECKLIST OF THE PAYMENT TEAM @BABBEL
WHAT CAN WE DO NOW?
2. Define a very simple rule set that declares hard upper
boundaries for the size of things
➤ Classes <= 100 LOC, methods <= 5 LOC …
➤ Better design as a side effect without having to understand
OO design.
WHAT CAN WE DO NOW?
Help others to get better!
3. Teach good software design
➤ Share your knowledge.
➤ Code reviews are not always the best way to teach.
WHAT IS WRONG?
➤ We concentrate on the wrong things.
➤ Technical part to the problem.
√linter, bikeshedding vs. things that matter, CR checklists & simple rules, teaching
➤ We are not empathetic.
➤ Psychological part of the problem.
➤ The human factor involved.
WHAT IS WRONG?
➤ We concentrate on the wrong things.
➤ Technical part to the problem.
√linter, bikeshedding vs. things that matter, CR checklists & simple rules, teaching
➤ We are not empathetic.
➤ Psychological part of the problem.
➤ The human factor involved.
WHY IS EMPATHY IMPORTANT FOR CODE REVIEWS?
➤ We are giving feedback on something the other person cares a
lot about.
➤ Giving good feedback involves a lot of empathy.
WHAT HAPPENS IF WE ARE NOT EMPATHETIC?
➤ People might not feel valued for their work.
➤ People might be intimidated.
➤ We hurt each other’s feelings.
➤ Fear and blame kills all creativity.
➤ People are afraid to ask questions and to ask for help.
➤ Long-term damage of the open communication culture
➤ CODE QUALITY WILL SUFFER ENORMOUSLY.
WHAT HAPPENS IF WE ARE NOT EMPATHETIC?
In the worst case:
➤ People might quit their jobs.
➤ Recruiting and on-boarding new people is expensive.
WE ARE NOT EMPATHETIC
There are two directions of empathy involved:
The code author The reviewer
Empathy for the reviewer
Empathy for the code author
WE ARE NOT EMPATHETIC
There are two directions of empathy involved:
The code author The reviewer
Empathy for the reviewer
Empathy for the code author
AS AN EMPATHETIC CODE AUTHOR, YOU WANT…
➤ to make the reviewer’s work enjoyable.
➤ to avoid frustration for the reviewer.
AS AN EMPATHETIC CODE AUTHOR, YOU KNOW THAT…
It is very important to give context.
➤ Choose a good PR title and description, add screenshots.
➤ Link to secondary material.
➤ Ask yourself:
➤ What might not be obvious for the reviewer?
➤ What did I try that didn’t work?
➤ Ask for specific feedback.
AS AN EMPATHETIC CODE AUTHOR…
In general:
➤ You make small, single-purpose commits
➤ You open PRs early. Try to get feedback early.
➤ You make small PRs.
➤ Reduce handovers by reviewing the code yourself before
➤ reduces 50 % of problems found later
WE ARE NOT EMPATHETIC
There are two directions of empathy involved:
The code author The reviewer
Empathy for the reviewer
Empathy for the code author
The code author..
➤ has put a lot of effort in the applied changes.
➤ might be very proud of what has just been achieved.
➤ cares a lot about his/her work.
➤ knows something that you don’t.
➤ You do not miss the chance to praise good work.
AS AN EMPATHETIC REVIEWER, YOU ASSUME THAT…
Code reviews
know that written communication can be tricky:
➤ It is easy to put people on the defensive.
➤ You prefer to ask for clarification
➤ instead of correcting people.
➤ You consider talking privately to the code author
➤ instead of posting a huge list of comments.
AS AN EMPATHETIC REVIEWER, YOU …
know that written communication can be tricky:
➤ You don’t use sarcasm.
➤ You are careful with humour, animated gifs, etc.
➤ You avoid hyperbole. (“always”, “never”, “endlessly”, “nothing”)
AS AN EMPATHETIC REVIEWER, YOU …
TIPS & TRICKS FOR WRITTEN COMMUNICATION
Examples of good communication:
Use empathetical words:
➤  “us”, “our” and “we” instead of “you”, “your” and “mine”
➤ “We might also be able to improve our importer by …”
Be humble:
➤ “I am not sure but … We can look it up.”
➤ “If I remember correctly…”
TIPS & TRICKS FOR WRITTEN COMMUNICATION
Examples of good communication:
➤ “What do you think about…?”
➤ “It might also be possible to … Did you consider that already?”
➤ “I didn’t understand completely … can you explain a bit more why..?”
TIPS & TRICKS FOR WRITTEN COMMUNICATION
Examples of bad communication:
Be careful with “Why” questions, they often sound accusatory:
➤ “Why didn't you … ?”
Avoid using commands:
➤ “Please, stop using …”
TIPS & TRICKS FOR WRITTEN COMMUNICATION
Examples of bad communication:
Don’t talk down to someone:
➤ “… seems like a poor solution for …”
➤ “I can’t really see why … The whole idea was...”
FINDING COMPROMISES
➤ Be aware that you will never agree on 100% of the changes.
➤ Accept that code is always only a bunch of tradeoffs.
➤ At some point, you have to ship. The discussion has to end.
➤ You can say:
➤ “That’s interesting. But can we keep it like this for now?”
➤ “You might be right in the future. But can we revisit later when we
know more?”
THANK YOU!
My twitter: @raphaelawrede
Protect your code review culture
and your healthy working environment!
MORE ON COMMUNICATION
MORE ABOUT CODE REVIEWS
➤ Book: Nonviolent Communication by Marshall B. Rosenberg
➤ https://www.amazon.de/Nonviolent-Communication-Language-Life-Guides/dp/189200528X
➤ Video: Implementing a Strong Code Review Culture
➤ https://www.youtube.com/watch?v=PJjmw9TRB7s
➤ Ruby Rogues Podcast: Code Review Culture with Derek Prior
➤ https://devchat.tv/ruby-rogues/216-rr-code-review-culture-with-derek-prior
➤ Blog post: Creating Your Code Review Checklist
➤ http://www.daedtech.com/creating-code-review-checklist/
➤ Blog post: On Empathy & Pull Requests
➤ https://slack.engineering/on-empathy-pull-requests-979e4257d158#.wokp23ee0
My twitter: @raphaelawrede
MORE ABOUT SOFTWARE DESIGN
➤ Book: “Practical Object-Oriented Design in Ruby” by Sandi Metz
➤ Examples written in Ruby
➤ Book: “99 Bottles of Beer” by Sandi Metz. Just released!
➤ Book “Growing Object-Oriented Software, Guided by Tests” by S. Freeman, N. Pryce
➤ Examples written in Java
➤ Video: “Rules” by Sandi Metz
➤ Learn how to define hard upper boundaries for the size of things
➤ https://www.youtube.com/watch?v=npOGOmkxuio
➤ Video: “The Magic Tricks of Testing” by Sandi Metz
➤ Learn how to correctly use stubs and mocks
➤ https://www.youtube.com/watch?v=URSWYvyc42M
➤ Refactoring talks by Katrina Owen
➤ Follow Sarah Mei on Twitter. Tweets on OO design topics.
➤ Uncle Bob Martin. Clean Coder.
➤ Level up your programming skills with Exercism.io
My twitter: @raphaelawrede

More Related Content

PDF
Dealing with contributor overload - FOSS Backstage
Holden Karau
 
PDF
PxS'12 - week 2 interviewing
hendrikknoche
 
PDF
A Cup of Tea With Michael Larsen
Michael Larsen
 
PPTX
How PBS Creates YouTube Series that Educate, Entertain & Inspire by Adam Dyle...
Hilary Ip
 
PDF
Is code review the solution?
Tiago Mendo
 
PDF
Code Review: Veni, ViDI, Vici (saner15)
Yuriy Tymchuk
 
PDF
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Atlassian
 
PDF
Effective code reviews
Sebastian Marek
 
Dealing with contributor overload - FOSS Backstage
Holden Karau
 
PxS'12 - week 2 interviewing
hendrikknoche
 
A Cup of Tea With Michael Larsen
Michael Larsen
 
How PBS Creates YouTube Series that Educate, Entertain & Inspire by Adam Dyle...
Hilary Ip
 
Is code review the solution?
Tiago Mendo
 
Code Review: Veni, ViDI, Vici (saner15)
Yuriy Tymchuk
 
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Atlassian
 
Effective code reviews
Sebastian Marek
 

Viewers also liked (18)

PDF
How to get the most out of code reviews
JavaDayUA
 
PDF
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Atlassian
 
PDF
Review your code like a Googler
Dariusz Łuksza
 
PDF
Code reviews
Juan Maiz
 
PDF
WordCamp US 2016 - Ryan Markel: Code Review
themarkel
 
PPT
Code Review
Ravi Raj
 
PPTX
Why attend IBM Amplify 2016
Sonia Baratas Alves
 
PDF
SNV_Laikipia _CS_Final_DigitalSpreads
Katherine Casey
 
PPTX
Prop list
AgatinoMediaStudies
 
PPTX
Inversiones basicas
Jhon Ferrer
 
PDF
Energy Efficient Cooling Systems.
Shamkant Mirashi
 
PDF
CV_summarized2
Rocio Gomez
 
PPTX
Scaling your code review
Sander Bol
 
PPTX
Git and Gerrit Code Review - Tech Talk - 2010_09_23
msohn
 
PDF
Increasing code quality with code reviews (poetry version)
David Stockton
 
KEY
Code Review: An apple a day
Kathryn Rotondo
 
PDF
On to code review lessons learned at microsoft
Michaela Greiler
 
PDF
Code Review Tool Evaluation
Kate Semizhon
 
How to get the most out of code reviews
JavaDayUA
 
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Atlassian
 
Review your code like a Googler
Dariusz Łuksza
 
Code reviews
Juan Maiz
 
WordCamp US 2016 - Ryan Markel: Code Review
themarkel
 
Code Review
Ravi Raj
 
Why attend IBM Amplify 2016
Sonia Baratas Alves
 
SNV_Laikipia _CS_Final_DigitalSpreads
Katherine Casey
 
Inversiones basicas
Jhon Ferrer
 
Energy Efficient Cooling Systems.
Shamkant Mirashi
 
CV_summarized2
Rocio Gomez
 
Scaling your code review
Sander Bol
 
Git and Gerrit Code Review - Tech Talk - 2010_09_23
msohn
 
Increasing code quality with code reviews (poetry version)
David Stockton
 
Code Review: An apple a day
Kathryn Rotondo
 
On to code review lessons learned at microsoft
Michaela Greiler
 
Code Review Tool Evaluation
Kate Semizhon
 
Ad

Similar to Code reviews (20)

PDF
Code Quality Makes Your Job Easier
Tonya Mork
 
PPTX
How to Successfully Write About Your Career Experience
Lanie Bernes
 
PDF
"The Great Technical Swindle" by Laurent Cerveau
TheFamily
 
PDF
Product Management: Wrangling People
Janet Brunckhorst
 
PDF
Keynote talk: How to stay in love with programming (with notes)
Camille Fournier
 
PDF
Nasdaq Pro/Design Masterclass at the Entrepreneurial Center
Chris Avore
 
PPTX
Working the right way, by knowing all the wrong ways
Boyan Djumakov
 
PDF
Responsive Discovery: The underpants of a great web project
Steve Fisher
 
PDF
PyGotham 2019 "To comment or not to comment?"
Veronica Hanus
 
PPTX
The Subtle Dynamics of Leading Without Authority as a Technical Lead - Oren E...
DevOpsDays Tel Aviv
 
PDF
Feedback loops between tooling and culture
Chris Winters
 
PDF
What Happens to Everyone, When Everyone Learns to Code - by Farrah Bostic at ...
The Difference Engine
 
PDF
Collaboration Techniques that really work
leisa reichelt
 
PPT
Arc Ready Q2 Blended Deck
Philip Wheat
 
PDF
Whydesignersfail fin
Shahid Mohammed
 
PPTX
Getting it Built
Andrew Gassen
 
PDF
How to ux writing ramona furter
Ramona Furter
 
PDF
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
Lemi Orhan Ergin
 
PDF
Ringling College of Art & Design: Content and Social Media
Autumn Sullivan
 
PDF
Discussing Design - ConvergeSE
Aaron Irizarry
 
Code Quality Makes Your Job Easier
Tonya Mork
 
How to Successfully Write About Your Career Experience
Lanie Bernes
 
"The Great Technical Swindle" by Laurent Cerveau
TheFamily
 
Product Management: Wrangling People
Janet Brunckhorst
 
Keynote talk: How to stay in love with programming (with notes)
Camille Fournier
 
Nasdaq Pro/Design Masterclass at the Entrepreneurial Center
Chris Avore
 
Working the right way, by knowing all the wrong ways
Boyan Djumakov
 
Responsive Discovery: The underpants of a great web project
Steve Fisher
 
PyGotham 2019 "To comment or not to comment?"
Veronica Hanus
 
The Subtle Dynamics of Leading Without Authority as a Technical Lead - Oren E...
DevOpsDays Tel Aviv
 
Feedback loops between tooling and culture
Chris Winters
 
What Happens to Everyone, When Everyone Learns to Code - by Farrah Bostic at ...
The Difference Engine
 
Collaboration Techniques that really work
leisa reichelt
 
Arc Ready Q2 Blended Deck
Philip Wheat
 
Whydesignersfail fin
Shahid Mohammed
 
Getting it Built
Andrew Gassen
 
How to ux writing ramona furter
Ramona Furter
 
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
Lemi Orhan Ergin
 
Ringling College of Art & Design: Content and Social Media
Autumn Sullivan
 
Discussing Design - ConvergeSE
Aaron Irizarry
 
Ad

More from UNICORNS IN TECH (20)

PDF
Sex, love and robots - Cate Lawrence
UNICORNS IN TECH
 
PDF
Recent political developments in Turkey and their influence onto tech and sci...
UNICORNS IN TECH
 
PPTX
#UNIT 2017: Cloud Computing
UNICORNS IN TECH
 
PPTX
From Strength in Diversity to Smart Nanoscale Technologies - David Smith
UNICORNS IN TECH
 
PPTX
#UNIT 2017: Brexit - Daniel Irvine
UNICORNS IN TECH
 
PPTX
An Invisible Woman - Lynn Conway
UNICORNS IN TECH
 
PPTX
Claudia Stuetzel - DOING IT DIFFERENTLY - A SHORT HISTORY OF PEOPLE REINVENTI...
UNICORNS IN TECH
 
PPTX
Jon maddog Hall - The History of Free and Open Source Culture
UNICORNS IN TECH
 
PDF
Automate the pain way - Pedro Proenca
UNICORNS IN TECH
 
PDF
8 PEOPLE, 4 SERVICES, 40 COUNTRIES - Wojciech Gaca
UNICORNS IN TECH
 
PPTX
THE LASERSAUR, OR HOW TO BUILD YOUR OWN GREAT LASER CUTTER
UNICORNS IN TECH
 
PDF
HOW SEMICONDUCTOR PHYSICS REVOLUTIONIZED SUSTAINABLE ELECTRICITY AND LIGHTING
UNICORNS IN TECH
 
PDF
Andra Bria_AI for more inclusive society
UNICORNS IN TECH
 
PDF
Designing culture @mimi - Eva-m zoll
UNICORNS IN TECH
 
PDF
Our journey to aws - Maylin Leal
UNICORNS IN TECH
 
PDF
Klaus Jäger_Development and future of (solar) energy technologies
UNICORNS IN TECH
 
PDF
Thinking with microservices
UNICORNS IN TECH
 
PDF
Trust is the answer - Thomas Keup
UNICORNS IN TECH
 
PDF
Wearables 101 - Tank Thunderbird
UNICORNS IN TECH
 
PDF
Recommender systems - Humberto Corona
UNICORNS IN TECH
 
Sex, love and robots - Cate Lawrence
UNICORNS IN TECH
 
Recent political developments in Turkey and their influence onto tech and sci...
UNICORNS IN TECH
 
#UNIT 2017: Cloud Computing
UNICORNS IN TECH
 
From Strength in Diversity to Smart Nanoscale Technologies - David Smith
UNICORNS IN TECH
 
#UNIT 2017: Brexit - Daniel Irvine
UNICORNS IN TECH
 
An Invisible Woman - Lynn Conway
UNICORNS IN TECH
 
Claudia Stuetzel - DOING IT DIFFERENTLY - A SHORT HISTORY OF PEOPLE REINVENTI...
UNICORNS IN TECH
 
Jon maddog Hall - The History of Free and Open Source Culture
UNICORNS IN TECH
 
Automate the pain way - Pedro Proenca
UNICORNS IN TECH
 
8 PEOPLE, 4 SERVICES, 40 COUNTRIES - Wojciech Gaca
UNICORNS IN TECH
 
THE LASERSAUR, OR HOW TO BUILD YOUR OWN GREAT LASER CUTTER
UNICORNS IN TECH
 
HOW SEMICONDUCTOR PHYSICS REVOLUTIONIZED SUSTAINABLE ELECTRICITY AND LIGHTING
UNICORNS IN TECH
 
Andra Bria_AI for more inclusive society
UNICORNS IN TECH
 
Designing culture @mimi - Eva-m zoll
UNICORNS IN TECH
 
Our journey to aws - Maylin Leal
UNICORNS IN TECH
 
Klaus Jäger_Development and future of (solar) energy technologies
UNICORNS IN TECH
 
Thinking with microservices
UNICORNS IN TECH
 
Trust is the answer - Thomas Keup
UNICORNS IN TECH
 
Wearables 101 - Tank Thunderbird
UNICORNS IN TECH
 
Recommender systems - Humberto Corona
UNICORNS IN TECH
 

Recently uploaded (20)

PDF
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PPTX
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PPTX
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PDF
Immersive experiences: what Pharo users do!
ESUG
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Odoo Integration Services by Candidroot Solutions
CandidRoot Solutions Private Limited
 
Exploring AI Agents in Process Industries
amoreira6
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
AI-Ready Handoff: Auto-Summaries & Draft Emails from MQL to Slack in One Flow
bbedford2
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Presentation about variables and constant.pptx
kr2589474
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Immersive experiences: what Pharo users do!
ESUG
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
Activate_Methodology_Summary presentatio
annapureddyn
 

Code reviews

  • 2. We believe that by reviewing code, the overall quality of software gets improved.
  • 3. THE PAST ➤ < 10 years ago ➤ no good tooling ➤ not yet established as good practice
  • 4. TODAY ➤ tooling is very good ➤ established good practice ➤ Everybody does it!
  • 5. CODE REVIEWS ARE NOT A DISTRACTION FROM OUR JOB. THEY ARE OUR JOB.
  • 6. CODE REVIEWS ARE OFTEN DYSFUNCTIONAL ➤ done inefficiently ➤ can even cause harm
  • 7. WHAT IS WRONG? ➤ We concentrate on the wrong things. ➤ Technical part of the problem. ➤ We are not empathetic. ➤ Psychological part of the problem. ➤ The human factor involved.
  • 8. WHAT IS WRONG? ➤ We concentrate on the wrong things. ➤ Technical part of the problem. ➤ We are not empathetic. ➤ Psychological part of the problem. ➤ The human factor involved.
  • 9. WE CONCENTRATE ON THE WRONG THINGS Which are: ➤ Syntax and coding styles ➤ discuss once and then move to the linter & automate ➤ Things that are matter to personal taste ➤ and are not severe code smells
  • 10. WE CONCENTRATE ON THE WRONG THINGS ➤ We tend to do “bikeshedding discussions” ➤ You get 50 comments on a small change but none on a large pull request. ➤ Low complexity => high amount of discussion ➤ Parkinson’s Law
  • 14. BUT WHAT IS IMPORTANT?
  • 15. MOST IMPORTANT: CONCENTRATE ON EVERYTHING THAT MAKES THE CODE HARD TO BE CHANGED IN THE FUTURE.
  • 16. WHAT IS IMPORTANT? But what makes code hard to change? ➤ Too big things & too many things ➤ Concentrate on the size of things. ➤ Do one thing at a time = Single Responsibility Principle
  • 17. WHAT IS IMPORTANT? But what makes code hard to change? ➤ Dependencies ➤ One object changes, other objects need to change too. ➤ Dependencies in tests ➤ The tests break with every change, though the overall functionality is not broken at all.
  • 18. MORE ABOUT DEPENDENCIES AND SOFTWARE DESIGN “Most of these dependencies are usually unnecessary. They are a side effect of our coding style.” - Sandi Metz
  • 19. WHAT PRACTICAL THINGS CAN WE DO NOW? … while we continuously improve our OOP design skills…
  • 20. WHAT CAN WE DO NOW? 1. Define a code review checklist with your team. ➤ Start the discussion ➤ What is important in your special case, in your team setup, in your project?
  • 21. CHECKLIST OF THE PAYMENT TEAM @BABBEL
  • 22. WHAT CAN WE DO NOW? 2. Define a very simple rule set that declares hard upper boundaries for the size of things ➤ Classes <= 100 LOC, methods <= 5 LOC … ➤ Better design as a side effect without having to understand OO design.
  • 23. WHAT CAN WE DO NOW? Help others to get better! 3. Teach good software design ➤ Share your knowledge. ➤ Code reviews are not always the best way to teach.
  • 24. WHAT IS WRONG? ➤ We concentrate on the wrong things. ➤ Technical part to the problem. √linter, bikeshedding vs. things that matter, CR checklists & simple rules, teaching ➤ We are not empathetic. ➤ Psychological part of the problem. ➤ The human factor involved.
  • 25. WHAT IS WRONG? ➤ We concentrate on the wrong things. ➤ Technical part to the problem. √linter, bikeshedding vs. things that matter, CR checklists & simple rules, teaching ➤ We are not empathetic. ➤ Psychological part of the problem. ➤ The human factor involved.
  • 26. WHY IS EMPATHY IMPORTANT FOR CODE REVIEWS? ➤ We are giving feedback on something the other person cares a lot about. ➤ Giving good feedback involves a lot of empathy.
  • 27. WHAT HAPPENS IF WE ARE NOT EMPATHETIC? ➤ People might not feel valued for their work. ➤ People might be intimidated. ➤ We hurt each other’s feelings. ➤ Fear and blame kills all creativity. ➤ People are afraid to ask questions and to ask for help. ➤ Long-term damage of the open communication culture ➤ CODE QUALITY WILL SUFFER ENORMOUSLY.
  • 28. WHAT HAPPENS IF WE ARE NOT EMPATHETIC? In the worst case: ➤ People might quit their jobs. ➤ Recruiting and on-boarding new people is expensive.
  • 29. WE ARE NOT EMPATHETIC There are two directions of empathy involved: The code author The reviewer Empathy for the reviewer Empathy for the code author
  • 30. WE ARE NOT EMPATHETIC There are two directions of empathy involved: The code author The reviewer Empathy for the reviewer Empathy for the code author
  • 31. AS AN EMPATHETIC CODE AUTHOR, YOU WANT… ➤ to make the reviewer’s work enjoyable. ➤ to avoid frustration for the reviewer.
  • 32. AS AN EMPATHETIC CODE AUTHOR, YOU KNOW THAT… It is very important to give context. ➤ Choose a good PR title and description, add screenshots. ➤ Link to secondary material. ➤ Ask yourself: ➤ What might not be obvious for the reviewer? ➤ What did I try that didn’t work? ➤ Ask for specific feedback.
  • 33. AS AN EMPATHETIC CODE AUTHOR… In general: ➤ You make small, single-purpose commits ➤ You open PRs early. Try to get feedback early. ➤ You make small PRs. ➤ Reduce handovers by reviewing the code yourself before ➤ reduces 50 % of problems found later
  • 34. WE ARE NOT EMPATHETIC There are two directions of empathy involved: The code author The reviewer Empathy for the reviewer Empathy for the code author
  • 35. The code author.. ➤ has put a lot of effort in the applied changes. ➤ might be very proud of what has just been achieved. ➤ cares a lot about his/her work. ➤ knows something that you don’t. ➤ You do not miss the chance to praise good work. AS AN EMPATHETIC REVIEWER, YOU ASSUME THAT…
  • 37. know that written communication can be tricky: ➤ It is easy to put people on the defensive. ➤ You prefer to ask for clarification ➤ instead of correcting people. ➤ You consider talking privately to the code author ➤ instead of posting a huge list of comments. AS AN EMPATHETIC REVIEWER, YOU …
  • 38. know that written communication can be tricky: ➤ You don’t use sarcasm. ➤ You are careful with humour, animated gifs, etc. ➤ You avoid hyperbole. (“always”, “never”, “endlessly”, “nothing”) AS AN EMPATHETIC REVIEWER, YOU …
  • 39. TIPS & TRICKS FOR WRITTEN COMMUNICATION Examples of good communication: Use empathetical words: ➤  “us”, “our” and “we” instead of “you”, “your” and “mine” ➤ “We might also be able to improve our importer by …” Be humble: ➤ “I am not sure but … We can look it up.” ➤ “If I remember correctly…”
  • 40. TIPS & TRICKS FOR WRITTEN COMMUNICATION Examples of good communication: ➤ “What do you think about…?” ➤ “It might also be possible to … Did you consider that already?” ➤ “I didn’t understand completely … can you explain a bit more why..?”
  • 41. TIPS & TRICKS FOR WRITTEN COMMUNICATION Examples of bad communication: Be careful with “Why” questions, they often sound accusatory: ➤ “Why didn't you … ?” Avoid using commands: ➤ “Please, stop using …”
  • 42. TIPS & TRICKS FOR WRITTEN COMMUNICATION Examples of bad communication: Don’t talk down to someone: ➤ “… seems like a poor solution for …” ➤ “I can’t really see why … The whole idea was...”
  • 43. FINDING COMPROMISES ➤ Be aware that you will never agree on 100% of the changes. ➤ Accept that code is always only a bunch of tradeoffs. ➤ At some point, you have to ship. The discussion has to end. ➤ You can say: ➤ “That’s interesting. But can we keep it like this for now?” ➤ “You might be right in the future. But can we revisit later when we know more?”
  • 44. THANK YOU! My twitter: @raphaelawrede Protect your code review culture and your healthy working environment!
  • 46. MORE ABOUT CODE REVIEWS ➤ Book: Nonviolent Communication by Marshall B. Rosenberg ➤ https://www.amazon.de/Nonviolent-Communication-Language-Life-Guides/dp/189200528X ➤ Video: Implementing a Strong Code Review Culture ➤ https://www.youtube.com/watch?v=PJjmw9TRB7s ➤ Ruby Rogues Podcast: Code Review Culture with Derek Prior ➤ https://devchat.tv/ruby-rogues/216-rr-code-review-culture-with-derek-prior ➤ Blog post: Creating Your Code Review Checklist ➤ http://www.daedtech.com/creating-code-review-checklist/ ➤ Blog post: On Empathy & Pull Requests ➤ https://slack.engineering/on-empathy-pull-requests-979e4257d158#.wokp23ee0 My twitter: @raphaelawrede
  • 47. MORE ABOUT SOFTWARE DESIGN ➤ Book: “Practical Object-Oriented Design in Ruby” by Sandi Metz ➤ Examples written in Ruby ➤ Book: “99 Bottles of Beer” by Sandi Metz. Just released! ➤ Book “Growing Object-Oriented Software, Guided by Tests” by S. Freeman, N. Pryce ➤ Examples written in Java ➤ Video: “Rules” by Sandi Metz ➤ Learn how to define hard upper boundaries for the size of things ➤ https://www.youtube.com/watch?v=npOGOmkxuio ➤ Video: “The Magic Tricks of Testing” by Sandi Metz ➤ Learn how to correctly use stubs and mocks ➤ https://www.youtube.com/watch?v=URSWYvyc42M ➤ Refactoring talks by Katrina Owen ➤ Follow Sarah Mei on Twitter. Tweets on OO design topics. ➤ Uncle Bob Martin. Clean Coder. ➤ Level up your programming skills with Exercism.io My twitter: @raphaelawrede