I write this blog to share the solutions and problems I have found with fellow software engineers. I also do it to remind myself of what I've already figured out ;)

Wednesday, February 13, 2008

Flex vs. GWT

I recently had the chance to create a prototype of a Rich Internet Application (RIA) similar to geni.com. Having done mostly pre-Web 2.0 development up until this point, I went to research what would be the best technology or tool for the job. I honed my sights on the Google Web Toolkit (GWT) and Adobe's Flex.

I first started with the GWT. I was very impressed by what Google had done, as I usually am. In short, the technology allows you to write AJAX sites in Java. Google provides a "compiler" that takes your Java and outputs it to the right AJAX (mostly JavaScript) technologies for different browsers. Google has provided a bare minimum of components such as a textbox, drop-down box, etc. They rely on third-parties to create more elaborate components to use in your sites.

The GWT falls right into Google's theme of simple, usable, terse GUI's (e.g. G-Mail). This works well for some applications. Plus, you are able to leverage past Java skills in writing your new sites. Letting Google take care of the browser compatibility problems with AJAX is a definite advantage. The Java aspect also aids in code maintenance, which is an area where I feel most AJAX frameworks still have a lot of maturing to do.

My prototype was a family tree application and called for vector graphics, so the GWT did not work well for this; because at the end of the day you are still constrained to the HTML tags provided to you. Adobe Flex however is not constrained by HTML and picks up where Java applets left off. Back in 1995/6, Java applets were suppose to be the next best thing, but for a variety of reasons (e.g. the Browser Wars), they never gained a foothold. Enter Flex and the Adobe Flash Player, which is installed on aprroximately 95% of all browsers (according to Adobe's statistics). The Flash Player becomes the Java Virtual Machine that applets used to have. You can now write applications that run entirely on the browser or are just a thicker client.

Adobe's first attempt at an IDE for Flex was an abject failure. Smartly, they took the popular Eclipse platform and provided plug-ins for it to be the new Flex IDE. Flex uses MXML to be their markup language and also provides some out-of-the-box components. The real power of Flex, however, is unleashed when you start to use ActionScript 3.0. This is what MXML is really made of, and it allows you to create all kinds of new components based on 2-D graphics. ActionScript 3.0 is based on the ECMAScript standard (JavaScript's standard), so it is relatively easy to learn and a very powerful scripting language with strong typing and object-oriented features. While, I did not get to use their back-end capabilities for my prototype, I was impressed how Flex could integrate with both Java EE and .Net sites.

As a footnote, Microsoft has tried to duplicate Adobe's Flex framework with Silverlight, but their main problem is browser penetration (which is very low right now). It is never easy to predict the future in Web technologies, but I believe the Abode Flex framework will begin to used more and more for desktop-like applications running over the Internet. It is the best option available right now and their 3.0 version will be released soon. And if you're from the "Show-Me" state, travel over to the Flex showcase to see their technology in action.