6. The bad parts
• Global Variables
• operator overloading in a dynamic typed language
• semicolon optional
• typeof inconsistency. null = object?!
• ==,===, !=
• false, null, undefined, NaN
15. The golden rule of CoffeeScript is: "It's just JavaScript". The
code compiles one-to-one into the equivalent JS, and there is no
interpretation at runtime. [....].
The compiled output is readable and pretty-printed, passes
through JavaScript Lint without warnings, will work in every
JavaScript runtime, and tends to run as fast or faster than the
equivalent handwritten JavaScript.
“It's just javascript!”
18. Whats good about CoffeeScript
• Private by default
• no more variable leaking
• == vs ===, Fuzzy matching is gone. "is" is the ===
• Passes JSLint with flying colours.
19. Getting Started With CoffeeScript
• CoffeeScript.org is the best resource available.
• Install Node.js and install the CoffeeScript compiler
• coffee -c filename.coffee generates the javascript!
20. What well go over
• Syntax
• Whitespace Matters
• Object Syntax
• Everything is an expression
• Comprehension
• Classes, Inheritance
• Bound Functions
• Conditionals
24. Everything is an expression
x = 4
lessmessage = "less then four"
greatermessage = "greater than or equal to four"
message = if x < 4 then less message else greatermessage
alert message
numberToString = (value) ->
switch value
when value is 1 then "one"
when value is 2 then "two"
when value is 3 then "three"
when value is 4 then "four"
number = numberToString(3)
alert number
25. Comprehension
items = [1,2,3,4,5,6,7,8,9,10]
doubleitems = (double num for num in items when num <5)
tripleitems = (triple num for num in items when num >= 5)
double = (x)->
x*2
triple = (x)->
x*3
- Some projects ive worked on\n- Describe the projects\n- Talk about the ARC\n- Personal projects use CoffeeScript\n
- CoffeeScript 101\n- Popular language taking over the landscape\n- Dropbox recently changed over most of their code to CoffeeScript.\n- If DB can change with there immense scale, then there has to be something to it.\n- before we see what that something is, lets take a step back and go back in time to 2005\n
- JS is 17 years old. \n- Originally Mocha, LiveScript. \n- Brendan Eich created this in 3 days. But it still lives today.\n- lots of holes, but behind those scars lies a beautiful language.\n\n- Before Javascript was for garbage mouse followers, flashy things, and a lot of people werent really js developers\n- in 2005 google introduced Google maps which became a revolution in JS\n- Suddenly javascript went from being a bullshit sprinkled language to a full blown powerhouse in the eyes of developers\n- Frameworks cropped up, JQUery came out. and in 2012, HTML5 and JS have taken over.\n\n- but theres a problem. \n- JS is very clunky, and very very hard to write Google Map type web apps without tons of time invested.\n- Time = Money \n- Gets very messy and unreadable after a while.\n\n- Ajax, and other stuff\n\n- in short JS has its bad parts\n\n
\n
- Great book by Douglas Crockford.\n- Pioneer in good JS development\n- JSLint/ JSOn Libraries\n- following these &#x201C;good parts&#x201D; is not always easy.\n
Not always easy to adopt to changes. \nTons of JS libraries make it hard. Some might be bad, not your fault!\n\n
On December 13, 2009, Jeremy Ashkenas made the first Git commit of CoffeeScript with the comment: "initial commit of the mystery language."[9] The compiler was written in Ruby. \nOn December 24, he made the first tagged and documented release, 0.1.0. On February 21, 2010, he committed version 0.5, which replaced the Ruby compiler with one written in pure CoffeeScript. By that time the project had attracted several other contributors on GitHub, and was receiving over 300 page hits per day.\nOn December 24, 2010, Ashkenas announced the release of stable 1.0.0 to Hacker News, the site where the project was announced for the first time.[10][11]\n\nTalk abou how you came to the language. what were you doing?\n\n
- in 2006 google announced GWT\n- holy crist mind blown, java to javascript. no need to learn that javascript crap anymore.\n- Checked it out. Had to go through tons of hoops. \n- Install extension ,etc etc. JS it outputs is cryptic.\n
- first impression. wow look at how optimized my js i, hell ya hell ya\n- I love this tool.when people see im doing this ill be so cool\n\n
- Makes your JS hard to debug. Obfuscation is fine in production, but in development its stupid.\n- on the contrary, take a look at what CoffeeScript outputs\n
- Boring old javascript. nothing special.\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
A new hope of Javascript.\nCleaner more efficent.\nWith Node.js its even more awesome.\nPlease check it out.\n\n\n