Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CoffeeScript the Awesome

CoffeeScript the Awesome

CoffeeScript - “a little language that compiles into JavaScript” has been making a lot of noise in the web community with its inclusion in Ruby on Rail v3 and its swift rise in popularity on Github.

This session will look at the benefits this language brings over the native JavaScript alternative, the syntactical double rainbow it creates, the problems you’ll face and of course how you can actually use it in different technology stacks such as Ruby, node.js, .NET and Java.

James Hughes

November 07, 2011
Tweet

More Decks by James Hughes

Other Decks in Programming

Transcript

  1. 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  iniJal  compilaJon  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  sJll  use  jQuery  or  anything  else  you  want   •  JavaScript  produced  by  the  CoffeeScript  compiler  is   performant,  valid  and  well  formaQed.  
  2. •  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  syntacJcal  sugar  with   some  extra  syntax  benefits   –  No  more  random  semi-­‐colon  inserJon   –  No  more  accidental  global  scoping  of  declaraJons   –  Scoping    syntax  built  right  in   –  AutomaJc  “hoisJng”  of  variable  declaraJons   •  Not  everyone  is  a  massive  fan   A  Few  (More)  CoffeeScript  Facts  
  3. *  Never  do  this  in  real  life  kthanxai   Variable

     DeclaraJon   FuncJon  DeclaraJon   FuncJon  Call   String  InterpolaJon   Loop  Comprehension   English  NotaJon   Range  Compreshension  
  4. CoffeeScript:  A  Guided  Tour   -­‐  or  -­‐    

    CoffeeScript:  A  Guided  Tour  of  the  Website,  Pre4y   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.  
  5. Using  CoffeeScript  in  .NET   -­‐  or  -­‐    

    What?    You  think  we’d  let  those  script  kiddies  have  all   the  fun?    Hells  no!  
  6. Compile  On  Demand   …and  others   Shameless Plug (but

    I am distracting you through the use of Comic Sans)