Code Reviews - PHP Unconference Europe 2013

29
ENTER Code Peer Reviews Leave your ego at the door 05.05.2013 Frank Sons – PHP Unconference Europe 20

description

Revised Code Review presentation from the PHP Unconference Europe 2013 in Berlin

Transcript of Code Reviews - PHP Unconference Europe 2013

Page 1: Code Reviews - PHP Unconference Europe 2013

ENTER

Code Peer Reviews

Leave your ego at the door

05.05.2013 Frank Sons – PHP Unconference Europe 2013

Page 2: Code Reviews - PHP Unconference Europe 2013

Who am I?

Software Quality Engineer

Doing PHP/Java/etc. for ~15 years

PHP Usergroup Hamburg

Still learning!

05.05.2013 2Frank Sons – PHP Unconference Europe 2013

Page 3: Code Reviews - PHP Unconference Europe 2013

So, what‘s this about?

Introducing Reviews

Collective Coder Ownership

The right review for the right job

Beware the dragons!

05.05.2013 3Frank Sons – PHP Unconference Europe 2013

Page 4: Code Reviews - PHP Unconference Europe 2013

A short introduction to reviews

Forget about the code for the moment…

05.05.2013 Frank Sons – PHP Unconference Europe 2013 4

Page 5: Code Reviews - PHP Unconference Europe 2013

What‘s the idea?

05.05.2013 5Frank Sons – PHP Unconference Europe 2013

Peer review methods are employed to maintain standards, improve

performance and provide credibility.

Wikipedia: Peer review

Page 6: Code Reviews - PHP Unconference Europe 2013

Reviews aren‘t limited to code…

05.05.2013 6Frank Sons – PHP Unconference Europe 2013

Page 7: Code Reviews - PHP Unconference Europe 2013

Back to code reviews…

IBM: Inspection introduced 1970s

05.05.2013 7Frank Sons – PHP Unconference Europe 2013

Google: 20% rule used for reviews

Page 8: Code Reviews - PHP Unconference Europe 2013

„That‘s not my code!“

Collective code ownership is a mindset

05.05.2013 Frank Sons – PHP Unconference Europe 2013 8

Page 9: Code Reviews - PHP Unconference Europe 2013

What about the ego?

05.05.2013 9Frank Sons – PHP Unconference Europe 2013

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

Jeff Atwood - @codinghorror

Page 10: Code Reviews - PHP Unconference Europe 2013

Forget about your ego!

05.05.2013 10Frank Sons – PHP Unconference Europe 2013

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

Jeff Atwood - @codinghorror

Page 11: Code Reviews - PHP Unconference Europe 2013

Reviews are knowledge sharing!

05.05.2013 11Frank Sons – PHP Unconference Europe 2013

Page 12: Code Reviews - PHP Unconference Europe 2013

Share within your team…

Product knowledge

Technical knowledge

Coding Standards

Transparency

05.05.2013 12Frank Sons – PHP Unconference Europe 2013

Page 13: Code Reviews - PHP Unconference Europe 2013

Finding the right review method

What do you want to do today?

05.05.2013 Frank Sons – PHP Unconference Europe 2013 13

Page 14: Code Reviews - PHP Unconference Europe 2013

Ad hoc

Just ask someone

Takes only a few minutes

Happens everywhere

Little impact beyond problem

Completely informal

05.05.2013 14Frank Sons – PHP Unconference Europe 2013

Page 15: Code Reviews - PHP Unconference Europe 2013

Peer deskcheck / pass around

Asking someone for input

Can be done asynchronous

Author is not present

Good for mentoring and coaching

Very informal

05.05.2013 15Frank Sons – PHP Unconference Europe 2013

Page 16: Code Reviews - PHP Unconference Europe 2013

Pair programming

Agile approach

Driver and Navigator

Rapid Iterations

Cultural change needed

Informal review

05.05.2013 16Frank Sons – PHP Unconference Europe 2013

Page 17: Code Reviews - PHP Unconference Europe 2013

Walkthrough

Author explains code

Code reading

Ideal to present and educate

Risk of overlooking critical code

Informal, no defined process

05.05.2013 17Frank Sons – PHP Unconference Europe 2013

Page 18: Code Reviews - PHP Unconference Europe 2013

Inspection

Most formal approach

Industry standard

Specific roles and trained inspectors

Checklist

Moderated review

05.05.2013 18Frank Sons – PHP Unconference Europe 2013

Page 19: Code Reviews - PHP Unconference Europe 2013

„Inspection Walkthrough“

Reader doesn‘t know code

Experienced dev: „eagle eye“ view

Author explains / answers questions

Specific code section

No Leads involved

05.05.2013 19Frank Sons – PHP Unconference Europe 2013

Page 20: Code Reviews - PHP Unconference Europe 2013

Beware the dragons!

It can be tricky…

05.05.2013 Frank Sons – PHP Unconference Europe 2013 20

Page 21: Code Reviews - PHP Unconference Europe 2013

Egoless!

05.05.2013 21Frank Sons – PHP Unconference Europe 2013

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

Page 22: Code Reviews - PHP Unconference Europe 2013

Avoid the dragons

No fingerpointing

Leave the egos at the door

Resistance to change

Lack of knowledge

Cultural issues

05.05.2013 22Frank Sons – PHP Unconference Europe 2013

Page 23: Code Reviews - PHP Unconference Europe 2013

Keep this in mind

Three to seven participants

Keep it at two hours max

Involve Managers in planning

Find problems not solutions

Review coverage vs. Project size

05.05.2013 23Frank Sons – PHP Unconference Europe 2013

Page 24: Code Reviews - PHP Unconference Europe 2013

You will see the benefits

Code will be understandable

Knowledge is spread

Improves communication

Light house effects

05.05.2013 24Frank Sons – PHP Unconference Europe 2013

Page 25: Code Reviews - PHP Unconference Europe 2013

JUST DO IT!

05.05.2013 Frank Sons – PHP Unconference Europe 2013 25

Page 26: Code Reviews - PHP Unconference Europe 2013

This helps…

05.05.2013 26Frank Sons – PHP Unconference Europe 2013

Page 27: Code Reviews - PHP Unconference Europe 2013

Enjoy your reviews!

Reviews can help your team

Reviews are all about the mindset

Don‘t fear the dragons

05.05.2013 27Frank Sons – PHP Unconference Europe 2013

Page 28: Code Reviews - PHP Unconference Europe 2013

Liked it? Contact me!

[email protected]

Twitter: @FrankS

slideshare.net/frank_sons

Ask for a card ;-)

05.05.2013 28Frank Sons – PHP Unconference Europe 2013

Page 29: Code Reviews - PHP Unconference Europe 2013

Thanks!

05.05.2013 29