Slide 1

Slide 1 text

Code Review 101 Ulisses Almeida

Slide 2

Slide 2 text

Code Review CODE REVIEW 101 What is it? Options Why Pull Requests? Pull requests good practices Go beyond with pull requests

Slide 3

Slide 3 text

Ulisses Almeida CODE REVIEW 101 @ulissesalmeida
 
 Elixir Developer
 Payments Team

Slide 4

Slide 4 text

What’s Code Review?

Slide 5

Slide 5 text

Bunch of folks reading code and suggesting changes W E L C O M E A B O A R D Improve code quality, prevent defects, share knowledge and responsibility, discover better solutions

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Options of code review

Slide 8

Slide 8 text

Continuous
 Integration =~
 not having a code review CODE REVIEW 101 Don’t branch! Don’t branch! Commits on master everyday! Feature toggle to hide WIP Automated tests Automated deployment Continuous Integration 
 != Continuous Delivery
 != Continuous Deployment https://martinfowler.com/articles/continuousIntegration.html

Slide 9

Slide 9 text

Pair programming, kinda code review CODE REVIEW 101 Driver and Navigator Constant feedback during the coding process Faster on-boarding Focus No personal space, can be exhausting Lack of feedbacks from third team members

Slide 10

Slide 10 text

Code Review CODE REVIEW 101 Synchronous vs Asynchronous

Slide 11

Slide 11 text

Code Review, Merge/Pull requests CODE REVIEW 101 Open collaboration Time-zone/remote friendly History of discussions Enforce code quality before mainline integration Wait for review can take a long time Written communication is hard

Slide 12

Slide 12 text

Why Pull Requests?

Slide 13

Slide 13 text

First, automation always W E L C O M E A B O A R D Automated tests, deploys, rollbacks are important, no matter the process

Slide 14

Slide 14 text

Continuous integration Pair programming Pull Requests Teammates early feedback 0 ++ + Team Visibility - + ++ Team ownership - + ++ Individual space + - + Focus 0 ++ 0 Code Quality 0 + ++ Deploy confidence ++ + 0 ++ Strong promotes + Promotes 0 Neutral - Negates CODE REVIEW 101

Slide 15

Slide 15 text

CODE REVIEW 101 Pair Programming Code 
 Review Continuous 
 Integration

Slide 16

Slide 16 text

Good practices

Slide 17

Slide 17 text

Creating a pull request

Slide 18

Slide 18 text

Small Concise, Focused CODE REVIEW 101 Few code to read leads to a better quality of the review Give lots of information with few words and image Efforts to one goal

Slide 19

Slide 19 text

CODE REVIEW 101 https://twitter.com/iamdevloper/status/397664295875805184

Slide 20

Slide 20 text

CODE REVIEW 101 Quality of Review 
 Size of Pull Request

Slide 21

Slide 21 text

Concise PR,
 is about optimise the reviewer time CODE REVIEW 101 Clear title Good description about you have done and why You can use screenshots and GIFs Add Issue Tracker links (JIRA for example) Add reviewers Review your own PR and highlight some parts

Slide 22

Slide 22 text

CODE REVIEW 101 • CloudApp • LiICEcap

Slide 23

Slide 23 text

CODE REVIEW 101

Slide 24

Slide 24 text

CODE REVIEW 101

Slide 25

Slide 25 text

CODE REVIEW 101

Slide 26

Slide 26 text

A focused PR starts before coding CODE REVIEW 101 Breakdown your user stories Try to delivery a testable thing But don’t break too much otherwise your PR will be pointless Work with your team to check if the tasks/stories are clear

Slide 27

Slide 27 text

CODE REVIEW 101 0 27,5 55 82,5 110 #1 #2 #3 #4 Backlog Developing Review Testing Done

Slide 28

Slide 28 text

0 27,5 55 82,5 110 #1 #2 #3 #4 Backlog Developing Review Testing Done CODE REVIEW 101

Slide 29

Slide 29 text

CODE REVIEW 101 Pull Request Managers
 Stakeholders
 Developers
 QAs

Slide 30

Slide 30 text

Big review times are symptoms W E L C O M E A B O A R D Removing pull requests might not cure the disease.
 
 Analyse the context:
 WIP? Big demands? Context switching?

Slide 31

Slide 31 text

Reviewing a pull request

Slide 32

Slide 32 text

CODE REVIEW 101 ⓵ ⓶ ⓷ ⓸

Slide 33

Slide 33 text

What we 
 should look 
 for? CODE REVIEW 101 Is it solving the problem? Is there other ways? Typos, bugs, security, performance Need tests? Documentation? Following the team/project patterns?

Slide 34

Slide 34 text

CODE REVIEW 101 Start a discussion!

Slide 35

Slide 35 text

Try to be assertive,
 written communication is hard CODE REVIEW 101 Avoid imperative sentences Suggestive tone Teach, show examples Don't assume, ask questions Compliments Celebrate! Have fun!

Slide 36

Slide 36 text

CODE REVIEW 101

Slide 37

Slide 37 text

CODE REVIEW 101

Slide 38

Slide 38 text

Receiving a review

Slide 39

Slide 39 text

The code is 
 not you and 
 not just 
 for you CODE REVIEW 101 Appreciate the reviewer time Assertive communication Answer the suggestions, even those you will not apply Lots of comments doesn’t mean you are bad programmer Detach from your code, it’s ok sometimes rewrite everything

Slide 40

Slide 40 text

There are people behind the screens W E L C O M E A B O A R D Go beyond the tool.
 Face-to-face, video calls…
 
 Don’t forget to register the decision in PR later

Slide 41

Slide 41 text

Go beyond with Pull Requests

Slide 42

Slide 42 text

Automate the review CODE REVIEW 101

Slide 43

Slide 43 text

Review apps CODE REVIEW 101

Slide 44

Slide 44 text

Go crazy, and deploy the PR in production! CODE REVIEW 101 https://guides.github.com/introduction/flow/

Slide 45

Slide 45 text

Wrapping
 up!

Slide 46

Slide 46 text

Code Review ensure quality of the code before integration

Slide 47

Slide 47 text

Pull requests are great to have discussions with code context and history

Slide 48

Slide 48 text

Following some good practices, it can be fast, fair and fun

Slide 49

Slide 49 text

Thanks! Ulisses Almeida