SlideShare a Scribd company logo
zen and the art of code maintenance
@jemyoung jem@netflix.com
I am a not a
computer.
You are not a
computer.
(probably)
^
computer
https://github.com/jasondavies/bloomfilter.js/blob/master/bloomfilter.js
¯_(ツ)_/¯
We spend most of our
time reading code.
Sometimes it’s other
people’s code.
Sometimes it’s our
own code.
Our code changes because what
we learn changes.
code maintenance.
7 meditations
Code
Architecture
Technology
What is maintainable code?
Why should you care?
@jemyoung
FORWARDJS 2017
Jem Young
Senior Software Engineer
@jemyoung
Things you should know about me
3. I’m LAZY
1. I love Fast and Furious
2. I’m taller than I look from this stage
LAZY
“…only a programmer will avoid writing
monotonous, repetitive code”
LAZY
-Phillip Lessen
function count() {
}
console.log(‘1’);
Write a function
that counts to
console.log(‘2’);
console.log(‘3’);
console.log(‘4’);
console.log(‘5’);
console.log(‘6’);
console.log(‘7’);
console.log(‘8’);
console.log(‘9’);
console.log(’10’);
10
function count() {
for (let i = 1; i <= 10; i++) {
console.log(i);
}
}
Write a function
that counts to
10
function count(max) {
for (let i = 1; i <= max; i++) {
console.log(i);
}
}
Write a function
that counts to
10
L A
Z
Y
000
LAZYengineers write good code
#LazyJS
What is good code?
usable scalable good code=+
Usable
•find/fix bugs quickly
•integrates with other code
•straightforward implementation
•fast ramp up time
•uses simple patterns
•easily handles traffic
Scalable
U
sability
Scalability
maintainable code good code=
function count() {
}
console.log(‘1’);
console.log(‘2’);
console.log(‘3’);
console.log(‘4’);
console.log(‘5’);
console.log(‘6’);
console.log(‘7’);
console.log(‘8’);
console.log(‘9’);
console.log(’10’);
U
sability
Scalability
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
U
sability
Scalability
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
16
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
41
43
44
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
function count(max) {
for (let i = 0; i <= max; i++) {
console.log(i);
}
}
counter.js
Application
LAZYengineers write good code
LAZYit’s hard to be
7 meditations
(that I wish I had when I first started programming)
top right bottom left
.btn {
padding: 10px 2px 12px 10px;
}
right left
top bottom
meditations on
architecture
technology
code
meditations on code
architecture
technology
// What’s in a name?
// What’s in a name?
function foo(x) {
const a = ‘er’;
return x + a;
}
// What’s in a name?
function foo(x) {
const a = ;
return x + a;
}-> 0xF165 0xF172‘er’
// What’s in a name?
function foo(x) {
const a = ‘er’;
return x + a;
}
function foo(x) {
const a = ‘er’;
return x + a;
}
name things properly
Lesson 1
name things properly
Lesson 1
-~[“a”, “b”].indexOf(“d”)
-~[“a”, “b”].indexOf(“d”)
1111 1111 1111 1111 1111 1111 1111 1111-1 ===
[“a”, “b”].indexOf(“d”)-1 ===
0000 0000 0000 0000 0000 0000 0000 0000-1 ===
1000 0000 0000 0000 0000 0000 0000 0000~-1 ===
1000 0000 0000 0000 0000 0000 0000 0000-0 ===
1000 0000 0000 0000 0000 0000 0000 0000false ===
-~[“a”, “b”].indexOf(“d”)
~
-
-~[“a”, “b”].indexOf(“d”)
avoid clever code
Lesson 2
[“a”, “b”].indexOf(“d”) > -1
comment your code
Lesson 3
comment your code
Lesson 3
comment your code
Lesson 3
your code
Lesson 3
comment
your code
Lesson 3
your code
Lesson 3
your code
Lesson 3
Docblockr
comment your code
Lesson 3
comment your code
avoid clever code
name things properly
meditations on code
architecture
technology
meditations on
code
architecture
technology
var x
var y
var o = []
let x
const y
const o = new Int32Array()
let x
const y
const o = new Int32Array()
be deliberate
Lesson 4
WARNING
NSFW
let x
const y
const o = new Int32Array()
be deliberate
Lesson 4
Great Arguments in
Frontend History
vstabs spaces
vs
vs
MATTER
IT
DOES
NOT
111,3,4,7,
492,4,6,8,
be consistent
Lesson 5
input.spec.js
checkbox.spec.js
radio.test.js
be consistent
be deliberate
Prettier
ESlint
Before After
Prettier
be consistent
be deliberate
Prettier
ESlint
https://github.com/jhusain/eslint-plugin-immutable
ESlint
deliberateconsistent
usable scalable
maintainable
meditations on
code
architecture
technology
meditations on
code
technology
architecture
Jem Young
Software Engineer
Hacker
Designer
Python Expert
UX Consultant
Rockstar
Network Ninja
JQuery Wrangler
@jemyoung
San Francisco, CA
false
understand the tools
Lesson 6
¯_(ツ)_/¯
understand the tools
Lesson 6
understand the tools
Lesson 6
sService
worker
service worker
intercept fetch requests
work offline
utilize web push
progressive web applications
0
understand the cost
Lesson 7
understand the cost
Lesson 7
service worker
understand the cost
Lesson 7
javascript frameworks
understand the cost
Lesson 7
framework showdown
#It’sAboutToGoDown
MATTER
IT
DOES
NOT
what now?
Matthew Hardin
SiteOps
Thanks
Archana Sankaranarayanan
Developer Insights
Thanks
Ryan Burgess
@burgessdryan
Thanks
How can you care so
much about
code maintenance?
What you do is
important.

More Related Content

What's hot

Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
Lin Yo-An
 
Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In Perl
Kang-min Liu
 

What's hot (19)

Php 2
Php 2Php 2
Php 2
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 
The promise of asynchronous PHP
The promise of asynchronous PHPThe promise of asynchronous PHP
The promise of asynchronous PHP
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM DesignESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
ESWHO, ESWHAT, ESWOW -- FEDucation -- IBM Design
 
Let's build a parser!
Let's build a parser!Let's build a parser!
Let's build a parser!
 
Groovy presentation
Groovy presentationGroovy presentation
Groovy presentation
 
Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In Perl
 
Code Generation in PHP - PHPConf 2015
Code Generation in PHP - PHPConf 2015Code Generation in PHP - PHPConf 2015
Code Generation in PHP - PHPConf 2015
 
TDD with PhpSpec
TDD with PhpSpecTDD with PhpSpec
TDD with PhpSpec
 
PHP7. Game Changer.
PHP7. Game Changer. PHP7. Game Changer.
PHP7. Game Changer.
 
PHPSpec BDD for PHP
PHPSpec BDD for PHPPHPSpec BDD for PHP
PHPSpec BDD for PHP
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
 
Functions in python3
Functions in python3Functions in python3
Functions in python3
 
Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8
 
TDD with phpspec2
TDD with phpspec2TDD with phpspec2
TDD with phpspec2
 

Similar to Zen and the Art of Code Maintenance

Using browser() in R
Using browser() in RUsing browser() in R
Using browser() in R
Leon Kim
 

Similar to Zen and the Art of Code Maintenance (20)

Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
جلسه پنجم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲- ارائه ۱
 
Using browser() in R
Using browser() in RUsing browser() in R
Using browser() in R
 
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
Architecting Scalable Platforms in Erlang/OTP | Hamidreza Soleimani | Diginex...
 
Python basic
Python basicPython basic
Python basic
 
effective_r27
effective_r27effective_r27
effective_r27
 
Python slide
Python slidePython slide
Python slide
 
Elixir
ElixirElixir
Elixir
 
What are monads?
What are monads?What are monads?
What are monads?
 
python beginner talk slide
python beginner talk slidepython beginner talk slide
python beginner talk slide
 
What every beginning developer should know
What every beginning developer should knowWhat every beginning developer should know
What every beginning developer should know
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
ppt7
ppt7ppt7
ppt7
 
ppt2
ppt2ppt2
ppt2
 
name name2 n
name name2 nname name2 n
name name2 n
 
ppt9
ppt9ppt9
ppt9
 
Ruby for Perl Programmers
Ruby for Perl ProgrammersRuby for Perl Programmers
Ruby for Perl Programmers
 

Recently uploaded

ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 

Zen and the Art of Code Maintenance