SlideShare a Scribd company logo
1 of 30
Download to read offline
10 faulty
review
code
behaviors of
LEMi ORHAN ERGiN
co-founder @ craftbase
/lemiorhan
lemiorhanergin.com
@lemiorhan
LEMi ORHAN ERGiN
agile software craftsman
co-founder @ Craftbase
ex Sony, eBay/GittiGidiyor, ACM, iyzico
founder of Software Craftsmanship
Turkey Community
Benefits of Code Review
Benefits of Code Review
Better Code
Common Ownership Knowledge Sharing
Finding Defects
The whole team is fully responsible to
create a well-crafted software. If it means
to review every single line of code, then
the team reviews every line of code.
We learn how others design and
implement software. We see new ways of
coding, alternative solutions and know-
how about the domain.
Code becomes more optimized, cleaner
and better in both security and
performance. Since it is reviewed by
another brain, suggestions improve code.
Much far before the code goes to
production, we can notice bugs just by
reading the code. That is cheap, much
cheaper than expected.
Efficiency of Code Review
Techniques
mob programming
pair programming
pull requests
code review sessions
over the shoulder
code buddy
via review tools
HIGHER
LOWER
Prerequisites Opening Review Closing
4 STEPS OF
CODE REVIEWAND 10 FAULTY BEHAVIORS
1
no standards in the team
Discussing again and again on the same topics
Reviewing broken code
Writing comments does not change anything
Endless discussions, no conclusions
PREREQUISITES
1 make agreements in the team
Teams should own the process and improve it with retrospectives
Tests and CI Mechanism
Automated tests and CI mechanism should run before every PR
Standards
Agree on standards on conventions and process, and improve
it continuously
Responsibilities
Reviewers are responsible for the bugs, not the authors
Ownership
PREREQUISITES
2
ambiguous content to review
A big whale of code is waiting in the review
No information at commit messages or PR descriptions
Author comments required for clarification
Old comments are gone. Where are my comments?
OPENING
2OPENING
better PRs lead better reviews
Keep change set small
Big change sets distracts focus. Keep it small to complete in max 30 mins.
Better messages
Commit messages and PR descriptions should contain as much
information as it cold be, such as design decisions and test scenarios.
Review by yourself again
Statistics say that author review beforehand decreases the number of
defects dramatically and leads to cleaner code and safer review process
3
wrong reviewer selection
Waiting feedback from too many people
Always selecting the same people as the reviewer
Randomly selecting reviewers
Who the hell should I open my review to?
OPENING
3OPENING
make the review load bearable
Select max 2-3 reviewers
If you open to the whole team, expect to get feedback from
max 2 people.
Select from old authors
By using git-guilt script, you can find who touched the code
you worked in the past. Then you can open reviews to them.
Open reviews not to the same people
Remember that each review takes approx. 30 mins average. It
means it takes time. So show respect to people’s workload.
4
too late for asking for feedback
Opening to code review after merging back to source
Ask for review after 1 month work
Deadline has arrived but you haven’t opened PR yet
Code review branches in everywhere in git
OPENING
4OPENING
review before it’s merged and
the feature is ready
Open Pull Requests to automize reviews
PRs are the best way to gather feedback before the change set
is merged to source.
Use a branching model
Every branching model has its own dynamics for reviewing
code (Git-Flow, GitWeb Flow, Trunk based development, etc.)
Branching is evil, stay there short
When you create a branch, you go out of CI and can work with
no obligation to have a stable state. That’s evil. Know it.
PR
5
cannot understand
Having no tests. Cannot understand what code really does.
Not knowing where to look while reviewing.
Tons of syntactical feedback, but nothing from business logic.
I don’t know the code better than the author.
CODE REVIEW
what the change set is doing
make the review process

more structured
Have a checklist of topics to review
It is important to look at where to look in correct mindset.
Prepare a checklist of topics and review the code with each.
Write tests
Minds cannot compile or run the code. Without tests, code is
simply a puzzle to solve with our imagination.
Write description about the business
It would not be possible to have reviewers knowledgable
about the business as you are. Give information about the
business at PR descriptions and commit messages.
5CODE REVIEW
6
this is my code, my expertise
Looking just the change set during the review.
Not touching someone else’s code.
Improvement suggestions are never applied.
I know the code better than anyone. How dare you are?
CODE REVIEW
this is our code, our expertise
Review the whole section
Change sets cannot be separated from its code unit. We
should review both the change sets and its belonging unit.
Fix other’s code
Because there is nothing such as “other’s code”. Code belongs to
the team, not individuals. So fix whenever you notice a defect.
Apply suggestions now
If you get an improvement suggestion during code review, apply
them now. Of course nice to haves could wait a little bit longer:)
6CODE REVIEW
7
others are stupid
I know better than others. They code the legacy.
“This code is totally wrong. Haven’t you read the book?”
Women is not biologically suitable for programming.
Others try to destroy my reputation.
CODE REVIEW
trying to prove
leave your ego
and do not make it personal
Egoless Programming
Accept that you are not your code, you will make mistakes and
someone else will know more than you.
Be kind
Be gentle, keep tone positive. Be thankful. Point out good stuff.
No need for jokes, the words “always”, “never”, “mine”, “yours”.
Respect the legacy code
Keep in mind that many bad decisions were taken due to limitations
of the past. So respect them and try to understand conditions of the
past and reasons of the decisions.
7CODE REVIEW
8
not able to convince people
Writing lots of comments and getting no response.
I am sure I am right but I cannot convince my solution is better
We discuss but never conclude on my proposals
Hearing “this is how we do in this team”
CODE REVIEW
about our review comments
sell your ideas
like people sell products
Support your idea with arguments
Collect code snippets, links, tutorials, and any resource that can
give detailed explanation about your comment.
Make your idea feel like a better alternative
Never judge the decisions. Instead show your idea in all aspects
and make it feel like a better alternative solution.
Prefer discussions over comments
Still face to face communication is the best way to find the best
solution and improve.
8CODE REVIEW
9
people play dead
No time for code review due to work load
PRs stay open unmerged for too long
Asking a question but getting no response
Everyone asks feedback but no-one gives one
CODE REVIEW
when I create a PR and ask for feedback
no-one can play dead while
communicating face to face
Shout out loud if you need urgent feedback
If you need help and instant feedback from your teammates,
simply go and ask for it.
Make code review a ritual
In order to make code review a habit, make it a regular ritual, like
“the review hour” on the last hour of every work day.
Go and review code together
If you get no response from the author, do not wait. Just go to hem/
her and review code together.
9CODE REVIEW
10
premature closing
Merging the PR without reviewing due to deadline pressure
Merging after getting one acceptance
Merging even though the discussions are going on
Managers order to merge the unreviewed code
CLOSING
never merge an unfinished PR
Be principled, have standards
If a PR is not reviewed, it cannot be merged. If the review of a
PR is not finished, it cannot be merged. Stop.
Ask for immediate help
If your code stayed unreviewed for a while and the deadline
comes, ask from someone else for an immediate feedback.
10CLOSING
no standards in the team
ambiguous content
wrong reviewer selection
too late for asking for feedback
cannot understand what the change set is doing
this is my code, my expertise
trying to prove others are stupid
not able to convince people about our review comments
people play dead when I create a PR and ask for feedback
premature closing
1
2
3
4
5
6
7
8
9
10
10 FAULTY BEHAVIORS of CODE REVIEW
/lemiorhan
lemiorhanergin.com
@lemiorhanLEMi ORHAN ERGiN

More Related Content

What's hot

What's hot (20)

Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Powers of Brain
Powers of BrainPowers of Brain
Powers of Brain
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Ethereum
EthereumEthereum
Ethereum
 
on log messages
on log messageson log messages
on log messages
 
Cross platform app development with flutter
Cross platform app development with flutterCross platform app development with flutter
Cross platform app development with flutter
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git slides
Git slidesGit slides
Git slides
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git commands
Git commandsGit commands
Git commands
 
Jenkins Automation
Jenkins AutomationJenkins Automation
Jenkins Automation
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 

Similar to 10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018

Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)
David Stockton
 
성공적인코드리뷰 문화 사내 발표
성공적인코드리뷰 문화 사내 발표성공적인코드리뷰 문화 사내 발표
성공적인코드리뷰 문화 사내 발표
Byoenghan Baek
 
Working together
Working togetherWorking together
Working together
himaye
 
Code review
Code reviewCode review
Code review
Aleksey Solntsev
 

Similar to 10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018 (20)

How to successfully grow a code review culture
How to successfully grow a code review cultureHow to successfully grow a code review culture
How to successfully grow a code review culture
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Pairing w developers_stpconpics
Pairing w developers_stpconpicsPairing w developers_stpconpics
Pairing w developers_stpconpics
 
Peer review
Peer reviewPeer review
Peer review
 
Effective Peer Review
Effective Peer ReviewEffective Peer Review
Effective Peer Review
 
Are your interns reviewing code? Andrew Lavers, ConFoo Montreal 2020
Are your interns reviewing code? Andrew Lavers, ConFoo Montreal 2020Are your interns reviewing code? Andrew Lavers, ConFoo Montreal 2020
Are your interns reviewing code? Andrew Lavers, ConFoo Montreal 2020
 
Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)Increasing code quality with code reviews (poetry version)
Increasing code quality with code reviews (poetry version)
 
성공적인코드리뷰 문화 사내 발표
성공적인코드리뷰 문화 사내 발표성공적인코드리뷰 문화 사내 발표
성공적인코드리뷰 문화 사내 발표
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Clean Code Software Engineering
Clean Code Software Engineering Clean Code Software Engineering
Clean Code Software Engineering
 
Working together
Working togetherWorking together
Working together
 
Code review Effective - kwan
Code review  Effective - kwanCode review  Effective - kwan
Code review Effective - kwan
 
How to successfully grow a code review culture
How to successfullygrow a code review cultureHow to successfullygrow a code review culture
How to successfully grow a code review culture
 
What every developer can learn from startups
What every developer can learn from startupsWhat every developer can learn from startups
What every developer can learn from startups
 
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
 
Code Reviews: the Good, the Bad, and the Ugly
Code Reviews: the Good, the Bad, and the UglyCode Reviews: the Good, the Bad, and the Ugly
Code Reviews: the Good, the Bad, and the Ugly
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Level Up Your Python Code Reviews to Ship It Faster - WWCodeDigital - 2020
Level Up Your Python Code Reviews to Ship It Faster - WWCodeDigital - 2020Level Up Your Python Code Reviews to Ship It Faster - WWCodeDigital - 2020
Level Up Your Python Code Reviews to Ship It Faster - WWCodeDigital - 2020
 
Code review
Code reviewCode review
Code review
 
11 rules for programmer should live by
11 rules for programmer should live by11 rules for programmer should live by
11 rules for programmer should live by
 

More from Lemi Orhan Ergin

Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
Lemi Orhan Ergin
 

More from Lemi Orhan Ergin (20)

Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design SimpleClean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design Simple
 
Unwritten Manual for Pair Programming
Unwritten Manual for Pair ProgrammingUnwritten Manual for Pair Programming
Unwritten Manual for Pair Programming
 
Yeni Nesil Yazılım Kültürü: Daha İyi Profesyoneller, Daha Kaliteli Yazılım, D...
Yeni Nesil Yazılım Kültürü: Daha İyi Profesyoneller, Daha Kaliteli Yazılım, D...Yeni Nesil Yazılım Kültürü: Daha İyi Profesyoneller, Daha Kaliteli Yazılım, D...
Yeni Nesil Yazılım Kültürü: Daha İyi Profesyoneller, Daha Kaliteli Yazılım, D...
 
Irresponsible Disclosure: Short Handbook of an Ethical Developer
Irresponsible Disclosure: Short Handbook of an Ethical DeveloperIrresponsible Disclosure: Short Handbook of an Ethical Developer
Irresponsible Disclosure: Short Handbook of an Ethical Developer
 
Scrum Events and Artifacts in Action
Scrum Events and Artifacts in ActionScrum Events and Artifacts in Action
Scrum Events and Artifacts in Action
 
DevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to PracticeDevOps & Technical Agility: From Theory to Practice
DevOps & Technical Agility: From Theory to Practice
 
Fighting with Waste Driven Development - XP Days Ukraine 2017
Fighting with Waste Driven Development - XP Days Ukraine 2017Fighting with Waste Driven Development - XP Days Ukraine 2017
Fighting with Waste Driven Development - XP Days Ukraine 2017
 
Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017
 
Waste Driven Development - Agile Coaching Serbia Meetup
Waste Driven Development - Agile Coaching Serbia MeetupWaste Driven Development - Agile Coaching Serbia Meetup
Waste Driven Development - Agile Coaching Serbia Meetup
 
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
 
Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
Yazılım Geliştirme Kültürünün Kodları: Motivasyon, Teknik Mükemmellik ve İnov...
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017Clean Software Design - DevNot Summit Istanbul 2017
Clean Software Design - DevNot Summit Istanbul 2017
 
Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016Test Driven Design - GDG DevFest Istanbul 2016
Test Driven Design - GDG DevFest Istanbul 2016
 
Let The Elephants Leave The Room - Remove Waste in Software Development - Bos...
Let The Elephants Leave The Room - Remove Waste in Software Development - Bos...Let The Elephants Leave The Room - Remove Waste in Software Development - Bos...
Let The Elephants Leave The Room - Remove Waste in Software Development - Bos...
 
Happy Developer's Guide to the Galaxy: Thinking About Motivation of Developers
Happy Developer's Guide to the Galaxy: Thinking About Motivation of DevelopersHappy Developer's Guide to the Galaxy: Thinking About Motivation of Developers
Happy Developer's Guide to the Galaxy: Thinking About Motivation of Developers
 
Git - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi DeğilGit - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi Değil
 
Code Your Agility - Tips for Boosting Technical Agility in Your Organization
Code Your Agility - Tips for Boosting Technical Agility in Your OrganizationCode Your Agility - Tips for Boosting Technical Agility in Your Organization
Code Your Agility - Tips for Boosting Technical Agility in Your Organization
 
Lost in Motivation in an Agile World
Lost in Motivation in an Agile WorldLost in Motivation in an Agile World
Lost in Motivation in an Agile World
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018

  • 1. 10 faulty review code behaviors of LEMi ORHAN ERGiN co-founder @ craftbase
  • 2.
  • 3.
  • 4. /lemiorhan lemiorhanergin.com @lemiorhan LEMi ORHAN ERGiN agile software craftsman co-founder @ Craftbase ex Sony, eBay/GittiGidiyor, ACM, iyzico founder of Software Craftsmanship Turkey Community
  • 6. Benefits of Code Review Better Code Common Ownership Knowledge Sharing Finding Defects The whole team is fully responsible to create a well-crafted software. If it means to review every single line of code, then the team reviews every line of code. We learn how others design and implement software. We see new ways of coding, alternative solutions and know- how about the domain. Code becomes more optimized, cleaner and better in both security and performance. Since it is reviewed by another brain, suggestions improve code. Much far before the code goes to production, we can notice bugs just by reading the code. That is cheap, much cheaper than expected.
  • 7. Efficiency of Code Review Techniques mob programming pair programming pull requests code review sessions over the shoulder code buddy via review tools HIGHER LOWER
  • 8. Prerequisites Opening Review Closing 4 STEPS OF CODE REVIEWAND 10 FAULTY BEHAVIORS
  • 9. 1 no standards in the team Discussing again and again on the same topics Reviewing broken code Writing comments does not change anything Endless discussions, no conclusions PREREQUISITES
  • 10. 1 make agreements in the team Teams should own the process and improve it with retrospectives Tests and CI Mechanism Automated tests and CI mechanism should run before every PR Standards Agree on standards on conventions and process, and improve it continuously Responsibilities Reviewers are responsible for the bugs, not the authors Ownership PREREQUISITES
  • 11. 2 ambiguous content to review A big whale of code is waiting in the review No information at commit messages or PR descriptions Author comments required for clarification Old comments are gone. Where are my comments? OPENING
  • 12. 2OPENING better PRs lead better reviews Keep change set small Big change sets distracts focus. Keep it small to complete in max 30 mins. Better messages Commit messages and PR descriptions should contain as much information as it cold be, such as design decisions and test scenarios. Review by yourself again Statistics say that author review beforehand decreases the number of defects dramatically and leads to cleaner code and safer review process
  • 13. 3 wrong reviewer selection Waiting feedback from too many people Always selecting the same people as the reviewer Randomly selecting reviewers Who the hell should I open my review to? OPENING
  • 14. 3OPENING make the review load bearable Select max 2-3 reviewers If you open to the whole team, expect to get feedback from max 2 people. Select from old authors By using git-guilt script, you can find who touched the code you worked in the past. Then you can open reviews to them. Open reviews not to the same people Remember that each review takes approx. 30 mins average. It means it takes time. So show respect to people’s workload.
  • 15. 4 too late for asking for feedback Opening to code review after merging back to source Ask for review after 1 month work Deadline has arrived but you haven’t opened PR yet Code review branches in everywhere in git OPENING
  • 16. 4OPENING review before it’s merged and the feature is ready Open Pull Requests to automize reviews PRs are the best way to gather feedback before the change set is merged to source. Use a branching model Every branching model has its own dynamics for reviewing code (Git-Flow, GitWeb Flow, Trunk based development, etc.) Branching is evil, stay there short When you create a branch, you go out of CI and can work with no obligation to have a stable state. That’s evil. Know it. PR
  • 17. 5 cannot understand Having no tests. Cannot understand what code really does. Not knowing where to look while reviewing. Tons of syntactical feedback, but nothing from business logic. I don’t know the code better than the author. CODE REVIEW what the change set is doing
  • 18. make the review process
 more structured Have a checklist of topics to review It is important to look at where to look in correct mindset. Prepare a checklist of topics and review the code with each. Write tests Minds cannot compile or run the code. Without tests, code is simply a puzzle to solve with our imagination. Write description about the business It would not be possible to have reviewers knowledgable about the business as you are. Give information about the business at PR descriptions and commit messages. 5CODE REVIEW
  • 19. 6 this is my code, my expertise Looking just the change set during the review. Not touching someone else’s code. Improvement suggestions are never applied. I know the code better than anyone. How dare you are? CODE REVIEW
  • 20. this is our code, our expertise Review the whole section Change sets cannot be separated from its code unit. We should review both the change sets and its belonging unit. Fix other’s code Because there is nothing such as “other’s code”. Code belongs to the team, not individuals. So fix whenever you notice a defect. Apply suggestions now If you get an improvement suggestion during code review, apply them now. Of course nice to haves could wait a little bit longer:) 6CODE REVIEW
  • 21. 7 others are stupid I know better than others. They code the legacy. “This code is totally wrong. Haven’t you read the book?” Women is not biologically suitable for programming. Others try to destroy my reputation. CODE REVIEW trying to prove
  • 22. leave your ego and do not make it personal Egoless Programming Accept that you are not your code, you will make mistakes and someone else will know more than you. Be kind Be gentle, keep tone positive. Be thankful. Point out good stuff. No need for jokes, the words “always”, “never”, “mine”, “yours”. Respect the legacy code Keep in mind that many bad decisions were taken due to limitations of the past. So respect them and try to understand conditions of the past and reasons of the decisions. 7CODE REVIEW
  • 23. 8 not able to convince people Writing lots of comments and getting no response. I am sure I am right but I cannot convince my solution is better We discuss but never conclude on my proposals Hearing “this is how we do in this team” CODE REVIEW about our review comments
  • 24. sell your ideas like people sell products Support your idea with arguments Collect code snippets, links, tutorials, and any resource that can give detailed explanation about your comment. Make your idea feel like a better alternative Never judge the decisions. Instead show your idea in all aspects and make it feel like a better alternative solution. Prefer discussions over comments Still face to face communication is the best way to find the best solution and improve. 8CODE REVIEW
  • 25. 9 people play dead No time for code review due to work load PRs stay open unmerged for too long Asking a question but getting no response Everyone asks feedback but no-one gives one CODE REVIEW when I create a PR and ask for feedback
  • 26. no-one can play dead while communicating face to face Shout out loud if you need urgent feedback If you need help and instant feedback from your teammates, simply go and ask for it. Make code review a ritual In order to make code review a habit, make it a regular ritual, like “the review hour” on the last hour of every work day. Go and review code together If you get no response from the author, do not wait. Just go to hem/ her and review code together. 9CODE REVIEW
  • 27. 10 premature closing Merging the PR without reviewing due to deadline pressure Merging after getting one acceptance Merging even though the discussions are going on Managers order to merge the unreviewed code CLOSING
  • 28. never merge an unfinished PR Be principled, have standards If a PR is not reviewed, it cannot be merged. If the review of a PR is not finished, it cannot be merged. Stop. Ask for immediate help If your code stayed unreviewed for a while and the deadline comes, ask from someone else for an immediate feedback. 10CLOSING
  • 29. no standards in the team ambiguous content wrong reviewer selection too late for asking for feedback cannot understand what the change set is doing this is my code, my expertise trying to prove others are stupid not able to convince people about our review comments people play dead when I create a PR and ask for feedback premature closing 1 2 3 4 5 6 7 8 9 10 10 FAULTY BEHAVIORS of CODE REVIEW