+ All Categories
Home > Documents > Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your...

Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your...

Date post: 18-Jul-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
32
1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro) http://smartbear.com Jason Cohen
Transcript
Page 1: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

1

http://smartbear.com

Review your code with Perforce and all your wildest dreams

will come true

(vote for Pedro)

http://smartbear.com

Jason Cohen

Page 2: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

2

http://smartbear.com

http://smartbear.com

smartbear.com

Page 3: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

3

http://smartbear.com

Code Collaborator

codecollaborator.com

http://smartbear.com

Peer Code Review +

Perforce

!=

Suck

Page 4: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

4

http://smartbear.com

Why review code?

http://smartbear.com

Requirements

Design

Architecture

Discussion

Review

Review

Page 5: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

5

http://smartbear.com

Requirements

Design

Architecture

Code

Discussion

Review

Review

(void)0

Where most of the bugs come from

http://smartbear.com

Page 6: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

6

http://smartbear.com

COUNT(editors) >

COUNT(writers)

http://smartbear.com

9 errors/page

Page 7: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

7

http://smartbear.com

Spell Czech:

Good, butt knot enough

http://smartbear.com

Find bugs

Train new hires

Cross-training

Page 8: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

8

http://smartbear.com

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

http://smartbear.com

1. Time

2. Busywork

Page 9: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

9

http://smartbear.com

Hapless Developer

Reviewers

Perforce

http://smartbear.com

Peer Code Review +

Perforce

!=

Suck

Page 10: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

10

http://smartbear.com

Review Method #1:

Over-the-shoulder

http://smartbear.com

Over-the-Shoulder

Page 11: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

11

http://smartbear.com

Over-the-Shoulder

http://smartbear.com

Over-the-Shoulder

Page 12: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

12

http://smartbear.com

Walk through the diffs

http://smartbear.com

Post-its: Airtight issue-tracking system

Page 13: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

13

http://smartbear.com

Over-the-Shoulder

Easy, Free

Interruption

No info

Walk-through

http://smartbear.com

Review Method #2:

Meetings

Page 14: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

14

http://smartbear.com

Schedule it

http://smartbear.com

Walk through the diffs

Page 15: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

15

http://smartbear.com

Print-outs are soooo 1976

http://smartbear.com

Formal Inspections

Michael Fagan, IBM, 1976

Page 16: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

16

http://smartbear.com

1. Planning 2. Intro 3. Reading

4. Inspect 5. Rework 6. Verify

7. Complete 8. Improve

Fagan’s Phases

= Meeting

http://smartbear.com

Meetings are required. —Michael Fagan, ‘76

Page 17: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

17

http://smartbear.com

Meetings are required. —Gilb, Fagan, Wiegers

http://smartbear.com

You didn’t check for null. —The Phantom Inspector

Page 18: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

18

http://smartbear.com

Are meetings worth it? —Lawrence Votta, ‘93

http://smartbear.com

4%

Page 19: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

19

http://smartbear.com

Review Method #3:

Email

http://smartbear.com

Submit Changelist

Page 20: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

20

http://smartbear.com

Get Email notification

http://smartbear.com

Look at diffs

Page 21: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

21

http://smartbear.com

Talk over email

http://smartbear.com

Review Daemon

System Administrator’s Guide Chapter 6

(near the end)

Server-side Configuration

Page 22: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

22

http://smartbear.com

Reviews: //depot/main/... //depot/.../README //depot/jobs

Subscribe via User Spec (p4 user)

http://smartbear.com

Python is just as scared of you as you are of it.

p4review.py

Page 23: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

23

http://smartbear.com

Email

Easy, Free

No interruption, remote

Conversation-tracking

No info / No end

“I thought you had it.”

http://smartbear.com

Review Method #4:

Tool-Assisted

Page 24: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

24

http://smartbear.com

Tools

Code Collaborator Commercial

Crucible Commercial

Review Board Open-Source

Mondrian Internal

http://smartbear.com

Alleged Benefits

Reality

Tools

Page 25: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

25

http://smartbear.com

Hapless Developer

Reviewers

Perforce

Identify Changes

Package/Deliver

Organize Communication

Track Defects Audit Trail

Reports Automatic Metrics

http://smartbear.com

Best Practices How to not waste time

Page 26: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

26

http://smartbear.com

Cisco® MeetingPlace® Case Study

3,200,000 lines of code

2,500 reviews

50 developers

10 months

San Diego, Bangalore, Budapest

http://smartbear.com

It’s in the handbook

Page 27: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

27

http://smartbear.com

60-90 minutes max

Time (minutes)

Def

ects

Fou

nd

http://smartbear.com

When to review?

Pre-commit blocks development

Post-commit harder to fix bugs

Pre-commit is less workflow

Pre-commit protects others

Page 28: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

28

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

Page 29: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

29

http://smartbear.com

(Re)building a checklist

The Week of Pain

http://smartbear.com

Getting Started

Page 30: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

30

http://smartbear.com

Selected Code

Stable branch

Core module

Top 10 scariest files

http://smartbear.com

Unit tests only

Page 31: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

31

http://smartbear.com

During feature-freeze

http://smartbear.com

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

<beeep!>

Page 32: Review your code with Perforce and all your wildest dreams will … · 2009-05-13 · 1 Review your code with Perforce and all your wildest dreams will come true (vote for Pedro)

32

http://smartbear.com

Gotta Wanna

http://smartbear.com

Thank You.

Code Collaborator (product placement? you rogue!)

http://codecollab.com http://blog.smartbear.com Twitter: @smartbears

Jason Cohen [email protected] http://blog.asmartbear.com


Recommended