GWT vs. Flex 2

I was inspired to write this comparison between the Google Web Toolkit (GWT) and Flex 2 by reading Comparing the Google Web Toolkit to Echo2. I felt that the comparison between GWT and Echo 2 was like the proverbial distinction between apples and oranges. I thought that a better comparison can be drawn between GWT and Flex 2 (perhaps this is more like comparing tangerines with oranges).

To begin with, both GWT and Flex 2 are Rich Internet Application (RIA) frameworks whose code is downloaded and executed on the client side, in the browser. Both frameworks share a lot of the same web two point OMG hype and both GWT and Flex 2 are backed by industry heavy weights, Google and Adobe respectively. Even though both the GWT and Flex 2 SDK are free as in beer, as of this writing they are not open source, or free as in freedom.

When I first heard of GWT at JavaOne 2006, I thought that the idea of compiling Java into JavaScript was novel. I think my exact expression was ‘WTF?’ This was my same exact sentiment when I first learned that Flash can be used not just for vector based animations and games but to generate the UI for business applications. ‘Whoa..’, as Neo would say.

As mentioned, GWT compiles Java code to JavaScript whereas Flex 2 compiles a combination of ActionScript and MXML code to a Flash swf file. GWT compiles down to multiple versions of JavaScript, each version targeting a different browser. GWT requires a JavaScript enabled browser such as Internet Explorer, Firefox, or Safari. What makes the Google Web Toolkit really appealing is that as a developer you don’t have to write any darn JavaScript and worry about browser idiosyncrasies and compatibility issues. Think of GWT as the JavaScript version of the ‘write once, run everywhere’ mantra. With GWT, you program, debug, and refactor in Java, in the comforts of your favorite IDE, but deploy plain ol’ HTML, CSS, and JavaScript.

Google eats their own dog food, but they still have to add some Flash seasoning. Google Analytics leverages Flash to generate graphs and Google Video utilizes Flash to deliver rich media movie clips. Flash is also the foundation for Flex 2. Because Flex 2 is built on the Flash player, Flex 2 does not suffer from browser incompatibility that is rampant with open standards such as HTML, CSS, and JavaScript. The only requirement for Flex 2 is a Flash 9 player. A Flex 2 application is composed using MXML, a XUL format, and ActionScript 3.0. The strengths of Flex 2 are the rich library of controls, the look and feel, and the rich media support. The experience earned by developing Rich Internet Applications with Flex 2 might soon translate well to fat client desktop applications since Adobe engineers are hard at work on the Apollo project which intends to bring a Flash based VM to the desktop.

As mentioned earlier both GWT and Flex 2 are client side technologies. Because of the stateless nature of HTTP these frameworks lack server side data binding with a server. GWT and Flex 2 communicate with the server with HTTP requests, which can be described simply as remote procedure calls (RCP). Simply put, there are no server requirements imposed by either GWT or Flex 2. With all this said, both GWT and Flex 2 have different situation where they each are better suited. HTML, CSS, JavaScript are still the best option when developing a web application intended for the general public. Flex 2 is would fit well when developing flashy business minded applications with a targeted audience.

Technorati Tags: , , , , , , , , ,


5 Responses to “GWT vs. Flex 2”

  • Raja Nagendra Kumar Says:

    Hi,

    What are the chances that google – gwt would cross compile the java code to flex2 and adobe to cross compile flex2 code javascript?

    Both seems to be technically/architecturally but not sure if this makes business sense.

    Regards,
    Nagendra
    C.T.O

  • Helio Luiz Says:

    Sorry but you’re wrong! Flex 2 has server side client side data binding using Flex Data Service (now Live Cycle). And Flex 2 also can use the AMF protocol (not only HTTP) which is not stateless.

  • GWT vs. Flex 2 « llbbl Says:

    […] 8, 2008 Juixe TechKnow » GWT vs. Flex 2 I was inspired to write this comparison between the Google Web Toolkit (GWT) and Flex 2 by reading […]

  • ting choo chiaw Says:

    HTML 5 is tend to replace Flash. Therefore, i think GWT is more useful than Flex 2. I am sure GWT will support HTML 5 soon while Flex 2 may vanish anytime when HTML5 matures..

  • ting choo chiaw Says:

    I believe GWT will be able to support multi-platform application from web, desktop, iphone etc.. with same coding., in future.

Leave a Reply