Has Anyone else Seen
your code?
Codemotion Berlin 2018-11-21
Your Host Today
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5361259/20180912_195708-rot.jpg)
What We Will Cover
Bad Code Will Kill You
Deploying Spiders
Zen and the Art of Code Reviews
Editorial Process
Conclusions
Why Me?
20+ years in the industry
5+ years doing code reviews
Read a bunch of blog posts
Extremely muscular body
Code Can (and will) Kill You
![](https://78.media.tumblr.com/tumblr_ltjan9NyAZ1qe5vzdo1_r1_400.gif)
Bad Code Is Out To Get You!
![](https://78.media.tumblr.com/28fe8b458c3fd8c8b47073b88c5ec608/tumblr_o26ni73Rl21v7ay98o1_500.gif)
Software Bugs cost $60 Billion
Software handles:
- all money except pocket change
- communications around the world
- health instruments and records
- almost all transportation vehicles
state of the art sensors
vs primate in metal box
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5113794/waymo-car.png)
![](https://media.giphy.com/media/l1IXYoFBrtJev8n3W/giphy.gif)
Ape wins
Self-Driving Car Manufacturers
War Robots
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5101397/terminator-army.gif)
Actual robots
![](https://media.giphy.com/media/3rOM5dGldYMF2/giphy.gif)
Deploying Spiders
![](http://i.imgur.com/A8H77tq.gif)
Do you know what you deploy?
![](https://media1.tenor.com/images/d3ab39405ffb94d8494592324b63beb1/tenor.gif?itemid=3561440)
Often we do not know!
It may be weird stuff
![](https://img.buzzfeed.com/buzzfeed-static/static/2017-10/29/14/asset/buzzfeed-prod-fastlane-02/anigif_sub-buzz-18790-1509303389-2.gif)
(potentially very weird)
spoiler alert
![](https://i.imgur.com/WlIIAQx.gif)
It's a human head!
Does code ever work the first time?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5077175/bill-gates.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5077176/bezos-box.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5077177/amancio-ortega.jpg)
Yes!
Probably not?
Definitely not
Hall of Tortured Souls
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5110901/hall-of-tortured.gif)
Linux 4.17.3: 6 MLOC
$ grep -ir fuck linux-4.17.3 | wc -l
29
$ grep -ir kludge linux-4.17.3 | wc -l
110
$ grep -ir cludge linux-4.17.3 | wc -l
1
$ grep -ir crap linux-4.17.3 | wc -l
195
$ grep -r TODO linux-4.17.3 | wc -l
4825
## Some Highlights
* Wirzenius wrote this portably, Torvalds fucked it up :-)
/* !!!! THIS IS A PIECE OF SHIT MADE BY ME !!! */
Node.js 10.5.0: 3 MLOC
$ grep -ir fuck node-v10.5.0 | wc -l
25
$ grep -ir kludge node-v10.5.0 | wc -l
22
$ grep -ir crap node-v10.5.0 | grep -v scrap | wc -l
9
$ grep -r TODO node-v10.5.0 | wc -l
2904
## Some Highlights
* **help:** fuck it. just hard-code it ([d5d5085](https://github.com/zkat/npx/commit/d5d5085))
* IOW it's all just a clusterfuck and we should think of something that makes slightly more sense.
Java 10.0.1: 3.5 MLOC
$ grep -ir fuck java-10.0.1 | wc -l
1
$ grep -ir kludge java-10.0.1 | wc -l
16
$ grep -ir crap java-10.0.1 | grep -v scrap | wc -l
3
$ grep -r TODO java-10.0.1 | wc -l
2155
## Some Highlights
if (uri == null || uri.length() == 0) // crap. the NamespaceContext interface is broken
// forces us to clear out crap up to the next
* TODO: wrapping message needs easier. in particular properties and attachments.
Unit Tests are great
![](http://gif-finder.com/wp-content/uploads/2017/04/Unit-tests-pass-no-integration-tests.gif)
![](https://img.devrant.com/devrant/rant/r_519301_QxQcw.gif)
![](https://pbs.twimg.com/tweet_video_thumb/CYsaEZiW8AIMesY.png)
![](https://pbs.twimg.com/media/C2oAur4UcAE-QaF.jpg)
![](https://i.embed.ly/1/image?url=https%3A%2F%2Fthumbs.gfycat.com%2FHotOrangeCoypu-size_restricted.gif&key=522baf40bd3911e08d854040d3dc5c07)
When someone reviews them!
External tests are awesome
But have to be repeated every time
Labor-intensive
Microsoft: 1 QA / dev in the 90s
Today: 1 QA / 3 devs
When Pair Programming is not enough
![](https://i.imgur.com/eyYtIIn.gif)
Even Remote Pair Programming
![](https://media.giphy.com/media/nl7xVbdHFbtF6/giphy.gif)
Zen and The Art
![](https://upload.wikimedia.org/wikipedia/commons/a/a4/Katsushika_Hokusai_-_Courtesan_asleep_-_Google_Art_Project.jpg)
of code REview
Judged by a Jury of your Peers
![](https://media.giphy.com/media/q8nUWmWcqmO9q/giphy.gif)
Ideal Review
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5512015/felipe2.jpg)
![](https://i.avoz.es/default/2015/09/23/00121443036723066807968/Foto/efe_20150923_192801404.jpg)
![](https://www.dailydot.com/wp-content/uploads/1b9/0b/569b1d71f995fe56e0d900b4b474fe83.jpg)
![](https://i2.wp.com/www.techjaja.com/wp-content/uploads/2014/01/pope-francis-laptop.jpg?resize=609%2C480&ssl=1)
![](https://vignette.wikia.nocookie.net/science/images/e/e1/God-Laptop-01-goog.jpg/revision/latest?cb=20140611182647&path-prefix=el)
Do Not Rely Solely on Senior Review
![](https://78.media.tumblr.com/a08624c931c07449e30750494b9add0a/tumblr_o5inhkM1xo1ugyavxo1_1280.jpg)
Senior Review Creates
a Choke Point
![](https://stickershop.line-scdn.net/stickershop/v1/sticker/356477/ANDROID/sticker.png)
![](https://regmedia.co.uk/2015/07/08/linus_torvalds_flips_the_bird.jpg?x=1200&y=794)
![](https://stickershop.line-scdn.net/stickershop/v1/sticker/356475/ANDROID/sticker.png)
![](https://stickershop.line-scdn.net/stickershop/v1/sticker/356467/ANDROID/sticker.png)
Mandatory Feynman Misquote
I couldn't explain my code to a junior. That means I don't really understand my code.
Encourage Juniors to Ask One Question
Too Many Prima Donnas Already
![](https://media.giphy.com/media/l0IyeMK6G2Gr1Gm3e/giphy.gif)
Ego-less Programming
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5511845/Cabras_en_celo_Pelea_en_Gredos_ESPECTACULAR.gif)
TReat People Well
Do not give orders; ask questions
Maybe ask questions instead of giving orders?
Isn't it faster to change it than to argue?
Could you accept criticism gracefully?
Don't Troll People
![](https://media.giphy.com/media/xUA7b8vm5UZUUm0W52/giphy.gif)
Benefits
Knowledge is shared around
Disseminate coding culture
Status updates are much faster
It takes long, but not doing it takes longer
Explaining Your Code Is Good
![](https://media.giphy.com/media/104KJ5kbte8L6g/giphy.gif)
Volkswagen Scenario
Blame is spread
Other people reviewed
Go straight to the solutions
If Reviews Give You Trouble
Editorial Process
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513813/cervantes.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513821/tolkien.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513825/newspaper.png)
Four-Eyes principle
![](https://pbs.twimg.com/media/DgTWMB8WsAAzgLw.jpg)
![](https://pbs.twimg.com/media/DgTWMB2WsAECFsg.jpg)
![](https://pbs.twimg.com/media/DgTWMB1W4AAkmyV.jpg)
![](https://pbs.twimg.com/media/DgTWMB2X4AAob8q.jpg)
Six Eyes
Eight eyes
![](https://upload.wikimedia.org/wikipedia/commons/7/76/Clynotis_severus%2C_AF_2.jpg)
![](https://s-media-cache-ak0.pinimg.com/originals/01/26/ee/0126eee36e88f15fed64543e73bbfe31.jpg)
Create Your Own Adventure!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513831/corporate.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513833/reviewed.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513850/fasttrack.png)
Some examples
Reviews are a process, not a destination
![](https://images-na.ssl-images-amazon.com/images/G/01/digital/video/hero/Movies/MiscCategory7/B000ID1J0E_FearAndLoathingLasVegas_UXNB1._RI_SX940_.jpg)
To Summarize
People deploy Code all the time
"deploy"
Juniors Make Great Reviewers
Code Reviews Keep You Honest
![](https://media.giphy.com/media/l0MYDGA3Du1hBR4xG/giphy.gif)
Make The Process Explicit
![](https://s3.amazonaws.com/media-p.slid.es/uploads/7769/images/5513918/pope.png)
Thanks!
Has Anyone Else Seen Your Code? Berlin Edition
By Alex Fernández
Has Anyone Else Seen Your Code? Berlin Edition
Presentation for Codemotion Berlin 2018-11-21
- 3,329