Tomas Grails

36
What can Grails do for me? An intro to Grails for Flex and Java developers Flex on Java Exchange, London, June, 2010 Tomas Lin ( @tomaslin ) Wednesday, 16 June 2010

Transcript of Tomas Grails

Page 1: Tomas Grails

What can Grails do for me?

An intro to Grails for Flex and Java developers

Flex on Java Exchange, London, June, 2010

Tomas Lin ( @tomaslin )

Wednesday, 16 June 2010

Page 2: Tomas Grails

Life is too short for XML

Wednesday, 16 June 2010

Page 3: Tomas Grails

Agenda

• Who is this guy?

• 4 Cool Things About Grails.

• Building a Grails app.

• Flex and Grails - grails flex scaffold demo.

• Flex and Grails - blazeds4 plugin demo

• Questions?

Wednesday, 16 June 2010

Page 4: Tomas Grails

Who is this guy?

• Don’t worry, I’m not trying to sell you anything.

• Currently a senior developer at DMC digital

• Java / UI Developer since 2000.

• Worked with Grails and Flex for about 2.5 years.

• Canadian citizen born in Taiwan, raised in Guatemala and working in the UK.

Wednesday, 16 June 2010

Page 5: Tomas Grails

Blue Ember Grills

Flex 3 &Grails

Wednesday, 16 June 2010

Page 6: Tomas Grails

Suzuki Canada Flex 3 & Grails

Wednesday, 16 June 2010

Page 7: Tomas Grails

Dan Aykroyd Wines HTML, CSS, Flex 3, Grails

Wednesday, 16 June 2010

Page 8: Tomas Grails

Empora.com Content Management System Adobe AIRWednesday, 16 June 2010

Page 9: Tomas Grails

Grails• An open source web framework inspired

by Rails and Django.

• http://www.grails.org

• Supported by VMWare / SpringSource

Wednesday, 16 June 2010

Page 10: Tomas Grails

• Sky.com

• Walmart

• Wired

• LinkedIn

• Businessweek.in

• Suzuki.ca

• Tacobell.ca

• Deutsche Bank

Grails

Wednesday, 16 June 2010

Page 11: Tomas Grails

4 cool things aboutGrails

Wednesday, 16 June 2010

Page 12: Tomas Grails

Cool Thing #1: Ready to GoSpring Framework

Hibernate ( GORM )Quartz ( jobs )

Sitemesh ( layouts )Spring MVC ( webflow )Prototype / Scriptaculous

AntIvy

HSQLDBTomcat

Wednesday, 16 June 2010

Page 13: Tomas Grails

Cool Thing #2 : Groovy• Java’s best friend

• Dynamic JVM language with full support for Java objects and libraries.

• Compiles to Java Bytecode.

• Closures, builders, dynamic typing, etc...

• More relaxed, script-like syntax

• Features of Smalltalk, Python, Ruby

Wednesday, 16 June 2010

Page 14: Tomas Grails

original author of this slide is Marcel Overdijk -

TextText

Java . But also Groovy .

Wednesday, 16 June 2010

Page 15: Tomas Grails

• Dynamic types using the def keyword

• Optional return types

• Everything is public by default

• Optional semicolons, parentheses

• Variable interpolation via GStrings

• Automatic setters and gettersoriginal author of this slide is Marcel Overdijk -

Wednesday, 16 June 2010

Page 16: Tomas Grails

Healthy ecosystem• gPars - parallel processing

• Groovy++ - static typing

• Spock - data / behaviour driven testing and specifications framework

• Gaelyk - lightweight web framework for the Google App Engine

• Tellurium - automatic UI based testing framework based on Selenium.

• Griffon - Swing / Desktop applications.

Wednesday, 16 June 2010

Page 17: Tomas Grails

Cool Thing #3 : 426 Plugins

Wednesday, 16 June 2010

Page 18: Tomas Grails

Cool Thing #4: Flex + Flash Integration

BlazeDSGraniteDS

Grails Flex ScaffoldOpenlaszlo

JW FLV Media LibrarysIFRRed5Video

Wednesday, 16 June 2010

Page 19: Tomas Grails

Building a Grails application

( woohoo! )

Wednesday, 16 June 2010

Page 20: Tomas Grails

Wednesday, 16 June 2010

Page 21: Tomas Grails

Wednesday, 16 June 2010

Page 22: Tomas Grails

Wednesday, 16 June 2010

Page 23: Tomas Grails

Grails Flex Scaffold

• Developed by Cubika in Argentina

• Flex 3, Cairngorm, Stark Security

@eapfel

Wednesday, 16 June 2010

Page 24: Tomas Grails

Wednesday, 16 June 2010

Page 25: Tomas Grails

BlazeDS plugin

• Developed by Sébastien Arbogast

• BlazeDS, Spring-Flex Integration

• Spring Security

@ sarbogast

Wednesday, 16 June 2010

Page 26: Tomas Grails

Wednesday, 16 June 2010

Page 27: Tomas Grails

Web Services• Sometimes we can’t use BlazeDS / AMF

• REST - built in content negotiation

• SOAP / WSDL - via plugins like XFire, CXF or Spring WS

Wednesday, 16 June 2010

Page 28: Tomas Grails

Wednesday, 16 June 2010

Page 29: Tomas Grails

Notes• The Java introspector in Flash Builder 4

does not work with Groovy classes, but you can use the DTO plugin to automatically generate Java DTOs and cast between Java / Groovy.

• There are a few plugins that aid with Hibernate LazyInitialization issues. Gorm Labs, for example, dehydrates Hibernate sessions before being sent across the wire.

• IDE Support is actually quite good. My IntelliJ trial expired yesterday. STS and Netbeans also do Grails.

Wednesday, 16 June 2010

Page 30: Tomas Grails

Other uses.• Tag libraries for embedding SWFs, providing

alternative content for SEO.

• Adding server side search via Lucene or Solr.

• Deployment platform for Amazon / App Engine.

• A nice proxy to bypass Flash Security restrictions.

• Backend glue to PHP / Clojure.

• Data import / massaging.

Wednesday, 16 June 2010

Page 31: Tomas Grails

Wednesday, 16 June 2010

Page 32: Tomas Grails

• Flash Builder extension for Grails

• UI Testing automation

• Integration with Model Driven Development / LiveCycle services.

• A clear way to deal with Hibernate sessions.

• A way to template frameworks like Parsley, Robotlegs or PureMVC

• Better integration with messaging options.

Flex / Grails Wish List

Wednesday, 16 June 2010

Page 33: Tomas Grails

Why do I like Grails?

• Allows me to build backends to my Flex applications quickly and effectively.

• Integrates well with existing Java libraries.

• Lets me try new things fairly risk free.

• Encourages modular development / re-use.

• Constantly getting better.

• Makes writing web applications fun.

Wednesday, 16 June 2010

Page 34: Tomas Grails

Learn More!

grails.org/booksWednesday, 16 June 2010

Page 35: Tomas Grails

Learn More!

• http://www.grails.org

• Come to the user group meetings.

• Third Monday every month. Here.

• Grails mailing list.

• twitter: @tomaslin

• email: [email protected]

Wednesday, 16 June 2010

Page 36: Tomas Grails

Questions?

Wednesday, 16 June 2010