SlideShare uma empresa Scribd logo
1 de 33
Code Quality:
Code Review

{ By Avi Etzioni; }
Available on Youtube: http://youtu.be/NeV1tP1IfoM
Code Quality = #WTF/Min
Review – not only for code

Students

Politicians

Books
If only someone reviewed…
Agenda


Part 1 – Code Review – Who needs it?
Feedback
 Some numbers
 Why should I seek this feedback?
 Why should I review others work?
 Ok, but…




Part 2 – Guidelines for creating and reviewing
Part 1

Code Review – Who needs it?
Feedback is all around us
Design
Problem

IDE
Automatic
Tests
Build/Integrati
on

Symptom

Monitor

Take in
Some numbers…
Type of defects found in review



Functional



Non-functional / Maintainability issues



False positive
Distribution of defects
7%

21%

Maintainability
Functional
71%

False positive
Maintainability Distribution
10%
Documentation
35%
Structure

55%

Visual
Representation
Defect Reduction
• Pair Programming: 15%-50%
• Unit-Tests: 30%-60%:
• Increase in development time:
20%-30%
• Does not take into consideration
bugs found during the writing of
the tests
• Code review meeting: 45%-50%
• Asynchronous code-review: 60-65%
Why should I seek this feedback?
• Enforces better code inspection
• Unbiased set of eyes
• Find your problems sooner than
later
• Learn new stuff
• Teach the others
Why should I give this feedback?
• Improve code reading skills
• Learn new stuff
• Better understanding of the
code
• Common goal
• Let your voice be heard
What about the organization
• More capable employees
• Knowledge sharing
• Training for new team members

• Better quality of the product
• DISCUSSION
Ok, but…
Ok, but… It takes too much time
• What about Design? Graphitus?
Take in?
• Unit-tests
• Who checks them?
• It’s better to favor small reviews
• Maintainability issues can make adding
new functionality 28% slower and
fixing errors 36% slower *
*Bandi, Vaishnavi, Turk: Predicting Maintenance Performance Using OO Design Complexity metrics
Ok, but… I’m not familiar
with the code
Ok, but… I’m not familiar
with the code
Ok, but… It’s too subjective
• That’s true, but…
• Research shows 82% agreement
• Add more reviewers
• You don’t have to agree (just be nice
about it)
Ok, but… It’s a minor-change
Ok, but… I’m a Rockstar
7%

21%

Maintainability
Functional
71%

False positive

Remember This??
Part 2

General Guide Lines
Favor small reviews
• Reviewing a lot of code is a lot to process
• Might intimidate people from starting
the review
• Those who start, will probably not finish
• Think of logical ways to split the reviews
Explain yourself
• What have you done?
• High-level explanation
• Detailed explanation about non-trivial changes
• Testing Done:
• mvn [install ; test ; test –P integration]?
• Started the service?
• Ran APT?
• Simulated tests?
• Next Steps
Tie your ego to quality…
Not to your code
• Comply with standards
… But remember that style is a matter of taste

• Don’t criticize - advise
• Choose your battles
• Be polite
• Maybe I don’t understand everything, but…
• I would prefer...

• Nitpicking: …
And if you have nothing to say…
• Ship it!

• A good word never hurt anyone 
What to look for???
Start with searching for the obvious and easy wins
• Typos
• Commented code

• Wrong/missing description
• Trivial exceptions – NPE, OutOfBounds…
• Coding conventions
And continue with the not so obvious
• Similar (but not exactly duplicated) code
• Project structure

• Affected components / Tests that might break
• Hidden pitfalls / Bugs
• Security
• ADVANCED LEVEL: patch the code and run it!
How to start?
Thank you!
aetzioni@outbrain.com
Twitter: @AviEtzioni

Mais conteúdo relacionado

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Destaque

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Destaque (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Avi Etzioni on Code Review @Outbrain

  • 1. Code Quality: Code Review { By Avi Etzioni; } Available on Youtube: http://youtu.be/NeV1tP1IfoM
  • 2. Code Quality = #WTF/Min
  • 3. Review – not only for code Students Politicians Books
  • 4. If only someone reviewed…
  • 5. Agenda  Part 1 – Code Review – Who needs it? Feedback  Some numbers  Why should I seek this feedback?  Why should I review others work?  Ok, but…   Part 2 – Guidelines for creating and reviewing
  • 6. Part 1 Code Review – Who needs it?
  • 7.
  • 8. Feedback is all around us Design Problem IDE Automatic Tests Build/Integrati on Symptom Monitor Take in
  • 10. Type of defects found in review  Functional  Non-functional / Maintainability issues  False positive
  • 13. Defect Reduction • Pair Programming: 15%-50% • Unit-Tests: 30%-60%: • Increase in development time: 20%-30% • Does not take into consideration bugs found during the writing of the tests • Code review meeting: 45%-50% • Asynchronous code-review: 60-65%
  • 14. Why should I seek this feedback? • Enforces better code inspection • Unbiased set of eyes • Find your problems sooner than later • Learn new stuff • Teach the others
  • 15. Why should I give this feedback? • Improve code reading skills • Learn new stuff • Better understanding of the code • Common goal • Let your voice be heard
  • 16. What about the organization • More capable employees • Knowledge sharing • Training for new team members • Better quality of the product • DISCUSSION
  • 18. Ok, but… It takes too much time • What about Design? Graphitus? Take in? • Unit-tests • Who checks them? • It’s better to favor small reviews • Maintainability issues can make adding new functionality 28% slower and fixing errors 36% slower * *Bandi, Vaishnavi, Turk: Predicting Maintenance Performance Using OO Design Complexity metrics
  • 19. Ok, but… I’m not familiar with the code
  • 20. Ok, but… I’m not familiar with the code
  • 21. Ok, but… It’s too subjective • That’s true, but… • Research shows 82% agreement • Add more reviewers • You don’t have to agree (just be nice about it)
  • 22. Ok, but… It’s a minor-change
  • 23. Ok, but… I’m a Rockstar 7% 21% Maintainability Functional 71% False positive Remember This??
  • 25. Favor small reviews • Reviewing a lot of code is a lot to process • Might intimidate people from starting the review • Those who start, will probably not finish • Think of logical ways to split the reviews
  • 26. Explain yourself • What have you done? • High-level explanation • Detailed explanation about non-trivial changes • Testing Done: • mvn [install ; test ; test –P integration]? • Started the service? • Ran APT? • Simulated tests? • Next Steps
  • 27. Tie your ego to quality… Not to your code • Comply with standards … But remember that style is a matter of taste • Don’t criticize - advise • Choose your battles • Be polite • Maybe I don’t understand everything, but… • I would prefer... • Nitpicking: …
  • 28. And if you have nothing to say… • Ship it! • A good word never hurt anyone 
  • 29. What to look for???
  • 30. Start with searching for the obvious and easy wins • Typos • Commented code • Wrong/missing description • Trivial exceptions – NPE, OutOfBounds… • Coding conventions
  • 31. And continue with the not so obvious • Similar (but not exactly duplicated) code • Project structure • Affected components / Tests that might break • Hidden pitfalls / Bugs • Security • ADVANCED LEVEL: patch the code and run it!

Notas do Editor

  1. אז הסיבה שבחרתי לעשות את ההרצאה הזו היא התשוקה שלי לאיכות קודאני מאמין שכתיבה של קוד איכותי, עם סטנדרטים קבועים, דיזיין בריא היא חשובה לכל פרוייקט ובעיקר לפרוייקט בסדר גודל שלנו.אני מניח שלרוב האנשים אין צורך להסביר איך קוד איכותי מקצר תהליכי פיתוח, מאפשר להכניס מישהו חדש לעניינים מהר יותר ומונע באגים.חלק גדול ממה שחשוב באיכות קוד ניתן, לדעתי, למצוא ולשפר בזמן קוד ריויו
  2. בהכנה למצגת נזכרתי בתמונה המשעשעת הזאת שראיתי פעם.ההרצאה של היום לא תהיה כבדה, אני לא בא להטיף פה לאף אחד. רק בתקווה אצליח לשכנע גם אתכם כמה שקוד ריוויו זה דבר חשוב לשמירה על איכות הקוד ולייעול תהליכי פיתוח.
  3. אנחנו מופתעים כשבשלט חוצות לא עשו reviewלמה אנחנו מופתעים כשאנחנו נדרשים להציג את הקוד שלנו?
  4. אנחנו מופתעים כשבשלט חוצות לא עשו reviewלמה אנחנו מופתעים כשאנחנו נדרשים להציג את הקוד שלנו?
  5. אז זאת הייתה רק הקדמההחלק הראשון ידבר על קוד ריוויו בכללי – יתרונות והאני מאמין שליבחלק השני נדבר על תרבות של קוד ריוויו תוך שימוש בריוויו בורד
  6. אז לפני שאנחנו מדברים על איך עושים קוד ריוויו – בואו נתחיל בלמה?
  7. ביום הראשון לעבודה קיבלתי את הספר The lean startupהמטרה באג'ייל היא ללמוד ולהשתפר כל הזמן – continuous improvement
  8. כשרק הכותרת מופיעה - בואו ננסה למפות את הפידבקים החשובים בתהליך הפיתוח של פיצ'ראחרי שהצגנו את חלוקת הפידבקים - בחלקים הקריטיים אנחנו רוצים התערבות אנושית ולא מחשב שיעשה דיזיין והפקת לקחיםהמחשב לרוב מגלה לנו סימפטומים. אנשים מגלים לנו בעיותהאם שלב כתיבת הקוד לא מספיק חשוב בשביל לקבל מעט פידבק אנושי?
  9. Functional – Problems in the execution layerNon-functional – Especially things that will affect the maintainability of the code laterFalse-positive – The reviewer said something to be a defect and later turned out it wasn’t
  10. אוניברסיטת הלסינקי בדקה את פיזור הדפקטים שמתגלים במהלך ריוויו. השוו תוכניתנים מנוסים לתוכניתנים לא מנוסים – פיזור דומה מאוד.
  11. Structure – repeated code / Code that should be in a different place / Solution arrangement. It’s 52% Solution approach (different algorithm; use external lib, etc…) and 48% for organization (structure of the code; classes not in place, split method, etc…)Documentation – comments in code; Api documentation; Names of methods/variables/classesVisual representation – tabs/spaces
  12. Pair programming – Depends on the seniority and chemistry of codersWe need to remember that unit-tests are need to be maintained and debugged as well.Code review meetings might take too long and people tend to loose consentration
  13. הידיעה שהולכים להסתכל על הקוד שלך גורמת לך לעשות מעבר נוסף ולהשקיע בקודמי שעוד לא מבין מה קורה יבוא בצורה יותר ביקורתית )בגלל זה אני פחות אוהב ריוויו אחד על אחד(ככל שנעלה על באגים או על מבנה קוד בעייתי לתחזוקה מוקדם יותר, כך יהיה כל יותר לשנות בהמשך. מגינים על מי שיקרא את הקוד בהמשך, שזה הרבה פעמים אני העתידיתמיד יש מישהו שיוכל ללמד אותך משהו חדשעל ידי פירסום של שיטות העבודה שלך, אחרים יוכלו ללמוד בעצמם דרכים טובות יותר לבצע דברים ולשפר את עצמם
  14. כולנו צריכים לקרוא קוד בעבודה שלנו כשנכנסים לפיצ'ר חדשגם מהתבוננות בקוד של מישהו אחר אפשר ללמוד טכנולוגיות/שיטות/צורות חדשות לעשות דבריםלהבין השפעה של העבודה שלך על המערכת/להכנס לרכיבים חדשים מהר )תורנות ביפר(/הגישה ההוליסטיתכולנו בעלי מטרה משותפת וההצלחה של הצוות היא ההצלחה של כולם )לא לזרוק אחריות(כולנו קיטרנו על קוד מכוער, "לא ככה עושים את זה"
  15. כפי שאמרו – הקוד ריוויו משפר יכולות קריאה והבנה של קוד ועוזר ללמוד על דרכים שונות לעשות דבריםכולם יודעים הכל. קל יותר להוסיף פיצ'רים ולפתור באגים בטריטוריות חדשות; פחות תלות בבנאדם ספציפי )אין ג'וב סקיוריטי(גם אם זה עובד חדש וגם אם זה עובד שעבר מצוות אחרהרבה אנשים בדקו את הקוד, מוריד כמויות באגים, מעלה את יכולות התחזוקה של המוצר וכו'מעודד דיון על דברים, מציף שאלות ובעיות – חלק ממעגל הפידבק
  16. בדר"כ בשלב הזה של השיחה מתחילים ה"אבלים" שאנשים אוהבים לתת לי אז אני אנסה להפריך כמה מהנפוצים שבהם.
  17. דיזיין לא לוקח זמן? מה לגבי בהייה בגרפיטוס – גם אלו כלים שלוקחים זמן. אבל אנחנו מרגישים יותר בנח לגבי הזמן הזה - שבסופו של דבר מקצר תהליכיםמה לגבי יוניט-טסטס? על כל שורה של קוד אנחנו כותבים הרבה יותר קוד נוסף שגם דורש תחזוקהיהיה על זה שקףלמעשה חוסכים זמן עתידי
  18. בסעיף 2 – אותו מחקר של אוניברסיטת הלסינקי
  19. The study showed that the rate between senior and junior programmers was pretty much the same
  20. אז בואו נעבור לקצת קווים כלליים לגבי איך עושים קוד ריוויו
  21. קשה להתמודד עם כמויות של קוד ללא הקשר וללא IDEחלק מהאנשים יראו כמויות של קוד וירגישו שהם לא מבינים מה הולך. עדיף למנוע מהםגם מי שכבר נכנס לקוד ייתכן ויתייאש תוך כדי כי זה לוקח הרבה זמן. עדיף לכוון לריוויו שניתן לסיים ב-5-10 דקותלדוגמא – צד שרת, צד לקוח. לעבוד בצעדיo קטנים ולפרסם כל פעם שינוי קטן בלבד. שינויים מסוימים יכולים ללכת לאנשים מסוימים
  22. לא הכל ברור מראש – תן הסבר ראשוני ברור והרחב על דברים שעשויים להיות לא ברוריםציון של טסטים עוזר לקוראים להרגיש בנוח יותר לאשר את הריוויולפעמים יעלו הערות של "כדאי לעשות ככה" "תתקן פה... תתקן שם". אם כתבת מראש שזה בתוכניות שלך, זה יחסוך דיון מיותר.
  23. אם יש סטנדרט – חשוב ללכת איתו גם אם זה לא מה שאתה אוהבאם אין סטנדרט זה עדיין לא אומר שהסטנדרט שלך הוא הנכון.שמור על נימה מיעצת ולא שיפוטיתלא על כל דבר שווה להתעקש.דוגמאת ניטפיקינג
  24. שגיאות כתיב – קל לאתר, לא מעליבהאם יש מצב שבשורה הזאת והזאת יהיה אקספשןשמות משתנים לא מייצגים? מתודה באותיות פסקל?
  25. שגיאות כתיב – קל לאתר, לא מעליבהאם יש מצב שבשורה הזאת והזאת יהיה אקספשןשמות משתנים לא מייצגים? מתודה באותיות פסקל?
  26. דברים דומים שאולי ניתן לאחדהאם הקלאס הזה אמור להיות מוגדר בפרוייקט הזה? או שזה יצור צימוד בעייתי בעתיד? מה עם הבינים של ספרינג?