RIA toolkit for Java developers: Adobe Flex
What is Adobe Flex?
Adobe Flex is a RIA toolkit leveraging the Flash platform. The following parts make up Adobe Flex:
- SDK: The Software Development Kit contains the compiler, utilities, classlibrary, sourcecode and documentation. The SDK is similar to the Java JDK, and most parts are released as Open Source.
- Flash Player: This is the runtime environment. The player comes in two flavours: a ‘common’ player (the one everyone has on their computer) and a Debug player. The latter shows errors which are simply ignored by the regular player.
- Flex Builder: This is the Eclipse-based IDE. This part of Flex is not free, however, it is highly recomended to use. There are two editions: a Professional edition (costs $249,-) and a Professional edition (costs $699,-) which has additional profilers and charting components.
- BlazeDS: The backend webservice framework. This Java framework leverages several open and proprietary Flash protocols to support remoting between client and server. BlazeDS is Open Source, and is basically a subset of LiveCycleDS.
- LiveCycleDS: the full-fledged remoting solution for Adobe Flex. This one adds HTTP Push technology to update clients real-time without the need for polling (in contrast with BlazeDS).
What makes Adobe Flex suitable for Java developers?
Familiar IDE
Flex Builder is an Eclipse-based IDE, and provides a WYSIWYG interface builder, code editor with code completion, syntax hilighting and some refactoring capabilities. It is also equipped with a Debugger almost as good as JDT’s debugger (you can’t evaluate custom expressions, for example).
Familiar languages
What is so familiar about ActionScript3? It depends on your perspective, I admit. AS3 is a new language designed from EcmaScript4: it implements proposed features for a future JavaScript language, like static typing and an actual OO architecture (classes, packages, encapsulation). If you are used to JavaScript or ActionScript2, getting to know AS3 is easy — you just need to learn to apply the new type system. If you are used to Java, you just need to learn a slightly different syntax. AS3 is *much* more familiar than, say, groovy or Ruby to name a few popular languages.
In addition to ActionScript3 there is a language called MXML, which is an XML language designed to aid in UI development. MXML is eventually compiled to AS3, just like JSP code is compiled to Java. MXML is powerful for creating User Interfaces and also for binding logic and data to the controls in the User Interface. However, there is no comparable thing in the Java world (JSP/JSF don’t even come close) so ‘familiarity’ might be a bit of a stretch in this case.
Familiar build tools
There are a few options for applying an (automatic) build on a Flex project. The SDK provides a few Ant tasks to help compile the MXML and AS3 code to a SWF or SWC binary. For Maven we have a few options, but only the FlexMojos plugin is worth checking out. The ServeBox plugin is lacking some basic features and the Israfil plugin seems to be suitable only for Flex 2. If necessary, you can always add the Ant tasks to your Maven build
BlazeDS and LiveCycleDS are Java frameworks
Both BlazeDS and LaveCycleDS are Java frameworks built on top of the Servlet API. LiveCycleDS uses some extra technology to support HTTP-Push (or Reverse Ajax), which is not (yet) supported in BlazeDS.
Anyway, both products provide their extensibility to the Java developer in the same way. By means of XML configuration files (and an entry in the web.xml file) we can configure what protocols should be employed on which URL’s, and what Java classes should operate on those configured channels. By utilizing a small Java class we are able to hook Spring into the Flex application.
Recommendation
Adobe Flex is a real treat if you are used to the mess associated with JSF/JSP, HTML/CSS/Javascript, SpringMVC/Struts etc. Just a new language to get used to (Syntax, API) and off you go. Adobe Flex gets you started cheaply (the SDk is free and the Flex Builder IDE will set you back just $249).
Highly recommended!
