Note that the comparison that follows was done taking into account some specificities of the customer. A different context might lead to different conclusions. (There is no one-size-fit-all in the landscape of RIA frameworks.)
I took into account the latest versions of the frameworks at the time of this writing, i.e. GWT 2.2.0, WindowBuilder Pro / GWT Designer 0.9.0/2.2.0, Flex 4, Flash Builder 4 Premium Edition, (?BlazeDS 4?).
CriteriaBased on the typology I had established previously (), I prepared the following list of criteria:
- Availability of programming skills
- Learning curve
- Documentation and Tutorials, Books
- GUI Builder
- Object Mapping
- I18n and L10n
- Industrialisation (automatic builds, tests...)
- Design patterns (MVC or MVP, IoC/DI...)
- Risk (durability of the vendor)
- Staffing and Support
- Data Binding
- Widgets/components library
- IDE support
- Communication protocols and formats (REST, SOAP)
(Communication formats (JSON, XML...) are discussed in the "Object mapping" criterion.)
- Declarative UI design
- Style sheet
- Scalability (avoid server-side session)
- Browsers versions coverage
- User experience
- Mobile platforms support
- Client side drawing
- Drag and drop
- DOM (browser) integration
ComparisonsWe here compare GWT and Flex through each set of criteria: staffing, productivity, maintainability, user experience.
Each criteria receives a mark between -- and ++ (- and -- for bad performance, + and ++ for good performance).
Since there are a lot of add-ons available in the respective communities, we've indicated with the special mark "opt." the criteria where there is support which is not native.
A "!" mark indicates a compatibility issue between some criteria.
Staffing and SupportThe staffing and support criteria compare as follows:
|Availability of programming skills||++||+|
|Documentation and Tutorials, Books||++||++|
Skills. Being 100% Java based, GWT has an advantage over Flex, where the client side application is built using a dedicated language (ActionScript), unique to Flash. Even though Flex skills are relatively common, ActionScript developers are clearly outnumbered by Java developers. This is even more significant for a company that is already using Java as his prime technology, since it already has inside resources that do not need to learn a new language.
Documentation, Communities. Both solutions have very large communities communicating on-line, one can easily find numerous tutorials on the web, and there are plenty of books available. The online communities also provide plenty of add-ons for both framework. (This is particularly useful for GWT, for complementing lack of native capabilities.)
ProductivityThe productivity criteria compare as follows:
|Object Mapping (JSON, XML...)||-/opt.||++|
|I18n and L10n||+||+|
|Industrialisation (automatic builds, tests...)||++||++|
|Communication protocols and formats (REST, SOAP...)||-, opt.||++|
GUI Builder. Google recently acquired the company "Instantiations" and is now delivering one of their product, "GWT Designer", together with the GWT framework. This is a full fledged GUI builder. However, since the acquisition is quite recent, both technologies are not yet fully integrated. Noticeably, it's difficult (if possible!) to use the "GWT Designer" with a declarative UI approach (see "UIBinder" further).
Data binding. In GWT, the "Editor" framework makes possible to do data binding. It must be configured programmatically (Java code) and relies on the declarative UI mechanism (UIBinder) (see further for impact of using UIBinder). In Flex, the data binding mechanism is available both in the declarative UI (MSXML) and programmatically (ActionScript).
Data validation. In GWT validation must be programmed manually, or through a third-party add-on providing JSR 303 validation (though there is immature (partial, unstable) JSR 303 support in native GWT). Advantage of JSR 303 would be that you could reuse the same code on the server. Client side data validation is done in Flex using "Validators". They are available both in the the declarative UI (MSXML) and programmatically (ActionScript). A number of predefined validators are provided and custom validators can also be defined.
I18n and L10n. GWT manages localisation with resource files. There is also a specific mechanism helping generating these files from the declarative UI (UIBinder) files. Flex does support localised strings through ResourceManager.
Industrialisation. A GWT app can also be compiled from command line, or even through a 3rd party Maven plugin. Only the premium edition of Flash Builder provides Ant based build and unit tests (hence also command line) capability for Flex. Maven support is only possible through third party plugin.
Widgets library. Standard GWT widgets are quite basic, though lots of third party add-ons provide very rich libraries. Standard Flex widgets library is already very complete.
Communication. REST communication is possible from GWT by constructing HTTP requests. The framework provide no facility to automatically bind a data object to a REST service. SOAP is not possible without third-party add-on. Hopefully, GWT also provides a proprietary protocol (GTW RPC) that provides automatic binding. Flex provides support for both SOAP and REST-like protocols, as well as a proprietary protocol (AMF). All can be used either from the declarative UI or from the code. There is also a mechanism for managing remote data objects.
MaintainabilityThe maintainability criteria compare as follows:
|Design patterns (MVC or MVP, IoC/DI...)||++, opt.||+(+), +|
|Risk (durability of the vendor)||++||+|
|Declarative UI design||+!||++|
|Scalability (avoid server-side session)||++||++|
|Browsers versions coverage||+||++|
Design patterns. GWT recommends using the MVP design pattern. The GIN Google add-on brings to GWT dependency injection based on JSR330. Flex uses the MVC design pattern and it uses a dependency injection mechanism in the declarative UI files. [?Event bus?]
Tests. GWT can be tested using JUnit. There is a test container making possible to run unit tests without starting the whole UI. There is also a "development" mode in the Eclipse plugin that makes possible to run the whole UI in the browser without compiling the code (which is very slow!). GWT can also benefit from all existing Java libraries (like Hamcrest, FEST, jMockit, Mockito...) for writing unit tests. Adobe provides FlexUnit 4, a framework similar to JUnit. It also provides a UI test container (UIImpersonator).
Vendors. Both vendors (Google and Adobe) are well established. Though Adobe, being a smaller player, is more subject to buyout. Another hand, Google is not a software house, and nothing guarantees it will keep the focus on GWT, though it is a strategic product for Google.
Declarative UI. GWT: UIBinder (compatibility with GWt Designer?). For Flex, the MSXML UI declarative language is at the base of the framework and is directly edited by the WYSIWYG editor in Flash Builder.
Styling. Both frameworks support CSS. The version of CSS supported by GWT will depend on the target browser and this can be tedious in case you target a multi-browser environment. Flex not only has support for CSS at various levels in the UI, but also for themes (packaged style sheets and assets).
Scalability. Both frameworks enable building a RIA where the whole UI context is maintained on the client side, hence enabling session-less server-side code.
Coverage. GWT supports all major browsers. It does this without performance impact because it generate separate sets of resource for each "kind" of client (a "kind" of client being a permutation of browser family and language). Note that there is always a risk of having to recompile an application when a new browser appears, in case it's not fully compatible with older browsers. Flex is completely independent from the browser, since it runs in a separate plugin.
Security. The level of protection of an application built with GWT cannot be better than what is provided by the web browser. In that respect, a GWT application is neither worse nor better than a traditional web application, being subject to all traditional web exploits (like cross-site scripting...) The Flash player has a SandBox mechanism to isolate an application and avoid malicious attacks to the client side code, however it has not proven to be very robust. (Most recently known exploit have been patched last month only!)
(Has an illustration, in 2010, for Windows, the site secuser.com reported 10 critical vulnerabilities for Internet Explorer and 7 for Flash (+ 1 medium). During the same period, only 3 critical vulnerabilities were reported for Java.)
User experienceThe user experience criteria compare as follows:
|Mobile platforms support||++||+|
|Client side drawing||exp./opt.||++|
|Drag and drop||opt.||++|
|DOM (browser) integration||++||++|
Drawing. Client side drawing is only an experimental feature in GWT (at least until 2.2) and it uses HTML5 Canvas (hence requires a compatible browser). There are also third-party libraries providing drawing capabilities for any browser. Drawing capability is native in Flex, and is very powerful, being the Flash inheritance.
Printing. GWT provides access to the browser "Print" command. Printing a specific item requires to render it first in a separate window or frame. Flex has a built-in API for controlling a printer. This API enables printing any "Sprite" (a displayable component).
Drag and drop. Drag and drop support is provided has a third party library in GWT. It is native in Flex.
Stability. Flash has sometimes be reported to present stability issues due to memory management. Moreover, since it requires a plug-in, Flex has a negative impact on memory per se. It is also to be noted that some Flash implementations (typically on Mac OS) had known dramatic CPU performance impact in some situations. This has only be fixed in recent versions of the Flash player.
Other considerationsBlazeDS... an open source server side framework from Adobe to ease integration of Flex with the application server, data, and other web services.
HTML5... likely the platform of the future. Will be natively supported by GWT. On another hand, Adobe has recently shown effort to support it also transparently from Flex projects.
Multimedia (video, web cam...)... are supported by Flex. GWT support is limited to web enablement (cf. also recent HTML5 progresses).
SummaryGWT: There are more skilled people, ad there is a better browser integration. Lot's of missing capabilities are possible only through third-party add-on, for which there is no guarantee of longevity.
Flex: It's more complete, has better productivity and better user experience. Capabilities for communication, object mapping, and data validation are very good. There might be a performance impact.
Both share the low security profile of any web based application.
Recommendation Given the specificities and needs of my customer, based on the above advantages, and on the opinion of both developers and customer architect, I recommended the selection of Flex.
- ^1 2 3 Rich Web Apps: RIA, AJAX... - An overview. Pendragon Blog. 11-Feb-2011
- ^ Flex vs GWT: Comparison Part 1. Memory Leak. 03-Mar-2010
-  GWT vs Flex vs ? Asked on StackOverflow on 08-Jan-2009
-  Comparing JVM Web Frameworks -TSSJS 2011. Matt Raible. Mar-2011
-  Flex vs. GWT Smackdown. Matt Raible. ~2009
- ^ Flex vs GWT vs Echo2. blog.pursuit.be. 23-Oct-2007
-  MarketScope for Ajax Technologies and Rich Internet Application Platforms. Gartner report. Revised 14-Jan-2010
-  Using Adbove Flex 4. Last updated 11-May-2010
-  Using Adobe Flash Builder 4. Last updated 29-Jun-2010
- ^ ActionScript 3: The Language of Flex. Frank Sommers, James Ward. 26-Apr-2007
-  The Flex Programming Model. Franks Sommers, James Ward. 03-May-2007
-  Using Flex in the Enterprise. Frank Sommers, Bill Venners. 28-Feb-2011