CoffeeScript clutchski@gmail.com      2011.12.09
( jump in anytime )
“Javascript is the assembly       of the web”
A seed of truth.•   Developer needs evolve, the language does not.•   Some folks are tackling complexity with compilers.  ...
Personally, not a fan.•   Too much distance between man and machine.•   Too fringe.•   Too useless.•   Too risky.•   Javas...
Until ...
CoffeeScript•   By Jeremy Ashkenas (of underscore & backbone fame)•   Released in 2009, now at version 1.1.3•   Philosophy...
Language Overview.
Strengths.
Scoping•   All compiled code executes in function scope.•   All variables are declared in function scope.•   Global variab...
Elegant syntax•   Significant whitespace.•   Concise function declarations.•   Concise literals.•   Sane inheritance.•   Be...
Excised “Bad Parts”•   Equality with type coercion.•   The with and eval statements.•   Trailing commas in object literals...
Lots of Sugar•   Comprehensions, string interpolations, default arguments,    multi-line strings, aliases for this and pro...
Weaknesses.
Debug Compiled Code.•   Table stakes.You need to know Javascript.•   Not a problem in my experience.    •   Compile in you...
Too cute sometimes?• Proliferation   of boolean symbols and operators    • true/false,         yes/no, on/off    • true   ...
Things to watch out for.
Everything is an expression.• Everything   is an expression, conditionals and loops included.• Functions   return last sta...
Tools.
They work.•   Javascript libraries work as normal.•   Compile on the fly.    • coffee    --watch, sprockets, guard, etc.•  ...
In the wild.•   Still a fraction of the JS world.•   Notable Users    •   Rails 3.1, Github, 37 Signals, Shopify•   Bootst...
So should you use it?
Obvious Risks.•   Yet another language.          •   But it’s small, easy to learn and is still just Javascript.•   Early ...
Your choice.
At least understand it•   You’ll face the same problems that motivated CoffeeScript.•   CoffeeScript is influencing the dir...
But I like it.
My CoffeeScript.•   http://www.showbomber.com•   https://github.com/clutchski/wolf•   https://github.com/clutchski/coffeel...
Resources•   http://coffeescript.org    •   Reference, books, tutorials, podcasts, etc.•   #coffeescript on freenode•   @c...
Thoughts? Questions?
Upcoming SlideShare
Loading in …5
×

Coffeescript

1,382 views
1,306 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,382
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • - feel free to jump it at any time\n
  • \n
  • - not really true\n- tons and tons of languagues ... GWT, Dart, Closurescript, objectivej, etc.\n
  • \n
  • \n
  • - 1:1 mapping between CoffeeScript and Javascript\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Coffeescript

    1. 1. CoffeeScript clutchski@gmail.com 2011.12.09
    2. 2. ( jump in anytime )
    3. 3. “Javascript is the assembly of the web”
    4. 4. A seed of truth.• Developer needs evolve, the language does not.• Some folks are tackling complexity with compilers. • Async, strong types, tier-less, language translators, etc.• Precedent: C++ originally compiled to C.• https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that- compile-to-JS
    5. 5. Personally, not a fan.• Too much distance between man and machine.• Too fringe.• Too useless.• Too risky.• Javascript is fine.
    6. 6. Until ...
    7. 7. CoffeeScript• By Jeremy Ashkenas (of underscore & backbone fame)• Released in 2009, now at version 1.1.3• Philosophy • “It’s just Javascript”. • Readable compiled code. • No runtime impact.
    8. 8. Language Overview.
    9. 9. Strengths.
    10. 10. Scoping• All compiled code executes in function scope.• All variables are declared in function scope.• Global variables must be explicitly added to the root context.• Strict lexical scope.
    11. 11. Elegant syntax• Significant whitespace.• Concise function declarations.• Concise literals.• Sane inheritance.• Beautiful to read and write.
    12. 12. Excised “Bad Parts”• Equality with type coercion.• The with and eval statements.• Trailing commas in object literals.• “Fall through” switch statements.
    13. 13. Lots of Sugar• Comprehensions, string interpolations, default arguments, multi-line strings, aliases for this and prototype, existential operator, immediate invocation, splats, array and object unpacking, fat arrow, chained comparisons, etc, etc.
    14. 14. Weaknesses.
    15. 15. Debug Compiled Code.• Table stakes.You need to know Javascript.• Not a problem in my experience. • Compile in your head. • Read the Javascript.• Debug line number mapping is coming ... someday, maybe?
    16. 16. Too cute sometimes?• Proliferation of boolean symbols and operators • true/false, yes/no, on/off • true == isnt false• Parenthesis invocation rules are inconsistent (but fine) • Reference: func • Invocation: func(), func(‘aa’), func ‘aa’
    17. 17. Things to watch out for.
    18. 18. Everything is an expression.• Everything is an expression, conditionals and loops included.• Functions return last statements by default.• Becareful to not return the value of loops/conditionals used for side effects. Might incur performance hit.• Ultimately, easy to remember.
    19. 19. Tools.
    20. 20. They work.• Javascript libraries work as normal.• Compile on the fly. • coffee --watch, sprockets, guard, etc.• Good editor support.
    21. 21. In the wild.• Still a fraction of the JS world.• Notable Users • Rails 3.1, Github, 37 Signals, Shopify• Bootstrapped compiler.• Popular in Node & the browser.• Plenty of repos, followers, watchers on Github.
    22. 22. So should you use it?
    23. 23. Obvious Risks.• Yet another language. • But it’s small, easy to learn and is still just Javascript.• Early adopter? • But syntax is quite stable, but things will change.• Flash in the pan? • Not likely but worst case, check in the Javascript.
    24. 24. Your choice.
    25. 25. At least understand it• You’ll face the same problems that motivated CoffeeScript.• CoffeeScript is influencing the direction of ECMAScript.next• And have some fun.
    26. 26. But I like it.
    27. 27. My CoffeeScript.• http://www.showbomber.com• https://github.com/clutchski/wolf• https://github.com/clutchski/coffeelint
    28. 28. Resources• http://coffeescript.org • Reference, books, tutorials, podcasts, etc.• #coffeescript on freenode• @coffeescript
    29. 29. Thoughts? Questions?

    ×