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

DevoxxFR 2016: How to stop wasting your time and start performing useful code reviews

DevoxxFR 2016: How to stop wasting your time and start performing useful code reviews

MKhalusova

April 22, 2016
Tweet

More Decks by MKhalusova

Other Decks in Programming

Transcript

  1. #DevoxxFR How to stop wasting your time and start performing

    useful code reviews Maria Khalusova, JetBrains @mariakhalusova 1
  2. #DevoxxFR Roadmap 2 Code review benefits Where to begin? How

    to make code reviews efficient? What to look for? Code review feedback @mariakhalusova
  3. #DevoxxFR Code review benefits 4 Finding bugs Knowledge sharing Faster

    on-boarding Better team collaboration Easier code maintenance Increased “Bus Factor” Improved code quality @mariakhalusova
  4. #DevoxxFR Team 7 Set the goals and communicate them clearly

    Listen to concerns Cultivate code review culture @mariakhalusova
  5. #DevoxxFR Process 9 Where does it fit? Keep your workflow

    simple Don’t be scared of iterations Average of 2 reviewers Review often @mariakhalusova
  6. #DevoxxFR New tool 10 The right code review tool: •

    Fits in your environment • Supports your workflow • Doesn’t stand in your way @mariakhalusova
  7. #DevoxxFR Summary 11 • Talk to your team • Consider

    the process and overall change impact • Find the right tool @mariakhalusova
  8. #DevoxxFR Automate what you can 13 Tests Continuous Integration Static

    Code Analysis Spellchecker etc. @mariakhalusova
  9. #DevoxxFR As code author 15 Review your own code Commit

    small changes Document your code Provide meaningful commit message @mariakhalusova
  10. #DevoxxFR As reviewer 16 Don’t postpone it Don’t spend too

    much time on a review Keep in mind project’s priorities Apply your expertise @mariakhalusova
  11. #DevoxxFR General and business logic 18 Correctness Coding errors Business

    rules and logic User-facing messages @mariakhalusova
  12. #DevoxxFR Architecture and design 19 Is the code in the

    right place? Reusability Data structures SOLID YAGNI (You Aren't Gonna Need It) @mariakhalusova
  13. #DevoxxFR Readability & Maintainability 20 Naming Readability Documentation Test coverage

    @mariakhalusova Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. - John F. Woods (1991)
  14. #DevoxxFR Performance 21 @mariakhalusova Performance requirements Performance tests Common causes

    of performance problems, e.g.: • Unnecessary networks calls • Potential memory leaks • Not closed connections/streams • Too many calls to the database
  15. #DevoxxFR Security 22 @mariakhalusova Third-party libraries Authentication Data encryption Proper

    management of passwords/encryption keys, etc. Potential issues
  16. #DevoxxFR Giving feedback: reasons 26 @mariakhalusova • There’s a problem

    • To help someone improve • To start a discussion • To praise good work • Because of the pressure to find a problem • To boost own ego
  17. #DevoxxFR Code review feedback manners 27 @mariakhalusova • Leave feedback

    if your goal is improvement • Appropriate timing and place • Indicate when you’re done with a review • Discuss changes, not people • Carefully consider wording
  18. #DevoxxFR Giving feedback: wording 28 @mariakhalusova Don’t be rude.
 “WTF

    is this?” Assume the code author is intelligent and qualified
 “This will not work if…” vs “What happens if..?” Avoid using “obviously”, “simply” Avoid possessive adjectives
 “Your method returns…” vs “This method returns…”
  19. #DevoxxFR Giving code review feedback 29 @mariakhalusova Be specific Don’t

    demand, ask questions Don’t use sarcasm Suggest alternatives
  20. #DevoxxFR Receiving feedback 30 @mariakhalusova Acknowledge that feedback helps you

    improve Invite teammates to review your code Separate criticism from self Immediate reaction isn’t always the best one Ask questions Be grateful for the feedback