Your SlideShare is downloading. ×
Coffee script throwdown
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Coffee script throwdown


Published on

Node.pgh Meetup 0.13 …

Node.pgh Meetup 0.13

Published in: Technology

1 Comment
1 Like
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Throw-downNode.pgh Meetup
  • 2. Nicholas McClayUX Designer & Developer@nickmcclay
  • 3. There are a lot of opinions about CoffeeScript
  • 4. “You can take my JavaScript when you pry it from“You can take my JavaScript when you pry it from my cold dead hands!” my cold dead hands!”
  • 5. Let’s take a deep breathand try and have an open mind here...
  • 6. What is ? CoffeeScript is a small language that compiles into JavaScript Usable for client-side and server-side applications (Node.js) Has an opinionated alternative syntax for building JavaScript applications
  • 7. What is a Trans-compiling Language? Language? Compile .coffee .js
  • 8. Pick your problem“I want a better JavaScript!” “I want functional programming!” “I want strict typing!” Objective-J “I want Objective-C!” “I work at google!”
  • 9. Why should I care about CoffeeScript?
  • 10. Question: How many of you use CoffeeScript?
  • 11. Question: How many ofyou have used a modulewritten in CoffeeScript?
  • 12. Isaac Schleuter (maintainer of Node.js / NPM) Node’s top contributors TJ Holowaychuk (express, Jade, Mocha) No Mikeal Rogers (Request) No No James Haliday "substack" (Browserify, dnode, Optimist) No Guillermo Rauch (Socket.IO) No No Aaron Heckmann (Mongoose) No No Nathan Rajich "Too Tall Nate" (node-gyp) No Marak Squires (, pdf.js, color.js) No Felix Geisendörfer Tim Caswell (NVM)
  • 13. And Yet...Larger Node Community Yes Currently ranked 4th as the most depended upon module in NPM More than Express! (just barely)
  • 14. Getting Started with CoffeeScript
  • 15. Learning CoffeeScript
  • 16. Give it a try! Installsudo npm install -g coffee-script Start the CoffeeScript REPLcoffee Compile a .coffee file into equivalent .jscoffee --compile <path to js file>Compile .coffee file when source changescoffee --watch --compile <path to js file> Compile and start file with Node.jscoffee --nodejs <path to node.js file>
  • 17. Basic Node Connect Server
  • 18. CoffeeScript Principles 1 - Clarity 2 - Uniformity 3 - Ease of Translation to JavaScript
  • 19. Clarity
  • 20. Significant White Space 1/2 to 1/3 compared to pure JavaScript
  • 21. Keywords
  • 22. Default Arguments
  • 23. ((Parentheticals) Optional)
  • 24. Uniformity Everything is an expression!
  • 25. Language Enhancements Array Comprehension, Classes, and much more...
  • 26. Fix some JavaScript pitfalls this, null and undefined, prototype wackiness, goodbye default global!
  • 27. Ease of Translation to Javascript The golden rule of CoffeeScript is: "Its just JavaScript" The compiled output is readable and pretty-printed, passes through JavaScript Lint without warnings
  • 28. Learning Pains
  • 29. CoffeeScript Misunderstandings CoffeeScript is NOT a superset of JavaScript CoffeeScript is compiled NOT interpreted at runtime You must SHOULD learn JavaScript before using CoffeeScript Compiled CoffeeScript CAN be slower than pure JavaScript, but really this usually isn’t an issue.
  • 30. Mind the gap...
  • 31. Mind the gap...
  • 32. Punctuation Counts...
  • 33. Punctuation Counts... OR
  • 34. CoffeeScript Pain Points?Requires a compilation step (use file watcher or --watch)Community is a subset of larger JavaScript communityDebugging...
  • 35. CoffeeScript Debugging Strategies
  • 36. Mental Map Debugging “You wanted to write it in CoffeeScript, you figure it out.”
  • 37. Source Map Debugging .js .map .coffee
  • 38. WebStorm + CoffeeScript
  • 39. Issue in WebStorm 6 CoffeeScript gives you : WebStorm wants : Manually adjusting the source map reference makes it work...
  • 40. Even products that advertise CoffeeScript support can have issues...
  • 41. Add “await” and “defer” keywords for async
  • 42. Thanks!@nickmcclay