Throw-downNode.pgh Meetup
Nicholas McClayUX Designer & Developer@nickmcclay
There are a lot of opinions   about CoffeeScript
“You can take my JavaScript when you pry it from“You can take my JavaScript when you pry it from             my cold dead ...
Let’s take a deep breathand try and have an open       mind here...
What is                                                   ? CoffeeScript is a small language that compiles into JavaScript...
What is a Trans-compiling       Language?       Language?              Compile    .coffee             .js
Pick your problem“I want a better JavaScript!”                                    “I want functional                      ...
Why should I care about    CoffeeScript?
Question: How many of you use CoffeeScript?
Question: How many ofyou have used a modulewritten in CoffeeScript?
Isaac Schleuter (maintainer of Node.js / NPM)        Node’s top contributors            TJ Holowaychuk (express, Jade, Moc...
And Yet...Larger Node Community        Yes Currently ranked 4th as the most depended upon module in           NPM  More th...
Getting Started with    CoffeeScript
Learning CoffeeScript  http://coffeescript.codeschool.com/http://arcturo.github.com/library/coffeescript/
Give it a try!                   Installsudo npm install -g coffee-script         Start the CoffeeScript REPLcoffee  Compi...
Basic Node Connect Server
CoffeeScript Principles       1 - Clarity       2 - Uniformity       3 - Ease of       Translation       to JavaScript
Clarity
Significant White Space   1/2 to 1/3 compared to pure JavaScript
Keywords
Default Arguments
((Parentheticals) Optional)
Uniformity      Everything is an expression!
Language Enhancements Array Comprehension, Classes, and much more...
Fix some JavaScript pitfalls    http://bonsaiden.github.com/JavaScript-Garden/  this, null and undefined, prototype wackin...
Ease of Translation to Javascript The golden rule of CoffeeScript is: "Its just JavaScript" The compiled output is readabl...
Learning Pains
CoffeeScript Misunderstandings CoffeeScript is NOT a superset of JavaScript CoffeeScript is compiled NOT interpreted at ru...
Mind the gap...
Mind the gap...
Punctuation Counts...
Punctuation Counts...   OR
CoffeeScript Pain Points?Requires a compilation step (use file watcher or --watch)Community is a subset of larger JavaScri...
CoffeeScript Debugging       Strategies
Mental Map Debugging “You wanted to write it in CoffeeScript, you figure it out.”
Source Map Debugging      .js   .map   .coffee
WebStorm + CoffeeScript  http://www.youtube.com/watch?v=Sl1Uk3zT5Fg
Issue in WebStorm 6          CoffeeScript gives you :             WebStorm wants :    Manually adjusting the source map   ...
Even products that advertise CoffeeScript       support can have issues...
Add “await” and “defer” keywords for async
Thanks!@nickmcclay
Coffee script throwdown
Upcoming SlideShare
Loading in...5
×

Coffee script throwdown

2,403

Published on

Node.pgh Meetup 0.13

Published in: Technology
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
2,403
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Coffee script throwdown

  1. 1. Throw-downNode.pgh Meetup
  2. 2. Nicholas McClayUX Designer & Developer@nickmcclay
  3. 3. There are a lot of opinions about CoffeeScript
  4. 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. 5. Let’s take a deep breathand try and have an open mind here...
  6. 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. 7. What is a Trans-compiling Language? Language? Compile .coffee .js
  8. 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. 9. Why should I care about CoffeeScript?
  10. 10. Question: How many of you use CoffeeScript?
  11. 11. Question: How many ofyou have used a modulewritten in CoffeeScript?
  12. 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. 13. And Yet...Larger Node Community Yes Currently ranked 4th as the most depended upon module in NPM More than Express! (just barely)
  14. 14. Getting Started with CoffeeScript
  15. 15. Learning CoffeeScript http://coffeescript.codeschool.com/http://arcturo.github.com/library/coffeescript/
  16. 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. 17. Basic Node Connect Server
  18. 18. CoffeeScript Principles 1 - Clarity 2 - Uniformity 3 - Ease of Translation to JavaScript
  19. 19. Clarity
  20. 20. Significant White Space 1/2 to 1/3 compared to pure JavaScript
  21. 21. Keywords
  22. 22. Default Arguments
  23. 23. ((Parentheticals) Optional)
  24. 24. Uniformity Everything is an expression!
  25. 25. Language Enhancements Array Comprehension, Classes, and much more...
  26. 26. Fix some JavaScript pitfalls http://bonsaiden.github.com/JavaScript-Garden/ this, null and undefined, prototype wackiness, goodbye default global!
  27. 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. 28. Learning Pains
  29. 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. 30. Mind the gap...
  31. 31. Mind the gap...
  32. 32. Punctuation Counts...
  33. 33. Punctuation Counts... OR
  34. 34. CoffeeScript Pain Points?Requires a compilation step (use file watcher or --watch)Community is a subset of larger JavaScript communityDebugging...
  35. 35. CoffeeScript Debugging Strategies
  36. 36. Mental Map Debugging “You wanted to write it in CoffeeScript, you figure it out.”
  37. 37. Source Map Debugging .js .map .coffee
  38. 38. WebStorm + CoffeeScript http://www.youtube.com/watch?v=Sl1Uk3zT5Fg
  39. 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. 40. Even products that advertise CoffeeScript support can have issues...
  41. 41. Add “await” and “defer” keywords for async
  42. 42. Thanks!@nickmcclay
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×