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

The Art of Code Review

The Art of Code Review

A talk about Code Review, given at LRUG in May 2016

John Cinnamond

May 09, 2016
Tweet

More Decks by John Cinnamond

Other Decks in Programming

Transcript

  1. S talkhub Talks Issues Pull requests Settings Actually, `Collaboration` and

    `Teamwork` are saying the same thing search This talk
  2. Studies show code review can… Detect bugs Save money Improve

    communication Prevent global warming Source: some company selling code review software
  3. Expectations, Outcomes, and Challenges of Modern Code Review Alberto Bacchelli

    & Christian Bird (2013) International Conference on Software Engineering, pages 712-721
  4. Think about the reviewer Do they know what I'm trying

    to achieve? Are they aware of any constraints?
  5. In the description… Explain what the new feature is. Explain

    why you made it. Suggest a path through the code.
  6. John's Top Tip #4 Keep change size < 400 lines

    Source: Cohen, Jason. (2006): The Best Kept Secrets of Peer Code Review.
  7. To maximise defect detection, use 2 reviewers Source: Rigby, Peter

    C, and Bird, Christian. (2013): Convergent Contemporary Software Peer Review Practices.
  8. Beware passive- aggressive questions Why did you use X here?

    Why did you use X here - are you some kind of idiot?
  9. Valid comments (7) There are no other valid comments. Code

    review is not the place for this discussion.
  10. John's Top Tip #14 Be yourself (unless you are a

    monstrous pedant, in which case be someone better)
  11. def any_values?(hash) return hash.values.size >= 0 end This is dumb

    Doesn't explain the problem Feels bad, man
  12. def any_values?(hash) return hash.values.size >= 0 end Return is unnecessary

    Maybe I should change it Your face is unnecessary
  13. def any_values?(hash) return hash.values.size >= 0 end This is equivalent

    to omitting the `return` The return is unnecessary
  14. def any_values?(hash) return hash.values.size >= 0 end What is the

    point of this method? Why are they asking?
  15. def any_values?(hash) return hash.values.size >= 0 end Why not ditch

    this method and call `hash.values.any?` directly? …