Transcript
Page 1: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Function Composition: The top reason node.js

submissions get rejected by SoundCloud

Phil Calçado - SoundCloud@pcalcado

http://philcalcado.comFriday, May 11, 12

Page 2: Function Composition: The top reason node.js submissions get rejected by SoundCloud

ohai!

i’m phil.

Friday, May 11, 12

Page 3: Function Composition: The top reason node.js submissions get rejected by SoundCloud

i work here:

Friday, May 11, 12

Page 4: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 5: Function Composition: The top reason node.js submissions get rejected by SoundCloud

and we are hiring.

Friday, May 11, 12

Page 6: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/work-at-soundcloud

Friday, May 11, 12

Page 7: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Phone

Code Review

Interviews

Offer

Friday, May 11, 12

Page 8: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Phone

Code Review

Interviews

Offer

Friday, May 11, 12

Page 9: Function Composition: The top reason node.js submissions get rejected by SoundCloud

you can choose any language.

0

10

20

30

40

Ruby Java JavaScript (Node.js) C Clojure Scala

% of submissions on the past ~6 months

Friday, May 11, 12

Page 10: Function Composition: The top reason node.js submissions get rejected by SoundCloud

you can choose any language.

0

10

20

30

40

Ruby Java JavaScript (Node.js) C Clojure Scala

rejected before interview invited for inverview

Friday, May 11, 12

Page 11: Function Composition: The top reason node.js submissions get rejected by SoundCloud

you can choose any language.

0

10

20

30

40

Ruby Java JavaScript (Node.js) C Clojure Scala

rejected before interview invited for inverview

WTF?

Friday, May 11, 12

Page 12: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/J1aLNn

we are all hipsters

Friday, May 11, 12

Page 13: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 14: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Not OO, not Functional...Just (bad) Procedural code.

Friday, May 11, 12

Page 15: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JiECRpFriday, May 11, 12

Page 16: Function Composition: The top reason node.js submissions get rejected by SoundCloud

we don’t need this complicated stuff.this is not java, you know.

Friday, May 11, 12

Page 17: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JiFSnq

so what do we need?

Friday, May 11, 12

Page 18: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JFbZt8Friday, May 11, 12

Page 19: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JFbZt8

“SICP and some of the Sussman & Steele "Lambda the ..." papers made a big impression on me years before, although I did not understand their full meaning then.Remember, I was recruited to "do Scheme" [...] My interest in languages such as Self informed a subversive agenda [...]. Likewise with first-class functions, which were inspired by Scheme [...]”

Friday, May 11, 12

Page 20: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JiEQYMFriday, May 11, 12

Page 21: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 22: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 23: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 24: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 25: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 26: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 27: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JiF7ef

going old school

Friday, May 11, 12

Page 28: Function Composition: The top reason node.js submissions get rejected by SoundCloud

e.g. passing functions around

Friday, May 11, 12

Page 29: Function Composition: The top reason node.js submissions get rejected by SoundCloud

we see a lot of this

Friday, May 11, 12

Page 30: Function Composition: The top reason node.js submissions get rejected by SoundCloud

1st, we extract what is common

Friday, May 11, 12

Page 31: Function Composition: The top reason node.js submissions get rejected by SoundCloud

then we refactor our functions

Friday, May 11, 12

Page 32: Function Composition: The top reason node.js submissions get rejected by SoundCloud

and we send them as arguments

Friday, May 11, 12

Page 33: Function Composition: The top reason node.js submissions get rejected by SoundCloud

e.g. closures not only for objects

Friday, May 11, 12

Page 34: Function Composition: The top reason node.js submissions get rejected by SoundCloud

we see a lot of this

Friday, May 11, 12

Page 35: Function Composition: The top reason node.js submissions get rejected by SoundCloud

we can keep writeComment as it is

Friday, May 11, 12

Page 36: Function Composition: The top reason node.js submissions get rejected by SoundCloud

and we add a function with two closures

Friday, May 11, 12

Page 37: Function Composition: The top reason node.js submissions get rejected by SoundCloud

and we add a function with two closures

immutable

Friday, May 11, 12

Page 38: Function Composition: The top reason node.js submissions get rejected by SoundCloud

and we add a function with two closures

immutablemutable

Friday, May 11, 12

Page 39: Function Composition: The top reason node.js submissions get rejected by SoundCloud

now we don’t need to pass in the kitchen sink

Friday, May 11, 12

Page 40: Function Composition: The top reason node.js submissions get rejected by SoundCloud

e.g. functions all the way down

Friday, May 11, 12

Page 41: Function Composition: The top reason node.js submissions get rejected by SoundCloud

we see a lot of this

Friday, May 11, 12

Page 42: Function Composition: The top reason node.js submissions get rejected by SoundCloud

first we extract common protocol

Friday, May 11, 12

Page 43: Function Composition: The top reason node.js submissions get rejected by SoundCloud

then we clean up our functions

Friday, May 11, 12

Page 44: Function Composition: The top reason node.js submissions get rejected by SoundCloud

then we use them.

Friday, May 11, 12

Page 45: Function Composition: The top reason node.js submissions get rejected by SoundCloud

then we use them. redundant?

Friday, May 11, 12

Page 46: Function Composition: The top reason node.js submissions get rejected by SoundCloud

there is plenty to learn from.

Friday, May 11, 12

Page 47: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/JiETndFriday, May 11, 12

Page 48: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Friday, May 11, 12

Page 49: Function Composition: The top reason node.js submissions get rejected by SoundCloud

Qs?

Phil Calçado - SoundCloud@pcalcado

http://philcalcado.comFriday, May 11, 12

Page 50: Function Composition: The top reason node.js submissions get rejected by SoundCloud

http://bit.ly/work-at-soundcloud

Friday, May 11, 12

Page 51: Function Composition: The top reason node.js submissions get rejected by SoundCloud

How to Design Programs - http://bit.ly/K0BfrLStructure and Interpretation of Computer

Programs - http://bit.ly/K0BjYm

The Art of the Metaobject Protocol http://amzn.to/K0BqU1

Purely Functional Data Structures http://amzn.to/JFn4KG

Let Over Lambda - http://amzn.to/IMMkNO

An Introduction to Lambda Calculi for Computer Scientists - http://amzn.to/IX8d1B

All drawings are available as t-shirts from the awesome Diesel Sweeties - http://dieselsweeties.com/

Friday, May 11, 12