introducción a groovy y grails

58
DESARROLLO DE APLICACIONES WEB CON GROOVY Y GRAILS por Alberto Vilches http://albertovilches.com Twitter: @albertovilches Miércoles 15 Junio 20011

Upload: alberto-vilches

Post on 11-Jun-2015

5.629 views

Category:

Technology


9 download

DESCRIPTION

Presentación de la charla sobre Groovy y Grails en Autentia el Miércoles 15 de Junio de 2011

TRANSCRIPT

Page 1: Introducción a Groovy y Grails

DESARROLLO DE APLICACIONES WEB

CON

GROOVY Y GRAILS

por Alberto Vilcheshttp://albertovilches.com

Twitter: @albertovilchesMiércoles 15 Junio 20011

Page 2: Introducción a Groovy y Grails

SOBRE MI

Pasado• Trabajando en desarrollo desde 1998• Programador en Clipper y Delphi• Programador en Java y J2EE desde 2001• Instructor y consultor de Bea• Administrador de sistemas en AenaPresente• Programador freelance en Grails y Flex• Partner de Escuela de Groovy• Evangelizador Groovy y Grails• Fundador de la conferencia Greach

Page 3: Introducción a Groovy y Grails

AGENDA

• Un poco de Groovy

• Un poco de Grails

• Código en vivo entre medias

Page 4: Introducción a Groovy y Grails

¿QUÉ ES GROOVY?

2003 - James Strachan’s Bloghttp://radio-weblogs.com/0112098/2003/08/29.html

2007 - Groovy 1.0

2008 - Groovy 1.1 -> 1.5

2009 - Groovy 1.7

2011 - Groovy 1.8

Guillaume LaforgeAndres Almiray (Griffon)Graeme Rocher (Grails)Peter Niederwieser (Spock)Jochen TheodoruHamlet D’Arcy…

Page 5: Introducción a Groovy y Grails

RECURSOS

Page 6: Introducción a Groovy y Grails

¿QUÉ ES GROOVY?

• Groovy es Java• Dinámico• Inspirado en Ruby, Python y Smalltalk• OOP puro• Closures, Gstrings, Builders, DSL

Page 7: Introducción a Groovy y Grails

¿QUÉ ES GROOVY?

• Groovy es Java.• Dinámico• Inspirado en Ruby, Python y Smalltalk• OOP puro• Closures, Gstrings, Builders, DSL• No compile type-checking• Ligeramente más lento que Java

Page 8: Introducción a Groovy y Grails

HELLOWORLD.JAVA

Page 9: Introducción a Groovy y Grails

HELLOWORLD.GROOVY

Page 10: Introducción a Groovy y Grails

HELLOWORLD.GROOVY

Public por defecto; opcionales

Page 11: Introducción a Groovy y Grails

HELLOWORLD.GROOVY

Getters y setters autogeneradosreturn opcional

Page 12: Introducción a Groovy y Grails

HELLOWORLD.GROOVY

No hace falta especificar tipoGstrings - println

Page 13: Introducción a Groovy y Grails

HELLOWORLD.GROOVY

Scripts

Page 14: Introducción a Groovy y Grails

POGOS

Page 15: Introducción a Groovy y Grails

SINTAXIS NATIVA COLECCIONES

Page 16: Introducción a Groovy y Grails

SINTAXIS NATIVA COLECCIONES

Page 17: Introducción a Groovy y Grails

BUCLES

Page 18: Introducción a Groovy y Grails

BUCLES

Page 19: Introducción a Groovy y Grails

GDK

Page 20: Introducción a Groovy y Grails

GDK

Page 21: Introducción a Groovy y Grails

XML

Page 22: Introducción a Groovy y Grails

¿QUÉ ES GRAILS?

• Groovy sobre Spring• RAD en Java, no framework• CoC -> No XML• MVC (binding, i18n, validation) + persistencia• Servidor (Tomcat) y bbdd (HSQL) embebidos• Debug en caliente, Genera WAR.• Scaffolding• Testing• Extensible: plugins

Page 23: Introducción a Groovy y Grails

QUE INCLUYE

Stack completo preconfigurado:

• Testing y build• Junit y Ant

• Vistas• SpringMVC, Sitemesh, GSP, taglib

• Servicios• transacciones, Spring

• Persistencia: GORM• mapeo automático con Hibernate

Page 24: Introducción a Groovy y Grails

DEMO

• Crear proyecto• grails create-app Demo• Crear un controlador• grails create-controller HelloWorld• render “hello world!”

• Lanzar servidor• grails run-app

• Modificar en caliente• Empaquetar la aplicación

• grails war

Page 25: Introducción a Groovy y Grails

ESTRUCTURA DEL PROYECTO

Page 26: Introducción a Groovy y Grails

CONTROLADORES

Page 27: Introducción a Groovy y Grails

CONTROLADORES

Page 28: Introducción a Groovy y Grails

CONTROLADORES

Page 29: Introducción a Groovy y Grails

VISTAS

Page 30: Introducción a Groovy y Grails

VISTAS

Page 31: Introducción a Groovy y Grails

VISTAS

Page 32: Introducción a Groovy y Grails

VISTAS

Page 33: Introducción a Groovy y Grails

MODELO -> VISTA

Page 34: Introducción a Groovy y Grails

CONTROLADORES

paramssessionrequestresponse…

Page 35: Introducción a Groovy y Grails

VISTAS

Page 36: Introducción a Groovy y Grails

VISTAS

Page 37: Introducción a Groovy y Grails

TAGLIBS

Page 38: Introducción a Groovy y Grails

TAGLIBS

Page 39: Introducción a Groovy y Grails

TAGLIBS

Page 40: Introducción a Groovy y Grails

TAGLIBS

Page 41: Introducción a Groovy y Grails

CONFIGURACION

Page 42: Introducción a Groovy y Grails

MODELO DE DATOS: GORM

Page 43: Introducción a Groovy y Grails

MODELO DE DATOS: GORM

Page 44: Introducción a Groovy y Grails

MODELO DE DATOS: GORM

Page 45: Introducción a Groovy y Grails

MODELO DE DATOS: GORM

Genero 1 * Película

Page 46: Introducción a Groovy y Grails

MODELO DE DATOS: GORM

Page 47: Introducción a Groovy y Grails

SERVICIOS

Page 48: Introducción a Groovy y Grails

SERVICIOS

Page 49: Introducción a Groovy y Grails

SERVICIOS

Page 50: Introducción a Groovy y Grails

SERVICIOS

Page 51: Introducción a Groovy y Grails

SERVICIOS

Page 52: Introducción a Groovy y Grails

SERVICIOS

Page 53: Introducción a Groovy y Grails

SERVICIOS

singletonprototyperequestsession

Page 54: Introducción a Groovy y Grails

Y MUCHO MÁS

• I18n• Filters• Layouts (Sitemesh)• Testing• Plugins

• Quartz• Xfire• Compass, Searchable• Spring Security, Shiro• Cache• Flex• NoSQL: redis, MongoDb

Page 55: Introducción a Groovy y Grails

COMUNIDAD

• Grupo de usuarios de Madrid• http://sites.google.com/site/madridgug

• Grupo de usuarios de Levante• http://groups.google.com/group/grupo-de-usuarios-groov

y-grails-levante

• Lista de Grails en castellano• http://groups.google.com/group/grailsencastellano

Page 56: Introducción a Groovy y Grails

EVENTOS NACIONALES

• Spring IO• Anualmente (sobre Febrero)

• Madrid GUG• Quedadas mensuales

• Greach• En Madrid, el 4 de Noviembre de 2011

• (dentro de 5 meses)

• ¡Gratis!• Apúntate en http://greach.es

Page 57: Introducción a Groovy y Grails

NOS VEMOS EN

Valladolid, 2 de JulioCurso práctico de 4 horasGrails + Oauth/Twitter + Google/OpenId

Tenerife Lan Party, 21 y 22 de JulioTaller de Grails, 2 horas

O en @albertovilches

Page 58: Introducción a Groovy y Grails

¡GRACIAS!

¿Preguntas?¿Dudas?