function composition: the top reason node.js submissions get rejected by soundcloud

Post on 13-May-2015

9.385 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Video here: http://www.youtube.com/watch?v=7Qsic1xmPKs At SoundCloud we ask candidates to send us some code before inviting them in for interviews. Candidates can use whatever language they want, and over the past year we saw a massive rise on the number of submissions using server-side JavaScript. Unfortunately, too many submissions are asynchronous blobs of procedural code. Let's talk about how to leverage good old Functional Programming techniques to make code less coupled and more readable! — https://secure.trifork.com/cph-2012/freeevent/index.jsp?eventOID=4353

TRANSCRIPT

Function Composition: The top reason node.js

submissions get rejected by SoundCloud

Phil Calçado - SoundCloud@pcalcado

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

ohai!

i’m phil.

Friday, May 11, 12

i work here:

Friday, May 11, 12

Friday, May 11, 12

and we are hiring.

Friday, May 11, 12

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

Friday, May 11, 12

Phone

Code Review

Interviews

Offer

Friday, May 11, 12

Phone

Code Review

Interviews

Offer

Friday, May 11, 12

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

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

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

http://bit.ly/J1aLNn

we are all hipsters

Friday, May 11, 12

Friday, May 11, 12

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

Friday, May 11, 12

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

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

Friday, May 11, 12

http://bit.ly/JiFSnq

so what do we need?

Friday, May 11, 12

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

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

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

Friday, May 11, 12

Friday, May 11, 12

Friday, May 11, 12

Friday, May 11, 12

Friday, May 11, 12

Friday, May 11, 12

http://bit.ly/JiF7ef

going old school

Friday, May 11, 12

e.g. passing functions around

Friday, May 11, 12

we see a lot of this

Friday, May 11, 12

1st, we extract what is common

Friday, May 11, 12

then we refactor our functions

Friday, May 11, 12

and we send them as arguments

Friday, May 11, 12

e.g. closures not only for objects

Friday, May 11, 12

we see a lot of this

Friday, May 11, 12

we can keep writeComment as it is

Friday, May 11, 12

and we add a function with two closures

Friday, May 11, 12

and we add a function with two closures

immutable

Friday, May 11, 12

and we add a function with two closures

immutablemutable

Friday, May 11, 12

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

Friday, May 11, 12

e.g. functions all the way down

Friday, May 11, 12

we see a lot of this

Friday, May 11, 12

first we extract common protocol

Friday, May 11, 12

then we clean up our functions

Friday, May 11, 12

then we use them.

Friday, May 11, 12

then we use them. redundant?

Friday, May 11, 12

there is plenty to learn from.

Friday, May 11, 12

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

Friday, May 11, 12

Qs?

Phil Calçado - SoundCloud@pcalcado

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

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

Friday, May 11, 12

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

top related