Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Compassionate (Yet Candid) Code Reviews

879 views

Published on


Code reviews are essential for maintaining code quality and helping developers sharpen their coding skills. However, code reviews are also difficult to get right. Many code review comments end up being unclear, trivial, or condescending.

With compassion as a guideline, though, we can work to establish code review practices that minimize suffering for everyone involved—the code authors, the code reviewers, the code maintainers, and even the end users.

In this talk, you’ll learn that Compassionate Code Reviews are not about “sugarcoating” feedback and actually demand a considerable degree of candor. Equipped with a set of guidelines for executing Compassionate Code Reviews, you’ll leave inspired to apply them on your team to create better code and happier coders.

Delivered September 5, 2018 at try! Swift NYC

Published in: Software

Compassionate (Yet Candid) Code Reviews

  1. 1. COMPASSIONATE (YET CANDID) CODE REVIEWS COMPASSIONATE CODING @APRILWENSEL
  2. 2. SOFTWARE ENGINEER & TECHNICAL LEADER
  3. 3. VOLUNTEER CODING INSTRUCTOR & MENTOR
  4. 4. @APRILWENSEL THERE’S A LOT OF SUFFERING IN SOFTWARE
  5. 5. • STRESS & BURNOUT • “TALENT SHORTAGE” • LACK OF DIVERSITY • POOR UX • UNETHICAL PRODUCTS • FAILED PROJECTS @APRILWENSEL SUFFERING IN SOFTWARE
  6. 6. WE DON’T CARE ENOUGH ABOUT HUMANS@APRILWENSEL
  7. 7. COMPASSIONATE CODING @APRILWENSEL ✦ TRAINING ✦ COACHING ✦ CONSULTING ✦ SPEAKING ✦ WRITING A CONSCIOUS BUSINESS BRINGING EMOTIONAL INTELLIGENCE & ETHICS TO THE TECH INDUSTRY THROUGH
  8. 8. IS NOT BEING FAKE NICE @APRILWENSEL COMPASSION
  9. 9. IS NOT BEING “POLITE” @APRILWENSEL COMPASSION
  10. 10. IS NOT PITY @APRILWENSEL COMPASSION
  11. 11. @APRILWENSEL COMPASSION “THE FEELING THAT ARISES WHEN YOU ARE CONFRONTED WITH ANOTHER’S SUFFERING AND FEEL MOTIVATED TO RELIEVE THAT SUFFERING” https://greatergood.berkeley.edu/topic/compassion/definition
  12. 12. @APRILWENSEL BEING VEGAN MEANS FEELING COMPASSION FOR ALL BEINGS 617 9th Avenue (between 43rd & 44th St.)
  13. 13. COMPASSION IS GOOD FOR THE BOTTOM LINE @APRILWENSEL
  14. 14. “THE COMPASSIONATE [BUSINESS] UNITS EXHIBITED BETTER FINANCIAL PERFORMANCE…AND THESE UNITS REALIZED HIGHER EMPLOYEE AND CUSTOMER RETENTION.” Monica Worline & Jane Dutton Awakening Compassion at Work @APRILWENSEL
  15. 15. "PEOPLE IN POSITIVE WORK ENVIRONMENTS OUTPERFORM THOSE WHO WORK IN NEGATIVE CLIMATES BY 10-30%." Shawn Murphy The Optimistic Workplace @APRILWENSEL
  16. 16. COMPASSION IS GOOD FOR YOU @APRILWENSEL
  17. 17. BENEFITS OF COMPASSION @APRILWENSEL ‣ JOY ‣ RESILIENCE ‣ PEACE OF MIND ‣ JOB SATISFACTION ‣ LOWER CHANCE OF BURNOUT https://greatergood.berkeley.edu/topic/compassion/definition#why-practice
  18. 18. WHAT DOES THIS MEAN FOR CODE REVIEWS? @APRILWENSEL
  19. 19. COMPASSIONATE CODE REVIEWS MINIMIZE SUFFERING FOR EVERYONE INVOLVED—AUTHORS, REVIEWERS, & EVEN USERS @APRILWENSEL
  20. 20. @APRILWENSEL 3 FILTERS FOR COMPASSIONATE CODE REVIEWS 1 2 3
  21. 21. IS IT TRUE? @APRILWENSEL 1
  22. 22. EXAMPLE: “YOU SHOULD NEVER USE SINGLETONS.” @APRILWENSEL
  23. 23. EXAMPLE: “YOU SHOULD NEVER USE SINGLETONS.” @APRILWENSEL IS IT TRUE?
  24. 24. IT’S AN OPINION, NOT A FACT, SO IT CAN’T BE PROVEN TRUE OR FALSE @APRILWENSEL
  25. 25. ALTERNATIVE: “IN THIS CASE, I WOULD ADVISE AGAINST USING A SINGLETON BECAUSE…” @APRILWENSEL
  26. 26. ALTERNATIVE: “COULD YOU EXPLAIN YOUR DECISION TO USE A SINGLETON? DID YOU CONSIDER…?” @APRILWENSEL
  27. 27. EXAMPLE: “THESE 3 LINES SHOULD REALLY BE IN A SEPARATE METHOD.” @APRILWENSEL IS IT TRUE?
  28. 28. ALTERNATIVE: “WOULD IT MAKE SENSE TO MOVE THESE LINES INTO A SEPARATE METHOD TO HELP WITH READABILITY?” @APRILWENSEL
  29. 29. EXAMPLE: “THIS ISN’T IDIOMATIC.” @APRILWENSEL
  30. 30. EXAMPLE: “THIS ISN’T IDIOMATIC.” @APRILWENSEL “IT’S BEST PRACTICE TO…” “THE RIGHT WAY TO…”
  31. 31. ALTERNATIVES: “ACCORDING TO THIS GUIDE…” “I’VE OFTEN SEEN…” @APRILWENSEL
  32. 32. IS IT TRUE? @APRILWENSEL 1 ✦ IF IT’S YOUR OPINION, SAY SO ✦ IF IT’S A FACT, CONSIDER SHARING A SOURCE ✦ AVOID RIGHT/WRONG LANGUAGE ✦ TRY A QUESTION INSTEAD ✦ AVOID “SHOULDING” ON PEOPLE
  33. 33. IS IT NECESSARY? @APRILWENSEL 2
  34. 34. EXAMPLE: “THIS IS A NITPICK, BUT…” @APRILWENSEL
  35. 35. EXAMPLE: “THIS IS A NITPICK, BUT…” @APRILWENSEL IS IT NECESSARY?
  36. 36. TAKE A BREATH AND CHECK YOUR MOTIVE @APRILWENSEL ARE YOU TRYING TO HELP OR BOOST YOUR OWN EGO?
  37. 37. ALTERNATIVES: @APRILWENSEL • AUTOMATE IF POSSIBLE • MENTION IT PRIVATELY • IGNORE IT
  38. 38. EXAMPLE: “THIS CODE MAKES ME CRINGE, BUT I SEE WHY YOU DID IT THIS WAY…” @APRILWENSEL
  39. 39. EXAMPLE: “THIS CODE MAKES ME CRINGE, BUT I SEE WHY YOU DID IT THIS WAY…” @APRILWENSEL IS IT NECESSARY?
  40. 40. EXAMPLE: “THIS IS FINE, BUT WE SHOULD REALLY REWRITE THIS WHOLE MODULE…” @APRILWENSEL
  41. 41. EXAMPLE: “THIS IS FINE, BUT WE SHOULD REALLY REWRITE THIS WHOLE MODULE…” @APRILWENSEL IS IT NECESSARY?
  42. 42. ALTERNATIVE: @APRILWENSEL RAISE THE ISSUE WITH THE TEAM THROUGH THE APPROPRIATE CHANNEL (A TICKET, CHAT, ETC.)
  43. 43. IS IT NECESSARY? @APRILWENSEL 2 ✦ BE CAREFUL WITH NITPICKS ✦ CHECK YOUR MOTIVES ✦ CHOOSE THE RIGHT CHANNEL
  44. 44. IS IT KIND? @APRILWENSEL 3
  45. 45. https://medium.com/compassionate-coding/confessions-of-a- recovering-jerk-programmer-b9d531a05ea9@APRILWENSEL I USED TO BE KIND OF A JERK
  46. 46. @APRILWENSEL BEING KIND != SUGARCOATING
  47. 47. BEING KIND IS ULTIMATELY MORE EFFICIENT BECAUSE YOU AVOID TRIGGERING SOMEONE’S DEFENSIVE THREAT RESPONSE @APRILWENSEL
  48. 48. EXAMPLE:
 “The above code is [BLEEP], and it generates [BLEEP] code. It looks bad, and there's no reason for it. The code could *easily* have been done with just a single and understandable conditional…I really see no reason for this kind of complete idiotic [BLEEP].” @APRILWENSELhttp://lkml.iu.edu/hypermail/linux/kernel/1510.3/02866.html
  49. 49. EXAMPLE:
 “The above code is [BLEEP], and it generates [BLEEP] code. It looks bad, and there's no reason for it. The code could *easily* have been done with just a single and understandable conditional…I really see no reason for this kind of complete idiotic [BLEEP].” @APRILWENSELhttp://lkml.iu.edu/hypermail/linux/kernel/1510.3/02866.html IS IT KIND?
  50. 50. ALTERNATIVE: @APRILWENSEL “DID YOU CONSIDER USING A SINGULAR CONDITIONAL LIKE THIS…? I THINK THAT WOULD MAKE IT EASIER FOR PEOPLE TO UNDERSTAND.”
  51. 51. EXAMPLE: “WHY DIDN’T YOU JUST USE A FACTORY?” @APRILWENSEL
  52. 52. EXAMPLE: “WHY DIDN’T YOU JUST USE A FACTORY?” @APRILWENSEL IS IT KIND?
  53. 53. EXAMPLE: “WHY DIDN’T YOU JUST USE A FACTORY?” @APRILWENSEL IS IT KIND?
  54. 54. ALTERNATIVE: @APRILWENSEL “DID YOU CONSIDER USING A FACTORY HERE? IT WOULD HELP BY… ”
  55. 55. EXAMPLE:
 REVIEWER: “GIVEN THE DEPENDENCIES, I’M CONCERNED THAT IT WILL BE DIFFICULT TO MODIFY THIS IN THE FUTURE.”
 
 AUTHOR: “I THINK THAT’S A TRIVIAL CONCERN.” @APRILWENSEL
  56. 56. EXAMPLE:
 REVIEWER: “GIVEN THE DEPENDENCIES, I’M CONCERNED THAT IT WILL BE DIFFICULT TO MODIFY THIS IN THE FUTURE.”
 
 AUTHOR: “I THINK THAT’S A TRIVIAL CONCERN.” @APRILWENSELIS IT KIND?
  57. 57. ALTERNATIVE: @APRILWENSEL “THANKS FOR RAISING THAT ISSUE. I DON’T THINK THAT’S GOING TO BE A PROBLEM BECAUSE […] WHAT DO YOU THINK?”
  58. 58. EXAMPLE: “I DISAGREE WITH THIS WHOLE APPROACH. I THINK IT’S MESSY AND UNMAINTAINABLE.” @APRILWENSEL
  59. 59. EXAMPLE: “I DISAGREE WITH THIS WHOLE APPROACH. I THINK IT’S MESSY AND UNMAINTAINABLE.” @APRILWENSEL IS IT KIND?
  60. 60. ALTERNATIVES: @APRILWENSEL • DO SOME REVIEW *BEFORE* CODING • DISCUSS IT OFFLINE • PAIR PROGRAM!
  61. 61. IT’S KIND TO HELP PEOPLE IMPROVE; IT’S NOT KIND TO SHAME THEM IN THE PROCESS @APRILWENSEL
  62. 62. IS IT KIND? @APRILWENSEL 3 ✦ TAKE A BREATH ✦ AVOID INSULTS AND SHAMING ✦ REMEMBER YOU’RE DEALING WITH HUMANS ✦ ASSUME COMPETENCE; SEEK TO UNDERSTAND ✦ CHOOSE THE RIGHT MEDIUM ✦ OFFER GRATITUDE
  63. 63. @APRILWENSEL 3 FILTERS FOR COMPASSIONATE CODE REVIEWS 1 2 3 IS IT TRUE? IS IT NECESSARY? IS IT KIND? Inspired by Victoria Moran - Creating a Charmed Life
  64. 64. ISN’T “COMPASSIONATE CODING” AN OXYMORON? @APRILWENSEL
  65. 65. http://www.businessinsider.com/programmers-debate- requirements-to-behave-respectfully-ccoc-2018-5 @APRILWENSEL
  66. 66. ‣ EGO ‣ ELITISM ‣ COMPETITION ‣ BEING “SMART” ‣ BEING A “ROCKSTAR” @APRILWENSEL THE STATUS QUO OF TECH CULTURE
  67. 67. ‣ EGO HUMILITY ‣ ELITISM INCLUSION ‣ COMPETITION COOPERATION ‣ BEING “SMART” LEARNING ‣ BEING A “ROCKSTAR” BEING A MENTOR @APRILWENSEL THE COMPASSIONATE FUTURE OF TECH CULTURE
  68. 68. ISN’T “COMPASSIONATE CODING” AN OXYMORON? @APRILWENSEL
  69. 69. LET’S MAKE “COMPASSIONATE CODING” REDUNDANT @APRILWENSEL
  70. 70. @APRILWENSEL PLANT SEEDS OF COMPASSION IN YOUR CODEBASE & 
 IN YOUR COMMUNITY
  71. 71. COMPASSIONATE CODING COMPASSIONATE CODING @APRILWENSEL COME GET A STICKER! COMPASSIONATECODING.COM THANK YOU! NEWSLETTER SIGN-UP: @COMPASSIONCODE

×