10 reasons to love CoffeeScript

943 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
943
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

10 reasons to love CoffeeScript

  1. 1. 10 razões para você usar CoffeeScript e se apaixonar... Lukas AlexandreSaturday, January 19, 13
  2. 2. 1-Sintaxe limpa • Inspirada em Ruby e Python; • Parênteses opcionais; message = Hello World sayHello messageSaturday, January 19, 13
  3. 3. 2-Impõe boas práticas de JS • Escopos fechados; • Previne “global namespace flooding”; sayHello = (message) -> (function() { console.log message var sayHello; sayHello Hello World sayHello = function(message) { return console.log(message); }; sayHello(Hello World); }).call(this);Saturday, January 19, 13
  4. 4. 3-Fat Arrow • Workarounds imbutidos; coffee = var coffee = { isFull: true isFull: true, watchDrink: -> watchDrink: function(){ $(.drink a).on click, => var that = this; @isFull = false $(.drink a).on(click, function(){ that.isFull = false; }); } }Saturday, January 19, 13
  5. 5. 4-Interpolação de strings • Chega de + + + + name = John Doe var name = John Doe; console.log "Hi, my name is #{name}" console.log("Hi, my name is " + "name")Saturday, January 19, 13
  6. 6. 5-List Comprehensions names = [Foo, Bar, Baz] var names = [Foo, Bar, Baz]; console.log(name) for name in names for(var i=0; i < names.length; i++){ console.log(names[i]); }Saturday, January 19, 13
  7. 7. 6-Modificadores Condicionais allowEntrance() unless age < 21 if(age > 21) { allowEntrance() if age >= 21 allowEntrance() } if(age >= 21) { allowEntrance() }Saturday, January 19, 13
  8. 8. 7-Classes class Coffee constructor: (@name) -> brew: -> console.log Brewing description: -> console.log "Coffee is #{@name}" frenchCoffee = new Coffee(French) frenchCoffee.description # Coffee is FrenchSaturday, January 19, 13
  9. 9. 8-Uma visão do futuro • Suporte de Brendan Eich; • @ e => no JS;Saturday, January 19, 13
  10. 10. 9-Aceitação da comunidade • Rails >= 3.1; • Python & PHP; • Unit Testing frameworks;Saturday, January 19, 13
  11. 11. 10-Ótimas fontes de aprendizado • http://coffeescript.org • http://coffeescriptcookbook.com • http://www.codeschool.com/courses/ coffeescriptSaturday, January 19, 13
  12. 12. Contato • pessoal: lukasalexandre@me.com • profissional: lukas@codelogic.me • http://github.com/lukasalexandreSaturday, January 19, 13
  13. 13. Perguntas?Saturday, January 19, 13
  14. 14. Referências • http://www.netmagazine.com/features/10- good-reasons-use-coffeescriptSaturday, January 19, 13

×