Coffee script throwdown
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Coffee script throwdown

  • 2,765 views
Uploaded on

Node.pgh Meetup 0.13 ...

Node.pgh Meetup 0.13

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,765
On Slideshare
1,727
From Embeds
1,038
Number of Embeds
1

Actions

Shares
Downloads
9
Comments
1
Likes
1

Embeds 1,038

http://www.scoop.it 1,038

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. 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!” http://altjs.org/
  • 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 (Hook.io, pdf.js, color.js) No Felix Geisendörferhttp://procbits.com/2012/05/18/why-do-all-the-great-node-js-develope 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 http://coffeescript.codeschool.com/http://arcturo.github.com/library/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 http://bonsaiden.github.com/JavaScript-Garden/ 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 http://www.youtube.com/watch?v=Sl1Uk3zT5Fg
  • 39. Issue in WebStorm 6 CoffeeScript gives you : WebStorm wants : Manually adjusting the source map reference makes it work...http://youtrack.jetbrains.com/issue/WEB-7091
  • 40. Even products that advertise CoffeeScript support can have issues...
  • 41. Add “await” and “defer” keywords for async
  • 42. Thanks!@nickmcclay