http://smartbear.com review your code and all your wildest dreams will come true (vote for pedro)

Post on 14-Dec-2015

216 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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.

http://smartbear.com

smartbear.com

http://smartbear.com

Code Collaborator

codecollaborator.com

http://smartbear.com

Peer Code Review != Suck

http://smartbear.com

http://smartbear.com

Act I

What’s the Point?

http://smartbear.com

Requirements

Design

Architecture

Discussion

Review

Review

http://smartbear.com

Requirements

Design

Architecture

Code

Discussion

Review

Review

(void)0

Where most of the bugs come from

http://smartbear.com

http://smartbear.com

COUNT(editors)>

COUNT(writers)

http://smartbear.com

9 errors/page

http://smartbear.com

Spell Czech:

Good, butt knot enough

http://smartbear.com

Common Sense

http://smartbear.com

The Experiment

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?

??

?

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

http://smartbear.com

It’s made of people

http://smartbear.com

The Ego Effect

http://smartbear.com

Team building

http://smartbear.com

http://smartbear.com

http://smartbear.com

http://smartbear.com

Team building, for reals

http://smartbear.com

http://smartbear.com

Go faster!

http://smartbear.com

http://smartbear.com

“The problem is, they suck.”

http://smartbear.com

“Those guys are pretty cool.”

http://smartbear.com

Specifications

Meetings

Talking about code

http://smartbear.com

if(“integrate”.equals( s ))

if( 0 == ptr )

http://smartbear.com

I’m thiiiiinking of a number…

http://smartbear.com

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

http://smartbear.com

Hapless Developer

Reviewers

Version Control

http://smartbear.com

Peer Code Review != Suck

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!

http://smartbear.com

Act II

Best PracticesHow to not waste time

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

http://smartbear.com

CodeReviewBook.com

http://smartbear.com

60-90 minutes max

Time (minutes)

De

fect

s F

oun

d

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)

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)

http://smartbear.com

Author Preparation is ???Good!

http://smartbear.com

Meetings

http://smartbear.com

http://smartbear.com

Fagan Phases

= Meeting

http://smartbear.com

http://smartbear.com

http://smartbear.com

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%

http://smartbear.com

Checklists

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

http://smartbear.com

(Re)building a checklist

The Week of Pain

http://smartbear.com

Act III

Just do it.

http://smartbear.com

Selected Code

Stable branch

Core module

Top 10 scariest files

http://smartbear.com

Unit tests only

http://smartbear.com

During feature-freeze

http://smartbear.com

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

http://smartbear.com

GottaWanna

http://smartbear.com

Jason Cohen

jason@asmartbear.com

http://blog.ASmartBear.com

Twit: @asmartbear

Code Collaborator

http://codecollab.com

(Visit our table on your

way out!)

top related