Posts tagged ‘Web’

RIAs using Flex 3 - first impressions

flex

flex

My first experience with Adobe Flash (back then Macromedia) was back in 2001-02 when I was attempting to open a web animation start up while still in school. Needless to say the startup went no where but I was introduced to a really cool technology. Of course back then flash was no more than web animation tool and using flash maker was more akin to a movie software with timelines, layers and a quite sophisticated vector graphics drawing toolkit. I have always admired both Macromedia and Adobe for the wonderful tools that they put out, fireworks, dreamweaver, director, photoshop - the list is full of stellar tools. I was expecting nothing less from flex an ecosystem for RIA development.

Flex is basically a client side framework for developing awesome web application UIs running in Flash, this does limit you to linux, windows and Mac clients only (someone running Solaris on their machines will not be able to run your apps). Flex takes this concept a step further and enables you to develop applications that can be deployed as thick clients using Adobe AIR. At it’s guts its a bunch of action script libraries for remote service consumption, a library of interactive components and a compiler that compiles XML markup to a swf file of well laid out components ready to be shown in the browser.

The tool of choice for flex application development is Flex Builder from Adobe. Not surprisingly Adobe does not give this away free - the flex SDK is free under MPL however. For all practical purposes any serious web applications and developers should pay for the flex builder license and use the tool, I think its well worth the money. Flex builder is built on top of the eclipse rich client platform and is also distributed as a plugin for eclipse (they cost the same). Flex builder is distributed only for windows and mac. After using tons of open source eclipse plugins. it’s great to use a polished, functional, well written tool. It’s great. The source editor is great for MXML and AS editing, auto completion works flawlessly for custom components and written class files. Debugger works rather well (although I would like to see the code evaluation feature, the eclipse “display” window for java debugging has simply spoilt me). The drill downs and context help is great. I can say without a doubt that if you plan to serious flex applicatoin development, flex builder will be well worth the money spent.

From a framework’s perspective flex is an event driven, component oriented framework  that provides layout, arrangement and remoting facilities. The entire flex app is composed of individual components, customized via their attributes. The application is coded in an XML markup (MXML) and coding it seems vaguely similar to JSF. What absolutely blew me away was how intuitive custom component development was and how nicely it integrates into the flex builder. For example, if you wanted to create a new component all you have to do create a new MXML file and point to the folder using “xmlns” in the main application mxml file. Thats it flex builder’s auto complete and even the drag and drop designer will be working with your components. Generating custom events is equally simple. It’s quite awesome to see a well thought out architecture like this, since it helps you code your application in a more systematic and orderly fashion.

flex builder

flex builder

Next was the sheer simplicity of implementing drag and drop in flex applications. List based components, like data grid, lists and trees can implement drag and drop by simply modifying a few attributes. Another thing  is the inbuilt concept of states and transitions between states with browser back button integrations, a phenomenal abstraction. Hand coding an ajax based application involves a lot of plumbing code to work like this. There are few other features that I liked. Firstly the E4X XML support for XML. Action script has built in support for XML parsing. Navigating/iterating arbitrary XML structures is super siimple with using XPath like syntax. Secondly the concepts of grids and anchor constraints is simply awesome. Layout on reisize and cross browser CSS simply works.

The integration with server side logic is also well supported. Consumption of both restful and conventional web services is built into flex. Java developers have an added option of using AMF (action script message format) - a binary representation of AS objects in conjunction of bazeDS or LCDS. Setting up and configuring blazeDS is super easy and it gives really easy server-client messaging (with server side push) and remoting facility. The only down side is that you have to write both the java and action script data transfer objects.The flex SDK also comes with an ant taskdef, integration with java build cycles becomes quite easy.

All in all a fanstanstic alternative for RIA’s, I am already aware of one high traffic website using flex - yahoo maps. Going forward I see this framework used in a variety of different web applications, specially involving data visualization and complex workflows. I am also trying to use it for a new application at work, lets see how it goes, so far I am very impressed.