Session Notes – Flex for Grails Developers

Presenter: Scott Davis

  • Flex plugin for Grails isn’t a simple plugin like the YUI plugin
    • technologies are too different from one another to fully integrate
  • What’s Flex?
    • free open source framework, but Flex Builder costs
    • lots of technologies floating around
      • some free of cost, some free and open source, some for pay
  • we are living in the era of the RIA
    • poorly defined
    • involves flex, air, silverlight, openlaszlo, ajax, java fx
      • java fx is applets redux–that’s how they’re deployed
        • some nice new stuff, but still 1995 technology with a new marketing plan
    • adobe has crushing lead in the ria space
    • lots of politics come into play–e.g. no flash player on iphone
      • apple converts all youtube content to quicktime to avoid having to use the flash player
  • have macromedia to thank for the ria term
    • idea was can’t use same technology already in browser for rich experience
    • solution is plugins into the browser
  • plugins aren’t new
    • applets introduced in 1995
    • lasting achievement of java applets is the warning asking whether or not you trust the applet
  • fast-forward to 2005
    • jesse james garret coins “AJAX” term
      • blog post discusses how web developers are envious of desktop developers
      • pointed to google suggest and google maps as examples
      • major thing is eliminating the page loads
      • amazing thing about google maps is they did it without a plugin
  • great divide (?)
    • can either have js + css + html, or can use a plugin
    • walls are starting to crumble however–hybrid development
    • apple desktop widgets
      • native part of OS but live in a different space
      • create in html, css, and js
      • use the webkit framework for rendering
      • gadgets in windows are similar
    • palm pre
      • webos
      • build apps with basic web languages
    • google chrome OS
      • OS based on chrome web browser
      • isn’t a scrim on top of OS like widgets and gadgets
    • notion of pulling up a web browser to run webapps will soon be seen as rather quaint
    • Adobe AIR is one attempt to eliminate the browser from the equation
    • idea of ubiquitous web also well represented by iTunes
      • webkit browser baked in
    • future of software development — of course it’s web enabled
      • the idea of web/not web will fade into the woodwork
  • twitter example of how ecosystem can develop around an API and core data
    • twitter doesn’t have to own the hardware and software

Nuts and Bolts of Flex

  • grails plugins assume you’re conversant with the acronyms and technologies involved with Flex
  • flash player is where flex apps run
  • flash player revs about every year, and the new players get adopted very quickly–huge adoption rate
    • 80%+ of users are on the most recent version
    • many, many more people run old versions of java as compared to flash
  • flash player on most mobile platforms but not on iphone
  • adobe recently released tools to allow for compilation of flex apps into native iphone apps
  • flash offers similar “write once run anywhere” experience
    • java: class files run in JVM, JVM native to OS
    • flash: swf files run in Flash Player, Flash Player native to OS
    • javascript model is a bit different–still breaking differences between the browsers
      • javascript libraries get around the browser incompatibilities
      • javascript engines in the browser aren’t pluggable/upgradable
  • ECMAScript — standard with 3 major dialects: javascript, actionscript, jscript
  • js engines
    • firefox: spidermonkey
    • chrome: v8 engine
    • IE: JScript 5.8
    • flash/flex: actionscript engine
  • adobe collaborating with mozilla
    • donated actionscript virtual machine (AVM2) to the mozilla foundation
    • tamarin will be used for javascript 2
    • same javascript engine as used in flash player
    • javascript is traditionally interpreted
    • V8 and Tamarin do a lot of just-in-time compiling
    • probably be years before this is a standard
  • swf is a partially open file format
    • specs are published, but adobe retains ownership
    • everyone can read/write swf files, but spec isn’t open for change
  • openlaszlo
    • because swf format is open, openlaszlo is written in lzx but generates a swf
  • flex is an sdk
    • big switch from the animation history of flash–flex is a ‘business toolkit’
    • flash player is free but not open source
    • adobe dabbling with open source–tamarin, open source sdk
    • flex builder isn’t even free as in beer
      • eclipse plugin
      • also plugin for intellij
  • here’s what we know so far
    • jvm (jre) == flash player
    • class (JAR) == swf
    • jdk == flex sdk

Deeper Dive Into Flex

  • two key technologies: mxml and actionscript
  • mxml–tag-based like html
    • declarative, nested hierarchy of widgets
    • mxml is the html/css analog in this environment
  • actionscript
    • ecmascript dialect
      • if you know JS do you know AS? yes and no
    • first official version of AS was in Flash Player 5
    • huge maturation with AS 2, even more with AS 3
      • AS has been sliding more and more towards Java in terms of strong typing, inheritance, packages, etc.

Flex Development

  • need flex sdk
  • similar manual install process as with groovy and grails
    • set up flex home directory as an environment variable, add flex bin to path
    • mxmlc compiles mxml/AS code into swf
  • can buy Flash Builder, but isn’t required for development
    • development experience isn’t nearly as good without Flash Builder
  • IntelliJ has Flex capabilities as well (only in pro version)
  • Google provides SWCs to incorporate google maps into flex appss

Grails Plugins

  • four plugins
  • GraniteDS Flex Plugin–seems to be most mature and well documented
    • includes GraniteDS for data services
    • originally required JPA, not GORM
    • GORM support now in the plugin (experimental)
    • install the plugin, annotate the services and controllers
    • can then generate AS3 domain classes as well as the flex app itself

Leave a Reply

Your email address will not be published. Required fields are marked *