Download - Code review in practice
![Page 1: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/1.jpg)
Code Review
in practice Froscon 2011
Volker Dusch / @__edorian
![Page 2: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/2.jpg)
Me?
2 Introduction
![Page 3: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/3.jpg)
Volker Dusch
@__edorian
3 Introduction
![Page 4: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/4.jpg)
PHP for around 9 years
4 Introduction
![Page 5: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/5.jpg)
I‟m currently into TDD, CI,
Clean Code and shipping
5 Introduction
…amongst other stuff
![Page 6: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/6.jpg)
Just go and buy those
6 Introduction
*Book covers used under fair use
![Page 7: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/7.jpg)
Ask questions at any time!
7 Introduction
![Page 8: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/8.jpg)
We‟re gonna talk about
Code Review
8 Agenda
![Page 9: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/9.jpg)
Why do it?
9 Agenda
![Page 10: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/10.jpg)
What types exist?
10 Agenda
![Page 11: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/11.jpg)
How to do it?
11 Agenda
![Page 12: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/12.jpg)
My story!
12 Agenda
![Page 13: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/13.jpg)
Why do Code Review?
13 Why do Code Review?
![Page 14: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/14.jpg)
Define „Code Review‟
14 Why do Code Review?
'Code Review' describes the systematic
examination of source code
![Page 15: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/15.jpg)
Because code is written
by Humans
15 Why do Code Review?
![Page 16: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/16.jpg)
Because code is read
by Humans
16 Why do Code Review?
… a lot
![Page 17: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/17.jpg)
It‟s easy to write code
for machines
17 Why do Code Review?
… they will understand it
…well they will execute it
![Page 18: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/18.jpg)
But Humans think
differently of code
18 Why do Code Review?
![Page 19: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/19.jpg)
Mandatory Code Review Joke
19 Why do Code Review?
Used under Fair Use: © Focus Shift
![Page 20: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/20.jpg)
So.. Code Review
20 Why do Code Review?
![Page 21: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/21.jpg)
It‟s meant to improve
21 Why do Code Review?
![Page 22: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/22.jpg)
readability, maintainability
and stability or your code
22 Why do Code Review?
... so code quality
Improve
![Page 23: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/23.jpg)
the knowledge of
software developers
23 Why do Code Review?
Improve
![Page 24: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/24.jpg)
achieved by…
24 Why do Code Review?
![Page 25: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/25.jpg)
more people looking at
the code
25 Why do Code Review?
before the customer
experiences the changes
achieved by
![Page 26: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/26.jpg)
finding more bugs during
development
26 Why do Code Review?
achieved by
![Page 27: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/27.jpg)
making sure the code is
understandable by humans
27 Why do Code Review?
achieved by
![Page 28: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/28.jpg)
bringing devs together to
talk code
28 Why do Code Review?
leading to…
achieved by
![Page 29: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/29.jpg)
easier team growing
29 Why do Code Review?
or team building …
achieved by
![Page 30: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/30.jpg)
higher consistency
30 Why do Code Review?
formatting, architecture, …
achieved by
![Page 31: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/31.jpg)
easier & more mentoring
31 Why do Code Review?
because training people rocks!
achieved by
![Page 32: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/32.jpg)
Types of Code Review
32 Types of Code Review
![Page 33: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/33.jpg)
Over the shoulder
33 Types of Code Review
do you have a moment?
great! grab a chair
![Page 34: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/34.jpg)
This is what usually
happens anyways
34 Types of Code Review
doesn‟t matter what you call it
Over the shoulder
![Page 35: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/35.jpg)
People usually self organize
Create Events?!
35 Types of Code Review
Over the projector reviews
Over the shoulder
![Page 36: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/36.jpg)
Pair Programming
36 Types of Code Review
Code Review with 100% more
real time than similar products
![Page 37: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/37.jpg)
Instant feedback cycle
37 Types of Code Review
Every step of the way
Pair Programming
![Page 38: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/38.jpg)
Automated Code Review
38 Types of Code Review
computers can be so cruel
![Page 39: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/39.jpg)
a.k.a. static code analysis
39 Types of Code Review
phpmd, pDepend, phpcs,
phpunit, phpcpd, phpdcd phploc, phpcb, pfff
phantm, ppw I bet you couldn‟t read that during the presentation
![Page 40: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/40.jpg)
phpqatools.org
talk to people here!
40 Types of Code Review
„nuff said
![Page 41: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/41.jpg)
Before we talk about tools
41 Tools for Code Review
![Page 42: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/42.jpg)
Amount of code to review?
42 Type of Code Review
![Page 43: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/43.jpg)
Cycle based
43 Type of Code Review
Every Iteration maybe?
![Page 44: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/44.jpg)
Get everyone to together
44 Type of Code Review
Cycle based
![Page 45: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/45.jpg)
It might take a while
45 Type of Code Review
Cycle based
![Page 46: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/46.jpg)
but you get the big picture
46 Type of Code Review
Cycle based
![Page 47: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/47.jpg)
I think I‟m done with this
47 Type of Code Review
What do you think?
Feature based
![Page 48: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/48.jpg)
Feature based
48 Type of Code Review
Whenever something of value
is done for the first time
![Page 49: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/49.jpg)
Amout depends on
feature / task sizes
49 Type of Code Review
Feature based
![Page 50: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/50.jpg)
Avg. 4 hours per feature?
50 Type of Code Review
Feature based
Around two reviews per day
![Page 51: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/51.jpg)
Can be a short cylce
51 Type of Code Review
Feature based
![Page 52: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/52.jpg)
With big features / tasks you
might run into troube
52 Type of Code Review
Feature based
That‟s 3 weeks old!
I‟m not even sure I wrote it
![Page 53: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/53.jpg)
Gives devs. a changes to
get everything proper
53 Type of Code Review
Feature based
![Page 54: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/54.jpg)
Nice to make sure it really
meets the businesses case
54 Type of Code Review
Feature based
![Page 55: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/55.jpg)
Commit based
55 Type of Code Review
![Page 56: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/56.jpg)
Review every single checkin
56 Type of Code Review
Commit based
![Page 57: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/57.jpg)
just merges to master?
57 Type of Code Review
Commit based
„master‟ == „trunk‟
and those are feature based
reviews I‟d say
![Page 58: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/58.jpg)
Fast feedback
58 Type of Code Review
Commit based
![Page 59: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/59.jpg)
High traffic
59 Type of Code Review
Commit based
![Page 60: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/60.jpg)
Commit messages matter
60 Types of Code Review
Commit based
![Page 61: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/61.jpg)
Commit messages matter
A LOT!
61 Types of Code Review
Commit based
![Page 62: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/62.jpg)
Tell people why a
change was made
62 Types of Code Review
Commit based
If I want to know what it does
I‟ll read the code
![Page 63: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/63.jpg)
Make small commits
63 Types of Code Review
Commit based
As you should anyways
![Page 64: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/64.jpg)
Small as in under 100 LOC
64 Types of Code Review
Commit based
What? You have classes
bigger than that?
![Page 65: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/65.jpg)
Small as in change 3-4
places at most
65 Types of Code Review
Commit based
You shouldn‟t need to touch
everything. It‟s improper
![Page 66: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/66.jpg)
But that just would be
nice, it works anyways
66 Types of Code Review
Commit based
![Page 67: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/67.jpg)
Just don‟t review
reformattings
67 Types of Code Review
Commit based
![Page 68: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/68.jpg)
We‟ll get back to that
68 Types of Code Review
Commit based
![Page 69: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/69.jpg)
So let‟s talk Tools
69 Tools for Code Review
![Page 70: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/70.jpg)
Review Board
70 Tools for Code Review
Open Source (MIT!)
Eclipse Plugin
Post Commit Review
Discussions and so on
![Page 71: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/71.jpg)
Review Board
71 Tools for Code Review
Image used under fair use: http://www.reviewboard.org/screenshots/
![Page 72: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/72.jpg)
Review Board
72 Tools for Code Review
Image used under fair use: http://www.reviewboard.org/screenshots/
![Page 73: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/73.jpg)
Gerrit
73 Tools for Code Review
Open Source
Requires git as scm
Powerfull
![Page 74: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/74.jpg)
74 Tools for Code Review
Gerrit
Screenshots created from: https://review.source.android.com/
![Page 75: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/75.jpg)
75 Tools for Code Review
Gerrit
Screenshots created from: https://review.source.android.com/
![Page 76: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/76.jpg)
Fisheye / Crucible
76 Tools for Code Review
Commercial
By Atlassian (JIRA)
… if you use JIRA take a look
![Page 77: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/77.jpg)
SmartBear
CodeCollaborator
77 Tools for Code Review
Commercial
Review Board meets Enterprise
Eclipse & Visual Studio Plugins
![Page 78: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/78.jpg)
78 Tools for Code Review
CodeCollaborator
Image under fair use from: http://smartbear.com/images/products/codecollaborator/ccollab-feature-sidebyside.png
![Page 79: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/79.jpg)
email pass around
79 Tools for Code Review
You had me at HELO
![Page 80: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/80.jpg)
scm sends out a mail for
every commit
80 Tools for Code Review
or push or feature or whatever
![Page 81: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/81.jpg)
Is anyone here familiar
with “mailing lists”
81 Tools for Code Review
email pass around
![Page 82: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/82.jpg)
Does your mail client have a
“threaded view” button?
82 Tools for Code Review
All right, all we need
email pass around
![Page 83: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/83.jpg)
Point being:
Everyone has mail
83 Tools for Code Review
email pass around
![Page 84: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/84.jpg)
No additional tools
84 Tools for Code Review
email pass around
That‟s also why IDE Plugins rock
![Page 85: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/85.jpg)
No interface learning
85 Tools for Code Review
email pass around
![Page 86: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/86.jpg)
Your process!
Not the one of the tool
86 Tools for Code Review
email pass around
But if a tool enforces a process
it might not be a good tool
![Page 87: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/87.jpg)
Very fast cylce times
87 Tools for Code Review
email pass around
20 sec to 2 minutes per commit
![Page 88: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/88.jpg)
Enough with the tools
already! Let‟s go!
88 Tools for Code Review
![Page 89: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/89.jpg)
The first rule
of Code Review is
89 How to review code
![Page 90: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/90.jpg)
90 How to review code
The first rule of code review
![Page 91: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/91.jpg)
91 How to review code
The first rule of code review
Well.. not really
but it helps a lot!v
![Page 92: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/92.jpg)
92 How to review code
The first rule of code review
Get everyone involved!
![Page 93: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/93.jpg)
93 How to review code
The first rule of code review
No code is scared
![Page 94: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/94.jpg)
94 How to review code
The first rule of code review
Everyone gives feedback
start with your juniors so they
learn and don‟t just agree
![Page 95: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/95.jpg)
95 How to review code
The first rule of code review
Remember:
It‟s about the code
Not who wrote it
![Page 96: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/96.jpg)
96 How to review code
What to look for?
![Page 97: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/97.jpg)
97 How to review code
What to look for?
Image used under CC-BY-ND http://creativecommons.org/licenses/by-nd/2.0/en/
Creator: Oliver Widder http://geekandpoke.typepad.com/geekandpoke/2010/11/how-to-make-a-good-code-review.html
![Page 98: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/98.jpg)
98 How to review code
It depends on the type
of code review
But let‟s get though my
suggestions and we‟ll see
What to look for?
![Page 99: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/99.jpg)
99 How to review code
Does it implement the
business case?
Issue Tracking/Stories help a lot
What to look for?
![Page 100: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/100.jpg)
100 How to review code
Intent and purpose over
actual words on paper
or hard disk…
What to look for?
![Page 101: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/101.jpg)
101 How to review code
Does it fit into the
applications architecture?
My code always uses
SpecialDbConnect7
because I wrote that class!
What to look for?
![Page 102: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/102.jpg)
102 How to review code
Overlooked edge cases?
$date = new DateTime can
throw an exception?!
I <2 off by one errors
What to look for?
![Page 103: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/103.jpg)
103 How to review code
Is it tested?
Is is maintainable?
My class does everything we‟ll
ever need, no need to worry
about OO right?
What to look for?
![Page 104: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/104.jpg)
104 How to review code
Does it conform to
coding rules?
What to look for?
![Page 105: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/105.jpg)
105 How to review code
Does it conform to
coding rules?
What to look for?
You seem to be doing a
machines job. Do you want
some help?
![Page 106: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/106.jpg)
106 How to review code
Let tools do what tools
can do.
What to look for?
They are better at some things
and nobody gets mad at
someone when they nag you
a lot. Just make good rules
![Page 107: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/107.jpg)
107 How to review code
The things your rules can‟t
catch.. you‟ll notice
What to look for?
Promise
![Page 108: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/108.jpg)
108 How to review code
Is it going to confuse your
users in unintended ways?
What to look for?
Confusing them in intended
ways is called major release
Cookie lifetime now 5 minutes?
Reddit says is more secure!!1
![Page 109: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/109.jpg)
109 How to review code
Is there a simpler way?
What to look for?
"When debugging, novices
insert corrective code; experts
remove defective code"
Richard Pattis
![Page 110: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/110.jpg)
110 How to review code
performance impacts?
What to look for?
SQL is hard, at times
Look out for everything that
leaves PHP (io)
![Page 111: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/111.jpg)
111 How to review code
Duplicate functionality?
What to look for?
The bigger your projects the
more ways of achieving the
same result?
![Page 112: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/112.jpg)
112 How to review code
And for the closer:
What to look for?
![Page 113: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/113.jpg)
113 How to review code
Is it easy to understand
What to look for?
$important = getTRWTF(„daily‟);
![Page 114: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/114.jpg)
114 How to review code
Does it take you longer
than a minute to grasp?
Easy to understand?
Is it the code or the commit
message that doesn‟t help?
![Page 115: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/115.jpg)
115 Questions so far?
All right
Story time
![Page 116: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/116.jpg)
116 STOP! STORYTIME!
Soo… code review
at our company
![Page 117: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/117.jpg)
117 Code Review in our Comp
Do you remember 2006?
![Page 118: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/118.jpg)
118 Code Review in our Comp
Let me help you out
2006, meet Froscon <?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$files[] = $file;
}
}
// closedir($handle); php closes on request end
}
if(!isset($files)) {
die();
}
?>
![Page 119: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/119.jpg)
119 Code Review in our Comp
How it started back then
![Page 120: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/120.jpg)
120 Code Review in our Comp
I was a working student
How it started
![Page 121: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/121.jpg)
121 Code Review in our Comp
One day we installed
„WebSvn‟
How it started
Subversion repository browser
![Page 122: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/122.jpg)
122 Code Review in our Comp
And that came with a
simple RSS Feed
How it started
![Page 123: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/123.jpg)
123 Code Review in our Comp
I started asking
a lot of questions
How it started
And nobody stopped me
![Page 124: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/124.jpg)
124 Code Review in our Comp
And even more questions
How it started
At some point I started sending
out one mail per dev per week
with comments and questions
about the code they commited
![Page 125: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/125.jpg)
125 Code Review in our Comp
At some day it „suddenly‟
was a part of my job
How it started
I don‟t think I ever heard the
term „Code Review‟ before
that point. I was just asking ;)
![Page 126: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/126.jpg)
126 Code Review in our Comp
So there I was
looking at feeds a lot
How it started
![Page 127: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/127.jpg)
127 Code Review in our Comp
In the next Year our
company grew. A lot!
![Page 128: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/128.jpg)
128 Code Review in our Comp
I had Scalability Issues
Growing
class __edorian {
[…] // Those darn Singletons
private function __clone() {}
}
![Page 129: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/129.jpg)
129 Code Review in our Comp
So something needed to
be done
Growing
![Page 130: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/130.jpg)
130 Code Review in our Comp
We already had
collective code ownership
Growing
![Page 131: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/131.jpg)
131 Code Review in our Comp
At least nobody thought
it was „his‟ code
Growing
![Page 132: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/132.jpg)
132 Code Review in our Comp
We also didn‟t want to
stop with Code Review
Growing
![Page 133: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/133.jpg)
133 Code Review in our Comp
So everybody agreed to
do peer-reviews
Growing
We already talked a lot before
but now we added per
commit reviews
![Page 134: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/134.jpg)
134 Code Review in our Comp
I‟ve tried many tools
Growing
![Page 135: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/135.jpg)
135 Code Review in our Comp
Nothing worked out well
Growing
I also didn‟t have a vision what
exactly I was looking for.
That didn‟t help
![Page 136: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/136.jpg)
136 Code Review in our Comp
Everything felt complicated
and time intensive
Growing
![Page 137: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/137.jpg)
137 Code Review in our Comp
I was spending WAY to
much time on reviews
Growing
![Page 138: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/138.jpg)
138 Code Review in our Comp
So we needed a solution
Growing
![Page 139: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/139.jpg)
139 Code Review in our Comp
That was 9 month ago
Getting it solved
![Page 140: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/140.jpg)
140 Code Review in our Comp
Enter Qafoo
Getting it solved
![Page 141: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/141.jpg)
141 Code Review in our Comp
It took two days!
Getting it solved
![Page 142: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/142.jpg)
142 Code Review in our Comp
We discussed all possible
solutions with the team
and agreed that email
pass-around would work
Getting it solved
![Page 143: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/143.jpg)
143 Code Review in our Comp
Getting it solved
We implemented a svn-post-commit-hook using
the “php-commit-hooks” from @korend svn://kore-nordmann.de/php-commit-hooks
Also check out vcs_wrapper, a part of Arbit
http://kore-nordmann.de/blog/vcs_wrapper_development.html
We needed to extending one class to hack in
your mail solution and since then I haven‟t
touched that code, it just worked
Well ok, we adjusted the “commiter <-> reviewer”
mapping array many times and created special
review circels for some projects
![Page 144: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/144.jpg)
144 Code Review in our Comp
Then we created a workflow
for our environment
Getting it solved
![Page 145: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/145.jpg)
145 Code Review in our Comp
Oh, environment
Getting it solved
![Page 146: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/146.jpg)
146 Code Review in our Comp
Exchange and Outlook
Getting it solved
![Page 147: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/147.jpg)
147 Code Review in our Comp
- Distribution list in exchange
- commit hook mails there
- Mails get marked as “you should review
that” in the subject line using filter “ |fo|ba|etc| Repo Rev Commit”
- Outlook marks those mails as important.( ! ) - Dev respons with status code (#ok,
#note, #error) and an explanation
- that‟s really really fast btw.
- read, CTRL+L, type #ok, CTRL+ENTER, done
- Continue mailing until the issue is resolved
Workflow
![Page 148: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/148.jpg)
148 Code Review in our Comp
It looks like this
![Page 149: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/149.jpg)
149 Code Review in our Comp
One review cylce
![Page 150: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/150.jpg)
150 Code Review in our Comp
Getting feedback
![Page 151: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/151.jpg)
151 Code Review in our Comp
The commit
![Page 152: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/152.jpg)
152 Code Review in our Comp
What we don‟t do
![Page 153: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/153.jpg)
153 Code Review in our Comp
We don‟t review…
What we don’t do
“Cleanup commits” - We trust our tools
“Buisiness case” - Takes to long. Trust devs
“Maintainability” - For the older stuff
“Performance Impact” - If it isn‟t obvious
With those changes it works out quite nicely
![Page 154: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/154.jpg)
154 Your turn Froscon
So far that‟s our Story
Now I‟d like to hear yours
![Page 155: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/155.jpg)
155 Questions?
Just a moment:
Any open questions?
![Page 156: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/156.jpg)
156 Tell me!
Do you already do code reviews?
Share your exerience!
What tools, what types, what works?
Problems you ran into?
![Page 157: Code review in practice](https://reader034.vdocuments.pub/reader034/viewer/2022051412/54b729b74a7959022d8b458c/html5/thumbnails/157.jpg)
157 Thanks a lot!
Thank you for your time!