Slide 1

Slide 1 text

DECODING CODE REVIEW ElixirConf US - 2023

Slide 2

Slide 2 text

ELAINE NAOMI WATANABE B.Sc. in Computer Engineering M.Sc. in Computer Science Senior Software Engineer @ TheRealReal twitter.com/elaine_nw speakerdeck.com/elainenaomi linkedin.com/in/elainenaomi slides

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

CODE REVIEW

Slide 5

Slide 5 text

2001

Slide 6

Slide 6 text

60% of defects can be identified in code review process Boehm, Barry, and Victor R. Basili. "Top 10 list [software development]." Computer 34.1 (2001): 135-137

Slide 7

Slide 7 text

2009

Slide 8

Slide 8 text

Code review is a valuable tool for identifying code evolvability-related defects that are not detectable during the testing phase Mäntylä, Mika V., and Casper Lassenius. "What types of defects are really discovered in code reviews?." IEEE Transactions on Software Engineering 35.3 (2009): 430-448

Slide 9

Slide 9 text

http://agilemodeling.com/essays/modelReviews.htm Dev. Cost of Change Time Requirements Analysis and Design Review Tests Production

Slide 10

Slide 10 text

http://agilemodeling.com/essays/modelReviews.htm Dev. Cost of Change Time Requirements Analysis and Design Review Tests Production

Slide 11

Slide 11 text

As an Author

Slide 12

Slide 12 text

Self-descriptive title Motivation (Business Context) List previous questions and discussions GIFs, screenshots from the changes

Slide 13

Slide 13 text

Coherent commit messages Complete, tested code Small changes Single responsibility principle

Slide 14

Slide 14 text

Review your own PR Tag people as reviewers Apply necessary changes Respond to all comments

Slide 15

Slide 15 text

RubyConf 2018 - A Branch in Time https://www.youtube.com/watch?v=8OOTVxKDwe0 capture the why, not the what

Slide 16

Slide 16 text

As a Reviewer

Slide 17

Slide 17 text

Identify defects (bugs) Suggest alternatives, refactorings Reinforce patterns Validate functionality (code + business)

Slide 18

Slide 18 text

Identify security issues Analyze performance impact Suggest documentation Validate the code quality

Slide 19

Slide 19 text

Be introduced to new functionalities Learn new technologies Share knowledge and questions

Slide 20

Slide 20 text

#

Slide 21

Slide 21 text

Feedback is about the source code, not about people

Slide 22

Slide 22 text

Promote the participation of everyone in your team

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Toxic behaviors in code review may not be so obvious…

Slide 25

Slide 25 text

Toxic behaviors in code review may not be so obvious… ask feedback

Slide 26

Slide 26 text

Toxic behaviors in code review may not be so obvious… read about Non-Violent Communication

Slide 27

Slide 27 text

"This PR should not be merged" Opinion-based comment, lacking concrete action, imperative

Slide 28

Slide 28 text

"Why haven't you created a new module?" A question with a judgmental tone "Why didn't you think of that?"

Slide 29

Slide 29 text

Code reviews like a Human https://mtlynch.io/human-code-reviews-1/ https://mtlynch.io/human-code-reviews-2/

Slide 30

Slide 30 text

it's about adding comments in a more constructive manner

Slide 31

Slide 31 text

"Why haven't you created a new module?" A question with a judgmental tone "Why didn't you think of that?"

Slide 32

Slide 32 text

constructive manner "What do you think about extracting this logic into a module? I think it will improve readability and reduce complexity"

Slide 33

Slide 33 text

no assumptions, just a suggestion "I don't know if you've already considered this, but wouldn't it be worth creating a new module for this case?"

Slide 34

Slide 34 text

Be mindful about unconscious bias

Slide 35

Slide 35 text

For example, about seniority bias

Slide 36

Slide 36 text

Don't assume that a junior engineer needs explanation for everything

Slide 37

Slide 37 text

And also, about gender bias

Slide 38

Slide 38 text

Please, don't try to explain what Elixir is to a female Elixir engineer

Slide 39

Slide 39 text

Pay attention for not assuming a female Elixir engineer is a junior engineer

Slide 40

Slide 40 text

#

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

https://sourcelevel.io/code-review-ebook

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

google.github.io/eng-practices/review/reviewer/standard.html

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

railsgirls.com.br

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

CARNIVAL EDITION

Slide 51

Slide 51 text

speakerdeck.com/elainenaomi elainenaomi.dev Muito obrigada illustrations from undraw.co translation: thank you so much! slides