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

Protecting Your Source: Using Code Review To Im...

Avatar for maltzj maltzj
March 27, 2018
780

Protecting Your Source: Using Code Review To Improve Your Application Quality (Droidcon BostonĀ 2018)

Avatar for maltzj

maltzj

March 27, 2018
Tweet

Transcript

  1. • Why do Code Review • Basic Code Review Outline

    • How to give code review feedback • How to find the right code to review What Will We Talk About?
  2. • You understand the goal of the change • You

    understand what is out of scope • You understand any high-level decisions What’s Success?
  3. • Jumping into a code review right away • Not

    calling for backup as necessary ā—¦ Especially important at boundaries Failure Modes?
  4. • High-level design feedback • Bug-finding + edge case coverage

    • Test coverage • Sharing new patterns What’s Success?
  5. • Commenting on anything a tool can catch ā—¦ PMD

    ā—¦ Checkstyle ā—¦ Findbugs ā—¦ Pre-commit hooks ā—¦ Google Java format • Can’t catch things with a tool but always disagree on them? Come to a consensus and move on What’s Failure?
  6. • Be conscious of burying teammates in code reviews •

    Try to get prioritize shipping 1 or 2 reviews before submitting more. • If your teammates are being slow to turnaround code reviews, don’t submit more How to avoid?
  7. • Discussion + collaboration • Individual ownership • People actively

    wanting to receive peer feedback What do you want to encourage?
  8. • ā€œYour style here is inconsistent. Align your braces with

    our code styleā€ • ā€œThis has a bug when running on Lollipop which will cause a crash. Fix itā€ • ā€œWhy did you do this refactor? The code was better in its previous formā€ What to avoid?
  9. The style guidelines say you should put braces on the

    same line, and this code puts braces on a new line. Align your braces with our styleguide.
  10. The style guidelines say you should put braces on the

    same line, and this code puts braces on a new line. Can you align your braces with our styleguide?
  11. The style guidelines say we should put braces on the

    same line, and this code puts braces on a new line. Can we align our braces with our styleguide?
  12. The style guidelines say we should put braces on the

    same line, and this code puts braces on a new line. Let’s align our braces with our styleguide.
  13. On a scale of 1-10, I care about this at

    a 5. What about you? What are your major concerns?
  14. • Different concerns? Find a third way • Large Difference?

    Principle of the person who cares the most in the code review. ā—¦ Protip: This shouldn’t always be you • Both high? Maybe need to make a larger decision What to do with this?
  15. • Things that need to be fixed before shipping ā—¦

    Bugs, major code smells, lacking test coverage • E.g: Kitkat doesn’t support elevation, which means this will crash on older devices. Can we use ViewCompat instead? What’s it look like?
  16. • Suggestions, ideas, or opportunities that may have been missed

    ā—¦ Alternate design, renaming, opportunistic refactoring • E.g: Not sure if this is a good idea, but what if we changed this code to use a builder pattern instead of some static factories? What’s it look like?
  17. Opportunity 0 āˆž Risk 0 āˆž Don’t do them unless

    assigned Review for blocking feedback
  18. Opportunity 0 āˆž Risk 0 āˆž Don’t do them unless

    assigned Review for blocking feedback Do you have a plan?
  19. Opportunity 0 āˆž Risk 0 āˆž Don’t do them unless

    assigned Review for blocking feedback Add non- blocking feedback Do you have a plan?
  20. Non-Blocking: This class has always felt a little clunky to

    me. Now that we’re in here, what if we clean it up a bit?
  21. • Argue both sides of the case • Call-out a

    problem without suggesting a solution • Invite them to pair with you How to deal with this?
  22. • Make sure to not overwhelm your teammates with code

    reviews • Phrase your feedback as a question • Don’t always be the person who cares the most Three Big Takeaways
  23. • Yelp’s Code Review Guidelines • Writing Commit Messages •

    How to use code review to execute someone’s soul • Creating a strong code review culture • Honesty, Kindness, Inspiration: Pick Three • bettercode.reviews • Giving and getting technical help • Crucial Conversations • Pre-commit External Links