Top Banner
http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)
60

Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

Dec 14, 2015

Download

Documents

Hugo Greenlee
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Review your code

and all your wildest dreams

will come true

(vote for Pedro)

Page 2: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Jason Cohen

@ASmartBear

StackOverflow Rep: 11,723. Booyah.

Page 3: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

smartbear.com

Page 4: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Code Collaborator

codecollaborator.com

Page 5: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Peer Code Review != Suck

Page 6: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 7: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Act I

What’s the Point?

Page 8: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Requirements

Design

Architecture

Discussion

Review

Review

Page 9: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Requirements

Design

Architecture

Code

Discussion

Review

Review

(void)0

Where most of the bugs come from

Page 10: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 11: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

COUNT(editors)>

COUNT(writers)

Page 12: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

9 errors/page

Page 13: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Spell Czech:

Good, butt knot enough

Page 14: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Common Sense

Page 15: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

The Experiment

Page 16: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Rule of Bug:

Earlier == Cheaper

Before Code Review

Bugs Remaining463

Bugs Remaining321

Bugs Remaining194

0

100

200

300

400

500

AfterDevelopment

AfterQA/Test($200/fix)

AfterCustomer($1000/fix)

Bu

gs

Rem

ain

ing

in t

he

Ap

plic

atio

n

Cost of fixing bugs: $174k+ Cost of 194 latent bugs: $194k

Total Cost: $368k

What if we had Peer Review?

??

?

Page 17: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

After Code Review

Bugs Remaining463

Bugs Remaining180

Bugs Remaining113

Bugs Remaining32

0

100

200

300

400

500

AfterDevelopment

AfterCode Review

($25/fix)

AfterQA/Test($200/fix)

AfterCustomer($1000/fix)

Bu

gs

Rem

ain

ing

in t

he

Ap

plic

atio

n

Cost of fixing bugs: $120k+ Cost of 32 latent bugs: $ 32k

Total Cost: $152k

$152k, down from $368k

32, down from 194

Page 18: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

It’s made of people

Page 19: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

The Ego Effect

Page 20: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Team building

Page 21: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 22: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 23: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 24: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Team building, for reals

Page 25: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 26: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Go faster!

Page 27: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 28: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

“The problem is, they suck.”

Page 29: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

“Those guys are pretty cool.”

Page 30: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Specifications

Meetings

Talking about code

Page 31: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

if(“integrate”.equals( s ))

if( 0 == ptr )

Page 32: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

I’m thiiiiinking of a number…

Page 33: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

if ( youLikeItSoMuch() ){ marryIt();}

Page 34: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Hapless Developer

Reviewers

Version Control

Page 35: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Peer Code Review != Suck

Page 36: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Lots of techniques

Look over shoulder

Auto-email from version control after check-in

Walk-through meeting

Formal inspection

Pair programming

Buy a

Code Review

Tool!

Page 37: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Act II

Best PracticesHow to not waste time

Page 38: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Cisco® MeetingPlace® Case Study

3,200,000 lines of code

2,500 reviews

50 developers

10 months

San Diego, Bangalore, Budapest

s

Page 39: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

CodeReviewBook.com

Page 40: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

60-90 minutes max

Time (minutes)

De

fect

s F

oun

d

Page 41: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Go slow: 200-500 LOC/hourDefect Density vs. Inspection Rate

0

25

50

75

100

125

150

0 200 400 600 800 1000 1200 1400Review Inspection Rate (LOC/hour)

Def

ect

Den

sity

(d

efec

ts/k

LO

C)

Page 42: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Not too much: 200-400 LOC

Defect Density vs. LOC

0

50

100

150

200

0 200 400 600 800 1000

LOC under Review

De

fec

t D

ensi

ty (

de

fect

s/k

LO

C)

Page 43: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Author Preparation is ???Good!

Page 44: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Meetings

Page 45: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 46: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Fagan Phases

= Meeting

Page 47: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 48: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 49: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Page 50: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Defects Found By Inspection Phase

0

10

20

30

40

50

60

70

80

90

100

13 Inspection Trials

Per

cent

age

of T

otal

Def

ects

Defects from Reading Defects from Meeting

4%

Page 51: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Checklists

Page 52: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Checklist for Checklists

7 2 (George Miller, ’52)

No obvious stuff

Nothing that can be automated

Stuff that’s easy to forget

EXAMPLE:Errors handled properly everywhere in method

Page 53: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

(Re)building a checklist

The Week of Pain

Page 54: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Act III

Just do it.

Page 55: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Selected Code

Stable branch

Core module

Top 10 scariest files

Page 56: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Unit tests only

Page 57: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

During feature-freeze

Page 58: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

You know what to do,and you know when to do it.

Page 59: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

GottaWanna

Page 60: Http://smartbear.com Review your code and all your wildest dreams will come true (vote for Pedro)

http://smartbear.com

Jason Cohen

[email protected]

http://blog.ASmartBear.com

Twit: @asmartbear

Code Collaborator

http://codecollab.com

(Visit our table on your

way out!)