Slide 1

Slide 1 text

CODE REVIEW YODAS

Slide 2

Slide 2 text

SETUP ▸ F2F ▸ vs Offline

Slide 3

Slide 3 text

WHO ▸ Peers

Slide 4

Slide 4 text

WHAT TO LOOK FOR IN CODE REVIEW ▸ You understand it ▸ Code is for ppl, not computers ▸ Each function does what you expect ▸ DRY ▸ Tests ▸ Names

Slide 5

Slide 5 text

CHECKLIST (?) ▸ Does the code execute as expected? ▸ Is all new code tested? Altered code tests up to date? ▸ Is the code readable? ▸ Do you understand the code you are reviewing? ▸ Has the developer tested the code? ▸ Coding conventions? ▸ Are all functions, methods and classes documented? ▸ Are complex algorithms and code optimizations adequately commented? ▸ Error Handling ▸ Resource Leaks ▸ Thread Safeness ▸ Is the code free of unintended infinite loops? ▸ Are function parameters explicitly verified in the code? ▸ Pending/TODO ▸ assertions ▸ abnormal terminations ▸ Database Transactions ▸ Correct synchronization ▸ no deadlocks/livelocks ▸ Bug Fix Side Effects ▸ All the occurrences of the bug are fixed

Slide 6

Slide 6 text

TOOLS FOR BETTER CODE REVIEW ▸ Github pull request ▸ Lint ▸ IDE support (lint, formatting) ▸ CI

Slide 7

Slide 7 text

CODE REVIEW - WHAT IS IT GOOD FOR? ▸ As the coder ▸ Better code, less bugs ▸ Learn

Slide 8

Slide 8 text

CODE REVIEW - WHAT IS IT GOOD FOR? ▸ As the reviewer ▸ Learn ▸ Know the code. You might be the next person working on it

Slide 9

Slide 9 text

CODE REVIEW - WHAT IS IT GOOD FOR? ▸ As a team ▸ Learn ▸ Common standards (coding conventions) ▸ No job security

Slide 10

Slide 10 text

GITHUB FLOW ▸ https://guides.github.com/introduction/flow/

Slide 11

Slide 11 text

EYE TRACKING

Slide 12

Slide 12 text

EYE TRACKING ▸ Now there's a physiological reason to write short method. ▸ People who spend more time on the first scan find more issues and find them faster

Slide 13

Slide 13 text

DEFECT DENSITY V/S LOC

Slide 14

Slide 14 text

DEFECT DENSITY V/S INSPECTION RATE ▸ Conclusion: Take your time (500 LOC/hour is max)

Slide 15

Slide 15 text

PSYCHOLOGY AND CODE REVIEW ▸ Let's face it, there's a lot of psychology in it, so play nice. ▸ Be professional, nothing is personal ▸ Understand, do not criticize.

Slide 16

Slide 16 text

GUIDELINES - TIPS FOR BETTER LIFE… ▸ Every LOC should be read by at least two ppl ▸ Every component should have: ▸ Owner ▸ Secondary maintainer ▸ Short and atomic PRs ▸ Know the coding conventions / styleguides ▸ Read related code (classes/method being used) ▸ Read Slow ▸ Short reviews (at most 60 minutes/200 LOC)

Slide 17

Slide 17 text

REFERENCES ▸ This presentation: https://speakerdeck.com/rantav/code- review-at-yodas ▸ A short book http://smartbear.com/SmartBear/media/ pdfs/best-kept-secrets-of-peer-code-review.pdf