Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Code review beyond code style - PHP UK Conference

Code review beyond code style - PHP UK Conference

Reviewing code can feel like a secondary task. Discussing code can be easy though,
if you leave out syntax details. Following a couple of guide lines for pull requests can make code reviewing much easier.

Some code style rules can drastically reduce the mental overhead needed to understand code changes. Furthermore this talk will give some general guidelines on how to give feedback on PRs as a peer developer or coworker. These rules are not to keep for yourself, share them with your peers and your life will get easier.

Hannes Van De Vreken

February 17, 2017
Tweet

More Decks by Hannes Van De Vreken

Other Decks in Technology

Transcript

  1. Code reviews
    @hannesvdvreken
    @PHPUKConference

    View full-size slide

  2. Hi, my name is Hannes.

    View full-size slide

  3. madewithlove.be

    View full-size slide

  4. Code reviews

    View full-size slide

  5. What’s a code review?

    View full-size slide

  6. push commits
    review commits
    reply
    approve

    View full-size slide

  7. push commits
    review commits
    reply
    approve

    View full-size slide

  8. git add -p
    WHAT MAKES A CODE REVIEW?

    View full-size slide

  9. Why spend time on that?

    View full-size slide

  10. Submitter
    WHY SPEND TIME ON THAT?

    View full-size slide

  11. Reviewer
    WHY SPEND TIME ON THAT?

    View full-size slide

  12. Management
    WHY SPEND TIME ON THAT?

    View full-size slide

  13. @PHP_CEO
    YOU THINK DEPLOYING HUNDREDS OF
    TIMES A DAY IS COOL?
    WE DEPLOY *INFINITY* TIMES A DAY BY
    CUTTING OUT THE MIDDLEMAN AND EDITING
    LIVE CODE

    View full-size slide

  14. What should a submitter do?

    View full-size slide

  15. Intermezzo: code style

    View full-size slide

  16. PSR-2 (soon PSR-12)
    Symfony code style

    View full-size slide

  17. multiline_array_trailing_comma

    View full-size slide

  18. phpdoc_params
    align_double_arrow
    align_equals

    View full-size slide

  19. new_with_braces

    View full-size slide

  20. What should a reviewer do?

    View full-size slide

  21. don’ts ❌
    WHAT SHOULD A REVIEWER DO?

    View full-size slide

  22. do ✓
    WHAT SHOULD A REVIEWER DO?

    View full-size slide

  23. OMG I'M A BIG FAN OF UR
    CODES
    LANGUAGE

    View full-size slide

  24. Thank you!
    https:/
    /joind.in/talk/7a944
    @hannesvdvreken
    @PHPUKConference

    View full-size slide

  25. Time for questions.
    @hannesvdvreken
    @PHPUKConference

    View full-size slide