why you should integrate peer code reviews in your software company

29
<CODE REVIEWS/> Why you should do December 2015

Upload: matts-devriendt

Post on 13-Jan-2017

253 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Why you should integrate peer code reviews in your software company

<CODE REVIEWS/>

Why you should do

December 2015

Page 2: Why you should integrate peer code reviews in your software company

WHO AM I?

Ma!s Devriendt Developer & entrepreneur @iMa!s

Page 3: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-portrait-of-alarmed-man-99912533.jpg

CODE REVIEWS ?

Page 4: Why you should integrate peer code reviews in your software company

Code review is systematic examination (often known as peer

review) of a developer’s source code.

CODE REVIEWS ?

Page 5: Why you should integrate peer code reviews in your software company

GOAL?

Improve the overall quality of the software product and the knowledge of developers

CODE REVIEWS ?

Page 6: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-man-setting-time-on-a-big-clock-91707425.jpg

WHEN & WHAT?

Page 7: Why you should integrate peer code reviews in your software company

When a developer is finished working on an issue,

another developer looks over the code and considers questions like:

WHEN & WHAT?

Page 8: Why you should integrate peer code reviews in your software company

1) ERRORS

Are there any obvious logic errors

in the code?

WHEN & WHAT?

Page 9: Why you should integrate peer code reviews in your software company

2) REQUIREMENTS

Looking at the requirements, are all cases fully implemented?

WHEN & WHAT?

Page 10: Why you should integrate peer code reviews in your software company

3) TESTS

A) Are the new automated tests sufficient for the new code?

B) Do existing automated tests need to be rewri!en to account

for changes in the code?

WHEN & WHAT?

Page 11: Why you should integrate peer code reviews in your software company

4) STYLE GUIDELINES

Does the new code conform to existing style guidelines?

WHEN & WHAT?

Page 12: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-switchboard-94006822.jpg

WHY DO CODE REVIEWS MATTER?

for developers and (project-)managers

Page 13: Why you should integrate peer code reviews in your software company

Code is reviewed by another developer

WHY DO CR MATTER?

Page 14: Why you should integrate peer code reviews in your software company

Code is reviewed by another developer

WHY DO CR MATTER?

Developers will be more likely to write comments and tests

Better code quality & less bugs

New employees come up to speed faster

ü  Knowledge of other developers: possible improvements, new classes/methods/libraries, new insights, be!er ways, …

ü  Because developer knows his/her code will be reviewed

Page 15: Why you should integrate peer code reviews in your software company

No one is the only person who knows a specific part

of the code base

WHY DO CR MATTER?

Page 16: Why you should integrate peer code reviews in your software company

No one is the only person who knows a specific part

of the code base

WHY DO CR MATTER?

Teamwork

Flexibility:

Shared responsibility

ü  Others can help out if needed (to meet deadlines) They can take work of the backlog and start programming

ü  Be!er control of resources: developers can be interchanged more easily (they will already know about the source code)

Page 17: Why you should integrate peer code reviews in your software company

No one is the only person who knows a specific part

of the code base

WHY DO CR MATTER?

Less human resources problems:

Peace of mind

When only 1 person knows about the source code of a program: What if he/she is not in the office? Or worse: what if he/she left the company… “Hé can you do a small bugfix because Mr. X is not here and things are failing on the production server?”

No one is the critical path

Page 18: Why you should integrate peer code reviews in your software company

Knowledge sharing

WHY DO CR MATTER?

Page 19: Why you should integrate peer code reviews in your software company

Knowledge sharing

WHY DO CR MATTER?

Opportunity to learn about a new languages, libraries and frameworks.

Hidden knowledge

New SDKs

‘Known issues’

Page 20: Why you should integrate peer code reviews in your software company

And many other advantages…

WHY DO CR MATTER?

Early feedback in development process

Extra efforts of developers for well-designed code and passing tests

Shared load

No code gets in unreviewed

(code written at 3am or by inters)

Page 21: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-teacher-holding-a-book-in-front-of-a-black-board-looking-surprised-92438437.jpg

PRACTICAL TIPS

Page 22: Why you should integrate peer code reviews in your software company

Review as soon as possible, before merging

PRACTICAL TIPS

Use git-pull or work with a branch-approach where a feature-

branch can only be merged to development if it’s reviewed

Page 23: Why you should integrate peer code reviews in your software company

How fast should code be reviewed?

PRACTICAL TIPS

200-300 lines of code / hour

Background image: Smartbear - Cisco Case Study - Plotting inspection size versus time at Cisco. There is no apparent systematic "inspection rate.”

Page 24: Why you should integrate peer code reviews in your software company

Take time for a decent review

PRACTICAL TIPS

Source: Smartbear - Cisco Case Study

Reviewers become less effective at finding defects as their pace through the review accelerates.

Page 25: Why you should integrate peer code reviews in your software company

How much lines should be reviewed at a time?

PRACTICAL TIPS

Reviewers are most effective at reviewing small amounts of code.

200 – 400 lines

Source: Smartbear - Cisco Case Study

Page 26: Why you should integrate peer code reviews in your software company

Total review time

PRACTICAL TIPS

Less than 60 minutes, max 90 minutes

Source: Smartbear - Cisco Case Study

Page 27: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-parents-visiting-day-93711238.jpg

CODE REVIEWS ARE PART OF THE AGILE APPROACH, COMBINE CODE

REVIEWS WITH CONTINUOUS INTEGRATION, TESTING, SCRUM, …

AND AIM FOR ULTIMATE FLEXIBILITY!

Page 28: Why you should integrate peer code reviews in your software company

Image source: http://image.shutterstock.com/z/stock-photo-group-of-photographers-taking-picture-with-cameras-99830894.jpg

QUESTIONS? START CODE REVIEWING!

Page 29: Why you should integrate peer code reviews in your software company

Sources and references  •  h#ps://www.atlassian.com/agile/code-­‐reviews  •  h#p://support.smartbear.com/support/media/resources/cc/book/code-­‐review-­‐cisco-­‐case-­‐

study.pdf