Presentación · Title: Presentación Created Date: 20150220103347Z
Presentación CoffeeScript
-
Upload
rodrigo-manjon -
Category
Technology
-
view
174 -
download
5
description
Transcript of Presentación CoffeeScript
![Page 1: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/1.jpg)
![Page 2: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/2.jpg)
Autores Rodrigo
Manjón Martín
Maria Del Alba
Pedrajas Porras
David
Rodríguez Terradillos
![Page 3: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/3.jpg)
Índice
● Introducción JS y CoffeeScript
● Instalación y Uso
● Sintaxis
● Demo
12,3%
![Page 4: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/4.jpg)
IntroducciónJavaScript fue creado por Brendan Eich, programador de Netscape en 1995. Surgio por la necesidad de un lenguaje de programacion que se ejecutara en el mismo navegador para hacer los procesos de validacion de formularios mas rapidos.
Fue relegado por unos anos debido a que era visto como un lenguaje complejo.
![Page 5: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/5.jpg)
Introducción
Ajax devolvio a JavaScript empuje y fama con la creacion de nuevos frameworks y librerıas, aumentando tambien el uso.
Y sobre todo el libro de Douglas Crockford JavaScript: The Good Parts que se hizo muy popular.
![Page 6: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/6.jpg)
IntroducciónCoffeeScript, creado por Jeremy Ashkenas, nace como pequeno lenguaje de programacion que compila a Javascript.
Esto supone una gran ventaja, JavaScript es un lenguaje complejo, de difıcil comprension, no existen clases y la orientacion a objetos se hace complicada de llevar a cabo.
CoffeeScritp es un lenguaje sencillo basado en Syntactic Sugar.
![Page 7: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/7.jpg)
Instalación y Uso
28,7%
![Page 8: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/8.jpg)
Instalación
> nmp install -g coffee-script
![Page 9: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/9.jpg)
Instalación
$ brew update
$ brew install node
$ nmp install -g coffee-script
&
![Page 10: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/10.jpg)
Como se Usa (Compilar)
# Compilar un fichero$ coffee --compile file.coffee
# Compilar directorio$ coffee --compile --output /lib /src
# Compilar Automaticamente$ coffee --watch --compile file.coffee
![Page 11: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/11.jpg)
Como se Usa (REPL)
# Usar el evaluador Read Eval Print Loop
$ coffee
![Page 12: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/12.jpg)
Sintaxis
49,2%
![Page 13: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/13.jpg)
Funciones
square = (x) -> x * x
cube = (x) -> square(x)*x
![Page 14: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/14.jpg)
Funciones
fill=(container, liquid = “coffee”) ->“Filling the #{container} with #{liquid}”
![Page 15: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/15.jpg)
Arrays y Objetos
song = ["do", "re", "mi", "fa", "so"]
singers = {Jagger: "Rock", Elvis: "Roll"}
bitlist = [1, 0, 11, 0, 11, 1, 0
]
![Page 16: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/16.jpg)
Arrays y Objetos
kids = brother:
name: “Max”age: 11
sister:name: “Ida”age: 19
65,6%
![Page 17: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/17.jpg)
if, else, unlees y
Asignamiento Condicional
mood = greatlyImproved if singing
date = if friday then sue else jill
![Page 18: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/18.jpg)
if, else, unlees y
Asignamiento Condicional
if happy and knowsIt clapsHands()chaChaCha()
elseshowIt()
![Page 19: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/19.jpg)
#Eat launch.eat food for food in ['toast', 'cheese', 'wine']
# Fine five course dining.courses = ['greens','caviar','truffles','roast','cake'] menu i + 1, dish for dish, i in courses
Bucles y Comprehention
77,9%
![Page 20: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/20.jpg)
# Health conscious meal.foods = ['broccoli', 'spinach', 'chocolate']eat food for food in foods when food isnt ‘chocolate’
#Key-Value interacting.yearsOld = max: 10, ida: 9, tim: 11ages = for child, age of yearsOld
"#{child} is #{age}"
Bucles y Comprehention
![Page 21: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/21.jpg)
buy() while supply > demand sell() until supply > demand
num = 6lyrics = while num -= 1
“#{num} little monkeys, jumping on the bed.”
Bucles y Comprehention
![Page 22: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/22.jpg)
Demo
90,2%
https://github.com/rodrimmbdev/dni_coffee.git
![Page 23: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/23.jpg)
¿Dudas?
94,3%
![Page 24: Presentación CoffeeScript](https://reader033.fdocuments.es/reader033/viewer/2022052621/5583d22ed8b42a6b638b50b5/html5/thumbnails/24.jpg)
Gracias
100%