SlideShare a Scribd company logo
1 of 16
Code Reviews: what, why and how



An short introduction to code reviews.


August 17th 2012
Freek de Bruijn (NBIC)
Presentation overview

• what are code reviews, some different ways of reviewing code

• why would you want to do code reviews, what makes sense and
  what not

• how can you do code reviews, real world experience




• David will assist us to review the D2RQ project this afternoon

• we want to invite you to present a project for code review in a
  future meeting
WTFs/minute - Thom Holwerda
What are code reviews?

• take a fresh look at the source code
• goals: improve quality, remove bugs and share knowledge
• different ways:
    •   informal walkthrough (author leads through code)
    •   pair programming (continuous or occasional)
    •   formal inspections (extremely thorough)
    •   discuss informally with a group like this: preferred ways of coding, in-
        depth presentation of a project
• focus is on overall design, class structure, understandable names,
  optimal use of libraries, applicable design patterns and elegant
  code
• focus is not on things you can automatically check with tools (like
  for example CheckStyle, FindBugs and PMD for Java code)
Why do code reviews? (1 of 3)
Why do code reviews? (2 of 3)

•   find and fix bugs as early in the project as possible
•   have constructive discussions on improvement opportunities
•   learn from studying each others code
•   distribute knowledge: collective code ownership
•   educate new team members
•   enhance team spirit and grow collective values
•   it just makes sense, like peer reviewing scientific articles
Looking forward to a code review - Todd Presta
Why NOT do code reviews? (3 of 3)

• doing code reviews take a serious investment and changes the way
  you work
• it takes too much time to really understand new code that does
  anything non-trivial
• developers prefer to spend their time on “their part” of the system
• most of the feedback is very general and/or focuses on minor
  details
• the team is too small to do effective code reviews
• the code will only be used for a short period (or will it?)
• management does not believe in code reviews
• the code is already very good, there’s hardly anything to review…
Be positive - Cyanide & Happiness
How can you do a code review?

• be constructive and positive!

• different ways:
   • informal walkthrough (author leads through code): transfer code,
     introduce new team members, explain to a colleague why you think the
     code should work… ;-)
   • pair programming (continuous or occasional): it is part of the process to
     look at the code and discuss different approaches
   • formal inspections (extremely thorough): next slide
   • discuss informally with a group like this: we will try it out by looking at
     the D2RQ code this afternoon



• you are welcome to suggest a (or your) project for a future code
  review
How can you do a formal inspection (IEEE 1028)?

•management preparation

•planning the review

•overview of review procedures

•[individual] preparation

•[group] examination

•rework/follow-up
Using tools to support code reviews
Where can you find more information?

• interesting articles on Coding Horror with lots of comments
  codinghorror.com/blog/2006/01/code-reviews-just-do-it.html
  codinghorror.com/blog/2007/11/pair-programming-vs-code-
  reviews.html

• Code Review and Software Review described in detail on Wikipedia
  en.wikipedia.org/wiki/Code_review
  en.wikipedia.org/wiki/Software_review
  en.wikipedia.org/wiki/Fagan_inspection

• free book “Best Kept Secrets of Peer Code Review” from SmartBear
  Software (this company offers a code review tool)
  smartbear.com/solutions/white-papers/best-kept-secrets-of-peer-
  code-review
Any questions?
Bonus: culture at IBM (around 1980)

• Triumph of the Nerds (part 2, 5:30-6:52)
  youtube.com/watch?v=IbRmaIzGTOM
  pbs.org/nerds/part2.html

• “IBM is like Switzerland -- conservative, a little dull, yet prosperous.
  It has committees to verify each decision. The safety net is so big
  that it is hard to make a bad decision - or any decision at all.”

• “Rich Seidner, computer programmer and wannabe Paul Simon,
  spent twenty-five years marching in lockstep at IBM. He feels better
  now.”

• “At one point somebody looked at the process to see what's it doing
  and what's the overhead built into it, what they found is that it
  would take at least nine months to ship an empty box.”
Bonus: culture at a small startup (around 1980)

• Triumph of the Nerds (part 1, 6:31-7:18 and 8:49-9:05)
  youtube.com/watch?v=CFL9IyJ_qHk
  pbs.org/nerds/part1.html

• “Their hobby is their business and the culture they've created is
  identical to that of a thousand other technology companies. First,
  they dumped the idea of nine to five. In this industry, you can work
  any 80 hours per week you like.”

• Doug Muise (Software designer): “Eating, bathing, having a
  girlfriend, having an active social life is incidental, it gets in the
  way of code time. Writing code is the primary force that drives our
  lives so anything that interrupts that is wasteful.”

More Related Content

What's hot

To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...Hayim Makabee
 
iOSDC 2018 Presentation - Casual Talk
iOSDC 2018 Presentation - Casual TalkiOSDC 2018 Presentation - Casual Talk
iOSDC 2018 Presentation - Casual Talkkimi Ng
 
Why you should integrate peer code reviews in your software company
Why you should integrate peer code reviews in your software companyWhy you should integrate peer code reviews in your software company
Why you should integrate peer code reviews in your software companyMatts Devriendt
 
Frontend Engineer Hiring Explained at Wix Engineering
Frontend Engineer Hiring Explained at Wix EngineeringFrontend Engineer Hiring Explained at Wix Engineering
Frontend Engineer Hiring Explained at Wix EngineeringTomas Miliauskas
 

What's hot (7)

To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...To document or not to document? An exploratory study on developers' motivatio...
To document or not to document? An exploratory study on developers' motivatio...
 
The bigrewrite
The bigrewriteThe bigrewrite
The bigrewrite
 
iOSDC 2018 Presentation - Casual Talk
iOSDC 2018 Presentation - Casual TalkiOSDC 2018 Presentation - Casual Talk
iOSDC 2018 Presentation - Casual Talk
 
Clean Code Talk (draft)
Clean Code Talk (draft)Clean Code Talk (draft)
Clean Code Talk (draft)
 
Why you should integrate peer code reviews in your software company
Why you should integrate peer code reviews in your software companyWhy you should integrate peer code reviews in your software company
Why you should integrate peer code reviews in your software company
 
Lecture 31
Lecture 31Lecture 31
Lecture 31
 
Frontend Engineer Hiring Explained at Wix Engineering
Frontend Engineer Hiring Explained at Wix EngineeringFrontend Engineer Hiring Explained at Wix Engineering
Frontend Engineer Hiring Explained at Wix Engineering
 

Similar to Code reviews: a short introduction

Code Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and reviewCode Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and reviewSimon Price
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)Nacho Cougil
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): RevistedMike Harris
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Maven Logix
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)ssusercaf6c1
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)Nacho Cougil
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekNacho Cougil
 
TDD - Seriously, try it! - Opensouthcode
TDD - Seriously, try it! - OpensouthcodeTDD - Seriously, try it! - Opensouthcode
TDD - Seriously, try it! - OpensouthcodeNacho Cougil
 
Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0The Linux Foundation
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Jason Tice
 
05 DIGI CREATIVE people&process
05 DIGI CREATIVE people&process05 DIGI CREATIVE people&process
05 DIGI CREATIVE people&processSheSaysCREATIVE
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) reviewIda Aalen
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviewsnextbuild
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Developmentbsadd
 
It's XP Stupid (2019)
It's XP Stupid (2019)It's XP Stupid (2019)
It's XP Stupid (2019)Mike Harris
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoftMichaela Greiler
 
Mob Programming for Continuous Learning
Mob Programming for Continuous LearningMob Programming for Continuous Learning
Mob Programming for Continuous LearningMike Clement
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsShafiul Azam Chowdhury
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedAlexander Makarov
 

Similar to Code reviews: a short introduction (20)

Code Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and reviewCode Club - a Fight Club inspired approach to software inspection and review
Code Club - a Fight Club inspired approach to software inspection and review
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): Revisted
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech Week
 
TDD - Seriously, try it! - Opensouthcode
TDD - Seriously, try it! - OpensouthcodeTDD - Seriously, try it! - Opensouthcode
TDD - Seriously, try it! - Opensouthcode
 
Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0Xen Project Contributor Training - Part 1 introduction v1.0
Xen Project Contributor Training - Part 1 introduction v1.0
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
 
05 DIGI CREATIVE people&process
05 DIGI CREATIVE people&process05 DIGI CREATIVE people&process
05 DIGI CREATIVE people&process
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) review
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
 
It's XP Stupid (2019)
It's XP Stupid (2019)It's XP Stupid (2019)
It's XP Stupid (2019)
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoft
 
Mob Programming for Continuous Learning
Mob Programming for Continuous LearningMob Programming for Continuous Learning
Mob Programming for Continuous Learning
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
It's XP, Stupid
It's XP, StupidIt's XP, Stupid
It's XP, Stupid
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 

Recently uploaded

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Code reviews: a short introduction

  • 1. Code Reviews: what, why and how An short introduction to code reviews. August 17th 2012 Freek de Bruijn (NBIC)
  • 2. Presentation overview • what are code reviews, some different ways of reviewing code • why would you want to do code reviews, what makes sense and what not • how can you do code reviews, real world experience • David will assist us to review the D2RQ project this afternoon • we want to invite you to present a project for code review in a future meeting
  • 4. What are code reviews? • take a fresh look at the source code • goals: improve quality, remove bugs and share knowledge • different ways: • informal walkthrough (author leads through code) • pair programming (continuous or occasional) • formal inspections (extremely thorough) • discuss informally with a group like this: preferred ways of coding, in- depth presentation of a project • focus is on overall design, class structure, understandable names, optimal use of libraries, applicable design patterns and elegant code • focus is not on things you can automatically check with tools (like for example CheckStyle, FindBugs and PMD for Java code)
  • 5. Why do code reviews? (1 of 3)
  • 6. Why do code reviews? (2 of 3) • find and fix bugs as early in the project as possible • have constructive discussions on improvement opportunities • learn from studying each others code • distribute knowledge: collective code ownership • educate new team members • enhance team spirit and grow collective values • it just makes sense, like peer reviewing scientific articles
  • 7. Looking forward to a code review - Todd Presta
  • 8. Why NOT do code reviews? (3 of 3) • doing code reviews take a serious investment and changes the way you work • it takes too much time to really understand new code that does anything non-trivial • developers prefer to spend their time on “their part” of the system • most of the feedback is very general and/or focuses on minor details • the team is too small to do effective code reviews • the code will only be used for a short period (or will it?) • management does not believe in code reviews • the code is already very good, there’s hardly anything to review…
  • 9. Be positive - Cyanide & Happiness
  • 10. How can you do a code review? • be constructive and positive! • different ways: • informal walkthrough (author leads through code): transfer code, introduce new team members, explain to a colleague why you think the code should work… ;-) • pair programming (continuous or occasional): it is part of the process to look at the code and discuss different approaches • formal inspections (extremely thorough): next slide • discuss informally with a group like this: we will try it out by looking at the D2RQ code this afternoon • you are welcome to suggest a (or your) project for a future code review
  • 11. How can you do a formal inspection (IEEE 1028)? •management preparation •planning the review •overview of review procedures •[individual] preparation •[group] examination •rework/follow-up
  • 12. Using tools to support code reviews
  • 13. Where can you find more information? • interesting articles on Coding Horror with lots of comments codinghorror.com/blog/2006/01/code-reviews-just-do-it.html codinghorror.com/blog/2007/11/pair-programming-vs-code- reviews.html • Code Review and Software Review described in detail on Wikipedia en.wikipedia.org/wiki/Code_review en.wikipedia.org/wiki/Software_review en.wikipedia.org/wiki/Fagan_inspection • free book “Best Kept Secrets of Peer Code Review” from SmartBear Software (this company offers a code review tool) smartbear.com/solutions/white-papers/best-kept-secrets-of-peer- code-review
  • 15. Bonus: culture at IBM (around 1980) • Triumph of the Nerds (part 2, 5:30-6:52) youtube.com/watch?v=IbRmaIzGTOM pbs.org/nerds/part2.html • “IBM is like Switzerland -- conservative, a little dull, yet prosperous. It has committees to verify each decision. The safety net is so big that it is hard to make a bad decision - or any decision at all.” • “Rich Seidner, computer programmer and wannabe Paul Simon, spent twenty-five years marching in lockstep at IBM. He feels better now.” • “At one point somebody looked at the process to see what's it doing and what's the overhead built into it, what they found is that it would take at least nine months to ship an empty box.”
  • 16. Bonus: culture at a small startup (around 1980) • Triumph of the Nerds (part 1, 6:31-7:18 and 8:49-9:05) youtube.com/watch?v=CFL9IyJ_qHk pbs.org/nerds/part1.html • “Their hobby is their business and the culture they've created is identical to that of a thousand other technology companies. First, they dumped the idea of nine to five. In this industry, you can work any 80 hours per week you like.” • Doug Muise (Software designer): “Eating, bathing, having a girlfriend, having an active social life is incidental, it gets in the way of code time. Writing code is the primary force that drives our lives so anything that interrupts that is wasteful.”

Editor's Notes

  1. IEEE Std 1028 defines a common set of activities for "formal" reviews (with some variations, especially for software audit). The sequence of activities is largely based on the software inspection process originally developed at IBM by Michael Fagan. [3]  Differing types of review may apply this structure with varying degrees of rigour, but all activities are mandatory for inspection: 0. [Entry evaluation]:  The Review Leader uses a standard checklist of entry criteria to ensure that optimum conditions exist for a successful review. 1. Management preparation:  Responsible management ensure that the review will be appropriately resourced with staff, time, materials, and tools, and will be conducted according to policies, standards, or other relevant criteria. 2. Planning the review:  The Review Leader identifies or confirms the objectives of the review, organises a team of Reviewers, and ensures that the team is equipped with all necessary resources for conducting the review. 3. Overview of review procedures:  The Review Leader, or some other qualified person, ensures (at a meeting if necessary) that all Reviewers understand the review goals, the review procedures, the materials available to them, and the procedures for conducting the review. 4. [Individual] Preparation:  The Reviewers individually prepare for group examination of the work under review, by examining it carefully for  anomalies  (potential defects), the nature of which will vary with the type of review and its goals. 5. [Group] Examination:  The Reviewers meet at a planned time to pool the results of their preparation activity and arrive at a consensus regarding the status of the document (or activity) being reviewed. 6. Rework/follow-up:  The Author of the work product (or other assigned person) undertakes whatever actions are necessary to repair defects or otherwise satisfy the requirements agreed to at the Examination meeting. The Review Leader verifies that all action items are closed. 7. [Exit evaluation]:  The Review Leader verifies that all activities necessary for successful review have been accomplished, and that all outputs appropriate to the type of review have been finalised.