October 23, 2007

Flex vs GWT vs Echo2

Past 2 weeks I needed to investigate the best framework to port the front-end of a Java/Swing framework to a rich web UI environment.
The contenders:
  • Adobe Flex2
  • GWT (Google Web Toolkit)
  • NextApp Echo2
The idea was to have a rich UI similar to the existing Swing framework running inside the web browser, that seamlessly integrates with existing Struts webapps. Applets / WebStart was out of the question, because of fear for deployment and decompilation issues.

So with these constraints in mind I started looking for the best framework amongst our 3 contenders. The odd one in the list is obviously Flex, but although not based on DHTML and JS it offers a lot of richness, and the deployment and security risks where less of a concern to the client.

Echo2 soon failed one of the main constraints: to seamlessly integrate within other webapps, maybe there are good solutions but I didn't seem to come across those. Because the API was very similar to Swing it was very easy to port some of the basic functionality for my proof of concept, too bad. Another concern is that Echo2 maintains the view-state server side, which could become an issue when scaling up to many concurrent users.

Flex also failed in favor of GWT. The main concern was the difficulty to integrate it with a J2EE or JEE backend, you need to use WebServices or REST. There is a free version of LiveCycleDataServices which takes care of this but it's limited to single CPU systems. Licenses for the enterprise edition however are pricey. Another concern was the lack of quality opensource plugins for Eclipse, requiring a FlexBuilder license at 500€ per developer to have a comfortable productive development environment. And another inconvenience is that it's not Java, rather annoying to migrate all developers to this new language (ActionScript). Flex still has to prove itself as a technology ready for enterprise adoption, and you still need a browser plugin and it can be decompiled.

GWT on the other hand doesn't require all those changes of habit, you can keep developing and debugging in Java, with your preferred and well known tooling, JUnit testing, refactoring, you name it. Now a year after the first release there's already a large community adopting and extending the framework. Numerous enterprise applications have been built with it and it seems like a platform that improves productivity for rich internet application development. GWT shields all HTML, CSS, DHTML, JS and browser incompatibility issues from the developer. And as bonus you get free client side code compression and obfuscation. It's a pure WIN WIN situation.

A first implementation of the web port of the Swing based framework has begun with GWT 1.4.60 as platform and GWT-EXT (wrapper around EXT-JS) for some richer UI widgets. Everything gets built by Maven2, is developed in Eclipse and tested and debugged in the GWT Development Shell.

With the inception of GWT, Google gave JavaScript based applications a second life. IMHO if it wasn't for GWT, JavaScript would be dropped rather sooner than later in favor of Swing / JavaFX / Silverlight or Flex-like solutions for enterprise applications because of project maintainability issues.

Be sure to tune in later when I post my GWT / Maven2 project setup for Eclipse...


  1. I don't understand this, for webstart, why WebStart fear for deployment and decompilation issues.

    1) deployment is simple;
    2) you can use some tool to against decompilation

  2. That's very true, in fact it's not my statement but the statement of my client (one of the largest public services in Belgium), maybe this wasn't clear in my post.
    Personally on those 2 points I think webstart is mature enough and decompilation is not so much of an issue in most cases as you would secure your services and move your business logic to the server side.
    Although they use Webstart internally they fear to deploy it to the public because it can be decompiled and although there are good obfuscators it's still deobfuscatable to some extent. Another big problem with obfusctation is they have an inhouse developed library that uses a lot of reflection, which makes obfuscation practically impossible.
    About deployment issues the problem is once they deploy to the masses they have to setup some helpdesk to support non-computer savvy end users in installing Java. This is more painful and costly than supporting another webapp.

  3. Well I think this comparison between GWT and Flex is not fair. The Flex is free and the builder is pricy but Flex is the equivalent to GWT + all the third party widgets for the it and FlexBuilder is a nice way of building the UI. There is no proper equivalent to that in GWT so if you don't want to pay for FlexBuilder you will be still able to do all the things that you do with GWT in flex. Plus flash is plugin but it has a huge market penetration so personally I don't think it is a big deal. I used GWT on some huge enterprise projects and Flex on some small side project and I would say flex is better than GWT. The only advantage of GWT is being java based so I don't need to learn new language and I can benefit from all the tools that are available for java code (JUnit, Refactoring in IDEA, etc) so if adobe make the flex language agnostic (in client side) and have the a java syntax in Flex I can't see even single benefit in using GWT over Flex.


  4. There are commercial visual designer tools for GWT also, but that is not what I was looking for in FlexBuilder. It offers syntax highlighting, refactoring, code completion and debugging. That's what I need the most as a developer. Visual design should be handled by a designer with his preferred tools in HTML and CSS.

    What you call the "only" advantage of GWT is IMHO a huge advantage for a company that has invested millions in educating 500 Java developers. You can keep your old habbits and tools and gain RIA for free (or the minimal cost to learn the GWT toolkit).

    On the plugin side I agree it's not so much of a problem but it could. You can't install or upgrade flash plugin or java or silverlight for that matter without having admin rights on Windows (usually the case in corporate environments). So not depending on a plugin could be an advantage, as then you don't have to support it.

    Bottom line: each use-case is different, so use the best tool for the job! There's no silver bullet for RIA.

  5. A very useful article, thanks! I've been asked to look into Flex, Openlaszlo and GWT as well. Please allow me to add some small remarks to your article (AFAIK):
    - GWT javascript is not obfuscated, only extremely optimised(, which probably gives an obfuscation effect).
    - Flex requires a browser plugin, provided at not cost by Adobe, but unfortunately fails to install/work 50% of the time on Linux.
    - Google generally gets the thing done right
    So, GWT for me as well.
    One question remains...which company in Belgium has 500 Java developers?! ;-)

  6. Being familiar with desktop development ala Delphi and a rich array of widgets and complete drag and drop, I consider losing that a step backwards. GWT currently is a good start and a great way of achieving tight development for both desktop and the web. Trouble is Goog have not gone far enough and expect 3rd party developers to take the baton and keep running with it. This IMO is not happening, or at least not fast enough. I have not yet fully evaluated either GWT or Flex, but from what I have seen thus far, Flex is much more mature, and Goog are not making GWT happen fast enough - read that as committed to it. What they have done with GWT in the Java to JavaScript area is fantastic. They need to keep the momentum going and make it easy to use with a full toolkit and drag and drop functionality. What Instantiations have done is just a start.

  7. yeah Flex is clearly ahead compare to GWT. I am Java Developer and done 2 projects with GWT 1.4 & GWT 1.5 (one project converted to 1.5)

    After that took on Flex because it is mature and growing faster because of open source + great UI widgets out of the box.

    Adobe has release other tools as open source like BlaseDZ and Flex builder 3 is free for student. I clearly like Data binding and even creating simple yet good looking UI for developer like me without messing with CSS (where GWT sucks big time)

    Google has to put lot of efforts to make GWT as good as Flex. But Adobe is well ahead with Flex 4 coming in middle of 2009. So let see..yeah Flash plugin is not big deal since you have to download Javascript files in GWT as well.

  8. I can't wait for your follow up article regarding your GWT / Maven2 project setup, thank you very much for sharing.