Download - CoffeeScript the Awesome

Transcript
Page 1: CoffeeScript the Awesome
Page 2: CoffeeScript the Awesome

CoffeeScriptThe Awesome

Page 3: CoffeeScript the Awesome

“A Propos de Moi”

@kouphax

http://yobriefca.se

http://github.com/kouphax

Page 4: CoffeeScript the Awesome
Page 5: CoffeeScript the Awesome

A Few CoffeeScript Facts

• Created by Jeremy Ashkenas circa late 2009• Spawned from reading “Create Your Own Programming

Language”• CoffeeScript compiles to, and executes as, JavaScript in the

browser.• CoffeeScript simply offers an initial compilation step prior to

the JavaScript being interpreted – what's the harm in that?• CoffeeScript does not require you to abandon all your JS

libraries– Yes you can still use jQuery or anything else you want

• JavaScript produced by the CoffeeScript compiler is performant, valid and well formatted.

Page 6: CoffeeScript the Awesome

• Debugging CoffeeScript directly is currently not possible so this adds another layer of complexity– In reality mapping between CoffeeScript and the generated

JavaScript isn’t difficult• Could be considered just syntactical sugar with some

extra syntax benefits– No more random semi-colon insertion– No more accidental global scoping of declarations– Scoping syntax built right in– Automatic “hoisting” of variable declarations

• Not everyone is a massive fan

A Few (More) CoffeeScript Facts

Page 7: CoffeeScript the Awesome
Page 8: CoffeeScript the Awesome

* Never do this in real life kthanxai

Varia

ble

Dec

lara

tion

Func

tion

Dec

lara

tion

Func

tion

Call

Strin

g In

terp

olati

on

Loop

Com

preh

ensi

on

English Notation

Range Compreshension

Page 9: CoffeeScript the Awesome
Page 10: CoffeeScript the Awesome

CoffeeScript: A Guided Tour- or -

CoffeeScript: A Guided Tour of the Website, Pretty Much, Except in Slide Form but Not Because I am Lazy,

No, More so Because It’s a Fairly Comprehensive Document of the Features of CoffeeScript.

Page 11: CoffeeScript the Awesome

Functions

Page 12: CoffeeScript the Awesome

Functions

Page 13: CoffeeScript the Awesome

Objects

Page 14: CoffeeScript the Awesome

Conditionals

Page 15: CoffeeScript the Awesome

Operators and Aliases

Page 16: CoffeeScript the Awesome

Splats

Page 17: CoffeeScript the Awesome

Loops and Comprehensions

Page 18: CoffeeScript the Awesome

Array Slicing and Ranges

Page 19: CoffeeScript the Awesome

Classes

Page 20: CoffeeScript the Awesome

Odds and Ends

Page 21: CoffeeScript the Awesome

Using CoffeeScript in .NET- or -

What? You think we’d let those script kiddies have all the fun? Hells no!

Page 22: CoffeeScript the Awesome

Compile On Demand

…and others

Shameless Plug(but I am distracting you through the use of Comic Sans)

Page 23: CoffeeScript the Awesome

Pre-compile

Page 24: CoffeeScript the Awesome
Page 25: CoffeeScript the Awesome

Questions?