SlideShare uma empresa Scribd logo
1 de 31
……………
“This Ain’t Your Granddaddy’s Code Review…”
Building Better Code Reviews
……………
» What is Code Review and Why Do I Care?
» Why Is Our Traditional Process Broken?
» How Do We Make Code Review Better?
……………
» Cost of Fixing Defects
……………
• Common Mistakes
• Coding Style /
Standards
• ???
• UI functionality
• Application
Behavior (high-
level)
• User Experience
• Tests the modular
function
• Individual Pieces
• Can be automated
Unit
Testing
QA /
UAT
Static Code
Analysis
(e.g. SONAR)
Code
Reviews
Tools for Finding Defects
……………
Code
Review
Logic / Runtime Errors
Learning Opportunities
/ Redesign
“Tribal Knowledge”
Stupid Mistakes
String zero = "" + 0;
We’re going to
keep you up at
night and waste
your weekends!!!
……………
Source: Best Kept Secrets In Code Review
Code Review At CISCO Systems
……………
» Types of Code Review
• Informal
• Over-the-Shoulder
• Email Pass-around
• Pair Programming
• Formal
• Formal Inspection
• Tool Assisted
……………
Plan a Review
• Determine
files to
review
• Book
meeting
room, project
or, send
invites
Review Meeting
• Reviewers
inspect files
• Identify
defects
• Log issues
Fix Defects
• Author
reviews
defects
• Makes
changes as
needed
Repeat Weekly
……………
» How Much?
• 200 – 400 lines of code per session
» How Fast?
• 300 – 500 LoC / hour
» How Long?
• 60-90 minutes
function expireUserSession(){
var userResponse = window.confirm("You will be
logged out unless you click OK");
if(userResponse === true){
setTimeout('expireUserSession', 30*60*1000);
} else {
window.location = 'logout.action';
}
}
dojo.addOnLoad(function(){
setTimeout('expireUserSession', 30*60*1000);
});
OMG, Super Wrong*!!!
Slow Down…72 seconds
* Superwrong is a technical term. This will not work at all!
……………
» Foster a good code review culture
• Finding defects is a good thing!
• Learning opportunity for developers
• Managers must understand metrics
» Use Anti-pattern Checklists
• Code Review Bingo
• Example: Avoid “Tableception”!
Your HTML Page
Best Practice:
Avoid “Tableception” (Tables
within Tables)
……………
How Can We Do This Better???
……………
» Time Commitment
• 60 - 90 minutes?
• Different Schedules
• Remote Workers
» Accountability / Enforcement
• Ensuring that defects get fixed
» Reporting
• Can we ship this feature to production?
» Automation
• Every step is manual, requires a lot of effort
……………
» Time Commitment
• Asynchronous reviews
» Accountability
• Associate Features with Reviews
» Reporting
• Transparency to Managers
• Out of the box functionality from Collaborator!
» Automation
• Remove manual steps, make the CI Server work for us!
……………
Hurray!
Ugh!
*
* This is harder if you’re using ClearCase, but other VCS this should be easy
……………
Demo Time
……………
From the Web UI
What do I need to Review?
……………
From Email
……………
……………
……………
……………
……………
……………
» Reviews Automatically Created
» Clear Action Items for Developers
» Notification System
» Fast Comparison Tool
• Support for your favorite external tool too!
» Real-time Chats / Comments
» Easy to Identify “Reworked” Files
» Generate Reports
……………
» Collaborator Costs
• $499 / named license
» No support for IntelliJ
» Alternatives
• Crucible
• Good price
• No support for rework
• No Automation Support / Metrics
• Review Board
• Great options for cloud hosting!
• Only supports pre-commit model
• Setup a bit of a pain
……………
Questions?
……………
Material That Didn’t Make it Into The
Presentation
……………
» Post-Commit Model
• Reviews Created After Check-in to VCS
• Advantages
• Can Utilize CI Server for Automation
• Easier to Adopt
• Disadvantages
• No way to ensure all code is reviewed before production
……………
» Pre-Commit Model
• Only check in code after completing a review
• Advantages
• Code doesn’t “pollute” VCS
• Enforcement
• Disadvantages
• Against best practice: “Commit Early and Often”
• Requires manual work from developers to create reviews
……………
» GIT: Post-Commit, Pre-Push Model
• Use local branch to commit, but review must be completed
before push to “gold repository”
……………
» Identify and Fix Bugs Earlier
• Difficult to diagnose issues
» Mentoring / Career Development
» Knowledge Transfer
» More Maintainable Code
» Shorter Development / Test Cycles
……………
» Team Size: 3 – 6 people
» Roles
• Author: Wrote the code
• Reviewer: Developers, appraise the code
• Moderator: Facilitates discussion, settles ties. Usually the lead
developer
• Observer: BA or other non-technical, provides SME
• “Reader”: Looks at code purely for readability

Mais conteúdo relacionado

Destaque

Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Atlassian
 
Code reviews
Code reviewsCode reviews
Code reviewsJuan Maiz
 
How Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritHow Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritAnuar Nurmakanov
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review ProcessDr. Syed Hassan Amin
 
Code Review Tool Evaluation
Code Review Tool EvaluationCode Review Tool Evaluation
Code Review Tool EvaluationKate Semizhon
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
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 cultureNina Zakharenko
 
Code reviews - Leave your ego at the door
Code reviews - Leave your ego at the doorCode reviews - Leave your ego at the door
Code reviews - Leave your ego at the doorFrank Sons
 

Destaque (11)

Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010
 
Code reviews
Code reviewsCode reviews
Code reviews
 
How Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritHow Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With Gerrit
 
Code Review
Code ReviewCode Review
Code Review
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Code Review Tool Evaluation
Code Review Tool EvaluationCode Review Tool Evaluation
Code Review Tool Evaluation
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
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 reviews - Leave your ego at the door
Code reviews - Leave your ego at the doorCode reviews - Leave your ego at the door
Code reviews - Leave your ego at the door
 

Mais de Excella

DCSUG - What's Really Going On? Observer Worksheet
DCSUG - What's Really Going On? Observer WorksheetDCSUG - What's Really Going On? Observer Worksheet
DCSUG - What's Really Going On? Observer WorksheetExcella
 
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa AdkinsDCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa AdkinsExcella
 
DCSUG - Servant Leadership Handout
DCSUG - Servant Leadership HandoutDCSUG - Servant Leadership Handout
DCSUG - Servant Leadership HandoutExcella
 
DCSUG - Servant Leadership
DCSUG - Servant LeadershipDCSUG - Servant Leadership
DCSUG - Servant LeadershipExcella
 
DCSUG - Applying Analysis in an Agile World
DCSUG - Applying Analysis in an Agile WorldDCSUG - Applying Analysis in an Agile World
DCSUG - Applying Analysis in an Agile WorldExcella
 
DCSUG - The Art and Practice of the Agile Leader
DCSUG - The Art and Practice of the Agile LeaderDCSUG - The Art and Practice of the Agile Leader
DCSUG - The Art and Practice of the Agile LeaderExcella
 
DCSUG - Finding Lean in Agile
DCSUG - Finding Lean in AgileDCSUG - Finding Lean in Agile
DCSUG - Finding Lean in AgileExcella
 
DCSUG - Impact Mapping
DCSUG - Impact MappingDCSUG - Impact Mapping
DCSUG - Impact MappingExcella
 
DCSUG - Happiness: A Key Component of Agile
DCSUG - Happiness: A Key Component of AgileDCSUG - Happiness: A Key Component of Agile
DCSUG - Happiness: A Key Component of AgileExcella
 
The Awkward Teenager of Testing
The Awkward Teenager of TestingThe Awkward Teenager of Testing
The Awkward Teenager of TestingExcella
 
Let's Sharpen Your Agile Ax, It's Story Splitting Time
Let's Sharpen Your Agile Ax, It's Story Splitting TimeLet's Sharpen Your Agile Ax, It's Story Splitting Time
Let's Sharpen Your Agile Ax, It's Story Splitting TimeExcella
 
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016Excella
 
The 7 Secrets of Highly Effective Retrospectives (DCSUG)
The 7 Secrets of Highly Effective Retrospectives (DCSUG)The 7 Secrets of Highly Effective Retrospectives (DCSUG)
The 7 Secrets of Highly Effective Retrospectives (DCSUG)Excella
 
Get Your Productivity Game On!!
Get Your Productivity Game On!!Get Your Productivity Game On!!
Get Your Productivity Game On!!Excella
 
How to Structure Multi Team Organizations
How to Structure Multi Team OrganizationsHow to Structure Multi Team Organizations
How to Structure Multi Team OrganizationsExcella
 
Tactics to Kickstart Your Journey Toward DevOps
Tactics to Kickstart Your Journey Toward DevOpsTactics to Kickstart Your Journey Toward DevOps
Tactics to Kickstart Your Journey Toward DevOpsExcella
 
Intro to Mocking - DjangoCon 2015
Intro to Mocking - DjangoCon 2015Intro to Mocking - DjangoCon 2015
Intro to Mocking - DjangoCon 2015Excella
 
Tactics to Kickstart Your Journey Toward Continuous Delivery
Tactics to Kickstart Your Journey Toward Continuous DeliveryTactics to Kickstart Your Journey Toward Continuous Delivery
Tactics to Kickstart Your Journey Toward Continuous DeliveryExcella
 
Using ansible vault to protect your secrets
Using ansible vault to protect your secretsUsing ansible vault to protect your secrets
Using ansible vault to protect your secretsExcella
 
Using Lean Thinking to Increase the Value of Agile
Using Lean Thinking to Increase the Value of AgileUsing Lean Thinking to Increase the Value of Agile
Using Lean Thinking to Increase the Value of AgileExcella
 

Mais de Excella (20)

DCSUG - What's Really Going On? Observer Worksheet
DCSUG - What's Really Going On? Observer WorksheetDCSUG - What's Really Going On? Observer Worksheet
DCSUG - What's Really Going On? Observer Worksheet
 
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa AdkinsDCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
DCSUG - We Are The Leaders We Have Been Waiting For by Lyssa Adkins
 
DCSUG - Servant Leadership Handout
DCSUG - Servant Leadership HandoutDCSUG - Servant Leadership Handout
DCSUG - Servant Leadership Handout
 
DCSUG - Servant Leadership
DCSUG - Servant LeadershipDCSUG - Servant Leadership
DCSUG - Servant Leadership
 
DCSUG - Applying Analysis in an Agile World
DCSUG - Applying Analysis in an Agile WorldDCSUG - Applying Analysis in an Agile World
DCSUG - Applying Analysis in an Agile World
 
DCSUG - The Art and Practice of the Agile Leader
DCSUG - The Art and Practice of the Agile LeaderDCSUG - The Art and Practice of the Agile Leader
DCSUG - The Art and Practice of the Agile Leader
 
DCSUG - Finding Lean in Agile
DCSUG - Finding Lean in AgileDCSUG - Finding Lean in Agile
DCSUG - Finding Lean in Agile
 
DCSUG - Impact Mapping
DCSUG - Impact MappingDCSUG - Impact Mapping
DCSUG - Impact Mapping
 
DCSUG - Happiness: A Key Component of Agile
DCSUG - Happiness: A Key Component of AgileDCSUG - Happiness: A Key Component of Agile
DCSUG - Happiness: A Key Component of Agile
 
The Awkward Teenager of Testing
The Awkward Teenager of TestingThe Awkward Teenager of Testing
The Awkward Teenager of Testing
 
Let's Sharpen Your Agile Ax, It's Story Splitting Time
Let's Sharpen Your Agile Ax, It's Story Splitting TimeLet's Sharpen Your Agile Ax, It's Story Splitting Time
Let's Sharpen Your Agile Ax, It's Story Splitting Time
 
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
Managing for Happiness by Jurgen Appelo at DCSUG on 8/9/2016
 
The 7 Secrets of Highly Effective Retrospectives (DCSUG)
The 7 Secrets of Highly Effective Retrospectives (DCSUG)The 7 Secrets of Highly Effective Retrospectives (DCSUG)
The 7 Secrets of Highly Effective Retrospectives (DCSUG)
 
Get Your Productivity Game On!!
Get Your Productivity Game On!!Get Your Productivity Game On!!
Get Your Productivity Game On!!
 
How to Structure Multi Team Organizations
How to Structure Multi Team OrganizationsHow to Structure Multi Team Organizations
How to Structure Multi Team Organizations
 
Tactics to Kickstart Your Journey Toward DevOps
Tactics to Kickstart Your Journey Toward DevOpsTactics to Kickstart Your Journey Toward DevOps
Tactics to Kickstart Your Journey Toward DevOps
 
Intro to Mocking - DjangoCon 2015
Intro to Mocking - DjangoCon 2015Intro to Mocking - DjangoCon 2015
Intro to Mocking - DjangoCon 2015
 
Tactics to Kickstart Your Journey Toward Continuous Delivery
Tactics to Kickstart Your Journey Toward Continuous DeliveryTactics to Kickstart Your Journey Toward Continuous Delivery
Tactics to Kickstart Your Journey Toward Continuous Delivery
 
Using ansible vault to protect your secrets
Using ansible vault to protect your secretsUsing ansible vault to protect your secrets
Using ansible vault to protect your secrets
 
Using Lean Thinking to Increase the Value of Agile
Using Lean Thinking to Increase the Value of AgileUsing Lean Thinking to Increase the Value of Agile
Using Lean Thinking to Increase the Value of Agile
 

Modern Code Review

  • 1. …………… “This Ain’t Your Granddaddy’s Code Review…” Building Better Code Reviews
  • 2. …………… » What is Code Review and Why Do I Care? » Why Is Our Traditional Process Broken? » How Do We Make Code Review Better?
  • 3. …………… » Cost of Fixing Defects
  • 4. …………… • Common Mistakes • Coding Style / Standards • ??? • UI functionality • Application Behavior (high- level) • User Experience • Tests the modular function • Individual Pieces • Can be automated Unit Testing QA / UAT Static Code Analysis (e.g. SONAR) Code Reviews Tools for Finding Defects
  • 5. …………… Code Review Logic / Runtime Errors Learning Opportunities / Redesign “Tribal Knowledge” Stupid Mistakes String zero = "" + 0; We’re going to keep you up at night and waste your weekends!!!
  • 6. …………… Source: Best Kept Secrets In Code Review Code Review At CISCO Systems
  • 7. …………… » Types of Code Review • Informal • Over-the-Shoulder • Email Pass-around • Pair Programming • Formal • Formal Inspection • Tool Assisted
  • 8. …………… Plan a Review • Determine files to review • Book meeting room, project or, send invites Review Meeting • Reviewers inspect files • Identify defects • Log issues Fix Defects • Author reviews defects • Makes changes as needed Repeat Weekly
  • 9. …………… » How Much? • 200 – 400 lines of code per session » How Fast? • 300 – 500 LoC / hour » How Long? • 60-90 minutes function expireUserSession(){ var userResponse = window.confirm("You will be logged out unless you click OK"); if(userResponse === true){ setTimeout('expireUserSession', 30*60*1000); } else { window.location = 'logout.action'; } } dojo.addOnLoad(function(){ setTimeout('expireUserSession', 30*60*1000); }); OMG, Super Wrong*!!! Slow Down…72 seconds * Superwrong is a technical term. This will not work at all!
  • 10. …………… » Foster a good code review culture • Finding defects is a good thing! • Learning opportunity for developers • Managers must understand metrics » Use Anti-pattern Checklists • Code Review Bingo • Example: Avoid “Tableception”! Your HTML Page Best Practice: Avoid “Tableception” (Tables within Tables)
  • 11. …………… How Can We Do This Better???
  • 12. …………… » Time Commitment • 60 - 90 minutes? • Different Schedules • Remote Workers » Accountability / Enforcement • Ensuring that defects get fixed » Reporting • Can we ship this feature to production? » Automation • Every step is manual, requires a lot of effort
  • 13. …………… » Time Commitment • Asynchronous reviews » Accountability • Associate Features with Reviews » Reporting • Transparency to Managers • Out of the box functionality from Collaborator! » Automation • Remove manual steps, make the CI Server work for us!
  • 14. …………… Hurray! Ugh! * * This is harder if you’re using ClearCase, but other VCS this should be easy
  • 16. …………… From the Web UI What do I need to Review?
  • 23. …………… » Reviews Automatically Created » Clear Action Items for Developers » Notification System » Fast Comparison Tool • Support for your favorite external tool too! » Real-time Chats / Comments » Easy to Identify “Reworked” Files » Generate Reports
  • 24. …………… » Collaborator Costs • $499 / named license » No support for IntelliJ » Alternatives • Crucible • Good price • No support for rework • No Automation Support / Metrics • Review Board • Great options for cloud hosting! • Only supports pre-commit model • Setup a bit of a pain
  • 26. …………… Material That Didn’t Make it Into The Presentation
  • 27. …………… » Post-Commit Model • Reviews Created After Check-in to VCS • Advantages • Can Utilize CI Server for Automation • Easier to Adopt • Disadvantages • No way to ensure all code is reviewed before production
  • 28. …………… » Pre-Commit Model • Only check in code after completing a review • Advantages • Code doesn’t “pollute” VCS • Enforcement • Disadvantages • Against best practice: “Commit Early and Often” • Requires manual work from developers to create reviews
  • 29. …………… » GIT: Post-Commit, Pre-Push Model • Use local branch to commit, but review must be completed before push to “gold repository”
  • 30. …………… » Identify and Fix Bugs Earlier • Difficult to diagnose issues » Mentoring / Career Development » Knowledge Transfer » More Maintainable Code » Shorter Development / Test Cycles
  • 31. …………… » Team Size: 3 – 6 people » Roles • Author: Wrote the code • Reviewer: Developers, appraise the code • Moderator: Facilitates discussion, settles ties. Usually the lead developer • Observer: BA or other non-technical, provides SME • “Reader”: Looks at code purely for readability