Code Review

34
ENTER Code Peer Reviews Leave your ego at the door 02.06.2014 Frank Sons – IPC Berlin 201

description

Code review talk from the International PHP conference

Transcript of Code Review

Page 1: Code Review

ENTER

Code Peer Reviews

Leave your ego at the door

02.06.2014 Frank Sons – IPC Berlin 2014

Page 2: Code Review

Who am I?

Software Quality Engineer

Doing PHP/Java/etc. for ~15 years

PHP Usergroup Hamburg

Twitter: @FrankS

Still learning

202.06.2014 Frank Sons – IPC Berlin 2014

Page 3: Code Review

So, what‘s this about?

Introducing Reviews

Collective Coder Ownership

The right tool for the right job

Beware the dragons!

302.06.2014 Frank Sons – IPC Berlin 2014

Page 4: Code Review

A short introduction to reviews

Forget about the code for a moment…

402.06.2014 Frank Sons – IPC Berlin 2014

Page 5: Code Review

Reviews aren‘t limited to code…

502.06.2014 Frank Sons – IPC Berlin 2014

Page 6: Code Review

What‘s the idea?

6

Code Reviews are intended to find and fix mistakes overlooked in the initial

development phase, improving both the overall quality of software and the

developers' skills.

Wikipedia: Code review

02.06.2014 Frank Sons – IPC Berlin 2014

Page 7: Code Review

Back to code reviews…

IBM: Inspection introduced 1970s

7

Strict checklist for approval

02.06.2014 Frank Sons – IPC Berlin 2014

Absolutely not agile

Page 8: Code Review

„That‘s not my code!“

Collective code ownership is a mindset

802.06.2014 Frank Sons – IPC Berlin 2014

Page 9: Code Review

What about the ego?

9

“Everyone has the right and freedom to totally suck in private.”

Jeff Atwood - @codinghorror

02.06.2014 Frank Sons – IPC Berlin 2014

Page 10: Code Review

Forget about your ego!

10

“Attempt to be awesome in public and embrace the suck!”

Jeff Atwood - @codinghorror

02.06.2014 Frank Sons – IPC Berlin 2014

Page 11: Code Review

Reviews are knowledge sharing!

1102.06.2014 Frank Sons – IPC Berlin 2014

Page 12: Code Review

Share within your team…

Product knowledge

Technical knowledge

Coding Standards

Transparency

1202.06.2014 Frank Sons – IPC Berlin 2014

Page 13: Code Review

Finding the right review method

What do you want to do today?

1302.06.2014 Frank Sons – IPC Berlin 2014

Page 14: Code Review

Just a second…

14

“Hey, you got a minute? I need some help with a small problem.”

02.06.2014 Frank Sons – IPC Berlin 2014

Page 15: Code Review

Ad hoc

Takes only a few minutes

15

Happens anywhere

02.06.2014 Frank Sons – IPC Berlin 2014

Little impact beyond problem

Page 16: Code Review

Talk to the duck

1602.06.2014 Frank Sons – IPC Berlin 2014

Page 17: Code Review

Take a look please…

17

“Can you take a look at my code please? Here is the branch.”

02.06.2014 Frank Sons – IPC Berlin 2014

Page 18: Code Review

Peer deskcheck

Can be done asynchronous

18

Great for reviewing lots of code

02.06.2014 Frank Sons – IPC Berlin 2014

Review tools work this way

Page 19: Code Review

We are agile!

19

“Let’s do this together!”

02.06.2014 Frank Sons – IPC Berlin 2014

Page 20: Code Review

Pair programming

Driver and Navigator

20

Rapid Iterations

02.06.2014 Frank Sons – IPC Berlin 2014

Review on the fly

Page 21: Code Review

Let me show you…

21

“Let me show you my code.”

02.06.2014 Frank Sons – IPC Berlin 2014

Page 22: Code Review

Walkthrough

Author explains code

Developers ask Questions

Ideal to present and educate

Risk of overlooking critical code

2202.06.2014 Frank Sons – IPC Berlin 2014

Page 23: Code Review

We want maintainable code

23

Do you understand my code?

02.06.2014 Frank Sons – IPC Berlin 2014

Page 24: Code Review

„Code Reading“

Reader doesn‘t know code

Other devs: „Eagle Eye view“

Author answers questions

Specific code section

2402.06.2014 Frank Sons – IPC Berlin 2014

Page 25: Code Review

Beware the dragons!

It can be tricky…

2502.06.2014 Frank Sons – IPC Berlin 2014

Page 26: Code Review

Egoless!

26

My ego ist not tied to my “perfect” or “imperfect” work product

Jeff Atwood - @codinghorror

02.06.2014 Frank Sons – IPC Berlin 2014

Page 27: Code Review

Avoid the dragons

Leave the egos at the door

No fingerpointing

Follow up after review

Don‘t abuse result

Lack of knowledge

2702.06.2014 Frank Sons – IPC Berlin 2014

Page 28: Code Review

Keep this in mind

Three to seven participants

Keep it at two hours max

Think loud

Find problems not solutions

Review coverage vs. Project size

2802.06.2014 Frank Sons – IPC Berlin 2014

Page 29: Code Review

You will see the benefits

Code will be understandable

Knowledge is spread

Improves communication

Light house effects

2902.06.2014 Frank Sons – IPC Berlin 2014

Page 30: Code Review

JUST DO IT!

3002.06.2014 Frank Sons – IPC Berlin 2014

Page 31: Code Review

This helps…

3102.06.2014 Frank Sons – IPC Berlin 2014

Page 32: Code Review

Enjoy your reviews!

Reviews can help your team

32

Reviews are all about the mindset

02.06.2014 Frank Sons – IPC Berlin 2014

Don‘t fear the dragons

Page 33: Code Review

Feedback welcome!

[email protected]

Twitter: @FrankS

slideshare.net/frank_sons

Ask for a card ;-)

3302.06.2014 Frank Sons – IPC Berlin 2014

Page 34: Code Review

Thanks!

Hope you enjoyed it!

3402.06.2014 Frank Sons – IPC Berlin 2014