This document discusses CoffeeScript, a programming language that compiles to JavaScript. It provides an overview of CoffeeScript, highlighting its clarity, uniformity, and ease of translation to JavaScript. Key points include that CoffeeScript has alternative syntax that some find cleaner than JavaScript, compiles to readable JavaScript code, and is used by many popular Node.js modules and developers. Challenges of CoffeeScript like debugging and learning pains are also addressed.
5. “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!”
6. Let’s take a deep breath
and try and have an open
mind here...
7. 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
8. What is a Trans-compiling
Language?
Language?
Compile
.coffee .js
9. 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/
13. 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örfer
http://procbits.com/2012/05/18/why-do-all-the-great-node-js-develope
Tim Caswell (NVM)
14. And Yet...
Larger Node Community
Yes
Currently ranked 4th as the
most depended upon module in
NPM
More than Express! (just
barely)
17. Give it a try!
Install
sudo npm install -g coffee-script
Start the CoffeeScript REPL
coffee
Compile a .coffee file into equivalent .js
coffee --compile <path to js file>
Compile .coffee file when source changes
coffee --watch --compile <path to js file>
Compile and start file with Node.js
coffee --nodejs <path to node.js file>
27. Fix some JavaScript pitfalls
http://bonsaiden.github.com/JavaScript-Garden/
this, null and undefined, prototype wackiness, goodbye
default global!
28. Ease of Translation to Javascript
The golden rule of CoffeeScript is: "It's just JavaScript"
The compiled output is readable and pretty-printed,
passes through JavaScript Lint without warnings
30. 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.
35. CoffeeScript Pain Points?
Requires a compilation step (use file watcher or --watch)
Community is a subset of larger JavaScript community
Debugging...
40. 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