Click here to load reader

Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010

  • View
    2.845

  • Download
    2

Embed Size (px)

DESCRIPTION

Code Review for Teams Too Busy to Review Code Brendan Humphreys, Atlassian

Text of Code Review for Teams Too Busy to Review Code - Atlassian Summit 2010

Slide 1

11

A guide for chronically time-poor developersCode Review for Busy Teams

Brendan Humphreys, Atlassian

22

Who am I?

3

@brendanhTeam Lead, FishEye & Crucible12+ years experience doing code review12+ years of trying to do code review better

3

TopicsBack to basicsHow to we got to where we areThree steps towards code reviewStrategies & hurdlesSome tips for better reviews

44

#include main(t,_,a)char *a;{return!0

5

What is it that we do all day?

6

7

88

9

Req. Design Coding Testing QA Production

$$

$

Relative cost of fixing a bug

10

$500 million payload

$8 billionrocket

1 line softwaredefect

11

1212

The Rise of Agile

13

14

15

16

1717

Machines vs Humans

18

blocky:~ brendan$ javac hello.java hello.java:6: cannot find symbolsymbol : variable lengthlocation: class java.lang.String for (int i = 0; i < s.length; i++) { ^1 error

19

20

21

Checkstyle, Lint, PMDFindbugsClover

22

Smarter Tools

22

Continuous Feedback

2323

Tougher QuestionsMeet requirements? Architecturally sound?Futureproof?Coding idioms correct?Potential reuseDomain knowledge

24

CodeReview}

24

25

Code ReviewSystematic review of code by peers reduce defects spread code ownership mentor developers

2626

Formal Code InspectionFagan, 1976

Finds Defects Early!

Printed Source code!

Rigid process,Face-to-face meetings!

Very slowImpractical for largecodebases

Great for mentoring, knowledge sharing

27

Very effective code review, finds defects early

Great for sharing knowledge,mentoring

Pair Programming

Requires two developers,co-located

Transient discussionPersonalities

28

Tool-assisted Code Review

29

Managed workflow and notificationRecord of discussionAsynchronousChange team culture?

29

3 steps towards a code review culture

30

Make activity visibleMake code sharableEncourage discussions around code

30

Making Activity Visible

31

FishEye: Unlock your repository

3232

Making Activity Visible

33

The FishEyeActivity Stream Web RSS Watches JIRA

33

34

Making Code Sharable

35

FishEye makes it easy to share code pointers File revisions Source Lines Diffs ChangeSets

35

EncouragingDiscussionsAround code

3636

Crucible: Lightweight Code Review

3737

Crucible: ChangeSet Discussions

3838

39

ChangeSet Discussions

40

Simple way to provide ad-hoc feedbackThreaded discussionsChangeSet author notifiedAppear in Activity StreamPreserved as annotation to ChangeSet

40

Crucible: Snippets

4141

42

SnippetsSimple paste-bin serviceAnyone can comment, reply, raise defectAll participants notifiedAppear in activity streamDurable, sharable

4343

Crucible: formal review

44

Simple workflow draft, review, summarize, close

Manage review workload target particular reviewers

Advanced features Pre-commit, Iterative, create from JIRA

44

45

How to get started

Go slowJust the diffsReview the scariest code!On demandOn assignment

4646

Common Hurdles to AdoptionIt takes too much time"Code reviews can get nasty""We have to stick to XYZ process""I don't want to leave my IDE"

4747

Four tips for better reviews

4848

#1:Strive for Ego-Free Reviews

49

#1: Ego-Free Reviews

No personal Pronouns No point scoring Moderator to police

50

#2:Dont be a

Pedant

51

#2: Dont be a Pedant

Use tools to enforce coding style, catch common errors

Look for the forest, not the trees

52

#3: Find Problems,

Not Solutions

53

#3: Find Problems, Not Solutions

Except for trivial fixes Pair program instead

54

#4: Embrace Feedback55

You will learn from it!You will learn to love it!

#4: Embrace Feedback

56

#include main(t,_,a)char *a;{return!0

57

blocky:~ brendan$ ./a.outOn the first day of Christmas my true love gave to mea partridge in a pear tree.On the second day of Christmas my true love gave to metwo turtle dovesand a partridge in a pear tree.On the third day of Christmas my true love gave to methree french hens, two turtle dovesand a partridge in a pear tree.On the fourth day of Christmas my true love gave to mefour calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the fifth day of Christmas my true love gave to mefive gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the sixth day of Christmas my true love gave to mesix geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the seventh day of Christmas my true love gave to meseven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.On the eighth day of Christmas my true love gave to meeight maids a-milking, seven swans a-swimming,six geese a-laying, five gold rings;four calling birds, three french hens, two turtle dovesand a partridge in a pear tree.

58

#include main(t,_,a)char *a;{return!0

59

6060

Search related