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...