Your SlideShare is downloading. ×
Function Composition: The top reason node.js submissions get rejected by SoundCloud
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

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

9,147
views

Published on

Video here: http://www.youtube.com/watch?v=7Qsic1xmPKs …

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

Published in: Technology

2 Comments
12 Likes
Statistics
Notes
  • Learn you some ASI, yo... lolz.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • The slides are really good, and the examples shows clearly your ideal solution. Have you ever thought it might be a bias from your side?
    Your company seems really pro-functional, and from your point of view JS is a pure functional language. However if you look at the node codebase, most of it does not follow your style (random example: https://github.com/joyent/node/blob/master/lib/_stream_readable.js).
    Are you writing in the exercise text that you want a solution in a functional style?
    Moreover, I usually end up in the functional style after a few rounds in the TDD cycle, or if I need more flexibility.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
9,147
On Slideshare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
25
Comments
2
Likes
12
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Function Composition: The top reason node.js submissions get rejected by SoundCloud Phil Calçado - SoundCloud @pcalcado http://philcalcado.comFriday, May 11, 12
  • 2. ohai! i’m phil.Friday, May 11, 12
  • 3. i work here:Friday, May 11, 12
  • 4. Friday, May 11, 12
  • 5. and we are hiring.Friday, May 11, 12
  • 6. http://bit.ly/work-at-soundcloudFriday, May 11, 12
  • 7. Phone Code Review Interviews OfferFriday, May 11, 12
  • 8. Phone Code Review Interviews OfferFriday, May 11, 12
  • 9. you can choose any language. % of submissions on the past ~6 months 40 30 20 10 0 Ruby Java JavaScript (Node.js) C Clojure ScalaFriday, May 11, 12
  • 10. you can choose any language. rejected before interview invited for inverview 40 30 20 10 0 Ruby Java JavaScript (Node.js) C Clojure ScalaFriday, May 11, 12
  • 11. you can choose any language. rejected before interview invited for inverview 40 WTF? 30 20 10 0 Ruby Java JavaScript (Node.js) C Clojure ScalaFriday, May 11, 12
  • 12. we are all hipsters http://bit.ly/J1aLNnFriday, May 11, 12
  • 13. Friday, May 11, 12
  • 14. Not OO, not Functional... Just (bad) Procedural code.Friday, May 11, 12
  • 15. http://bit.ly/JiECRpFriday, May 11, 12
  • 16. we don’t need this complicated stuff. this is not java, you know.Friday, May 11, 12
  • 17. so what do we need? http://bit.ly/JiFSnqFriday, May 11, 12
  • 18. http://bit.ly/JFbZt8Friday, May 11, 12
  • 19. “SICP and some of the Sussman & Steele "Lambdathe ..." papers made a big impression on me yearsbefore, although I did not understand their fullmeaning then.Remember, I was recruited to "do Scheme" [...] Myinterest in languages such as Self informed asubversive agenda [...]. Likewise with first-classfunctions, which were inspired by Scheme [...]” http://bit.ly/JFbZt8Friday, May 11, 12
  • 20. http://bit.ly/JiEQYMFriday, May 11, 12
  • 21. Friday, May 11, 12
  • 22. Friday, May 11, 12
  • 23. Friday, May 11, 12
  • 24. Friday, May 11, 12
  • 25. Friday, May 11, 12
  • 26. Friday, May 11, 12
  • 27. going old school http://bit.ly/JiF7efFriday, May 11, 12
  • 28. e.g. passing functions aroundFriday, May 11, 12
  • 29. we see a lot of thisFriday, May 11, 12
  • 30. 1st, we extract what is commonFriday, May 11, 12
  • 31. then we refactor our functionsFriday, May 11, 12
  • 32. and we send them as argumentsFriday, May 11, 12
  • 33. e.g. closures not only for objectsFriday, May 11, 12
  • 34. we see a lot of thisFriday, May 11, 12
  • 35. we can keep writeComment as it isFriday, May 11, 12
  • 36. and we add a function with two closuresFriday, May 11, 12
  • 37. and we add a function with two closures immutableFriday, May 11, 12
  • 38. and we add a function with two closures mutable immutableFriday, May 11, 12
  • 39. now we don’t need to pass in the kitchen sinkFriday, May 11, 12
  • 40. e.g. functions all the way downFriday, May 11, 12
  • 41. we see a lot of thisFriday, May 11, 12
  • 42. first we extract common protocolFriday, May 11, 12
  • 43. then we clean up our functionsFriday, May 11, 12
  • 44. then we use them.Friday, May 11, 12
  • 45. then we use them. redundant?Friday, May 11, 12
  • 46. there is plenty to learn from.Friday, May 11, 12
  • 47. http://bit.ly/JiETndFriday, May 11, 12
  • 48. Friday, May 11, 12
  • 49. Qs? Phil Calçado - SoundCloud @pcalcado http://philcalcado.comFriday, May 11, 12
  • 50. http://bit.ly/work-at-soundcloudFriday, May 11, 12
  • 51. How to Design Programs - http://bit.ly/K0BfrL Structure 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