Google Web Toolkit (GWT) is an AJAX based RIA framework that promises to enrich your Java/JEE Web Applications with a Rich user experience. It also promises to ease error-prone JavaScript & HTML development by abstracting it under the safety of a compile-time language like Java. GWT is a good framework overall and delivers on most of its promises -but- a few short-comings are to be noted.
Reviewer: Sony Mathew, GWT version 1.5
-
Great Tool support but...
- Being in Java all Java IDE tool support is available at your fingertips.
- Comes with a GWT Browser for immediate edit feedback but can be slow.
- Debugging of client-side and server-side seamless in Eclipse.
- Had to custom build: Eclipse plugin for compilation & workspace Ant tasks.
- May not need as better plugins come out.
-
UI Design in Java maybe cumbersome.
- No Graphical designer (GWT Designer exists, haven't tried, its for pay & don't expect much).
- Fix: Complex layouts can be easily abstracted into components and reused.
- Fix: Complex HTML layouts and semi-static HTML snippets can be easily abstracted to Static-Content and reassembled dynamically.
- Fix: Fluent interfaces like AxisPanel can be easily created to alleviate complex layouts
- Fix: Can purchase/obtain 3rd party rich components.
-
Compilation takes a while.
- Don’t need to compile very often during dev.
- Compile initially and when making changes to RPC transported beans.
- View UI edits via GWT provided browser for changes.
-
Browser inconsistencies abstracted well but...
- CSS inconsistencies still remain, All Widgets are CSS driven.
- HTML/JavaScript inconsistencies abstracted well but custom components will require some hand-coding of HTML & JavaScript.
-
Cannot style all areas of all Widgets.
- E.g. parts of TabPanel.
-
Java/JRE Emulation limitations
Requires that classes be scrubbed of following unsupported (non-compilable) references:- 3rd Party classes:
- e.g. org.apache.commons.*, org.hibernate.* etc.
- Fix: Eliminate references.
- Fix: Add source (.java) to classpath.
- Fix: Use your own custom equivalents (e.g. custom ToStringBuilder).
- BigDecimal:
- Client-side BigDecimal math not supported because it is not performant.
- Fix: Can use 3rd party 'gwt-math.jar'.
- Fix: Redesign beans to use Money, inject appropriate client/server side MoneyCalc.
- List.subList():
- Fix: Use an explicit for-loop to create a new list.
- Object.clone():
- Fix: Use a Copy Constructor and set fields individually.
- java.util.Calendar, java.text.DateFormat (and subclasses) :
- Fix: Use deprecated java.util.Date constructors and methods.
- Fix: Redesign beans to use java.util.Date, inject appropriate client/server side Formatters.
- java.text.NumberFormat and java.text.*:
- Fix: Use GWT provided classes - not optimal unless on client side.
- Fix: Redesign beans, inject appropriate client/server side Formatters.
- Misc RPC Serializing issues:
- Doesn't serialize final fields.
- HashMap: Make sure contents are serializable.
- Old Style Enums require no-arg constructor and non-final fields.
- GWT Unit tests:
- If present in same package can cause compile errors unless you scrub the tests: Including placing junit source on classpath.
- Note: having different source folders will NOT help if .class files are compiled to same output location.
- 3rd Party classes:
-
Scrub Hibernate loaded beans of non-compilable references.
- Only if loaded beans reference Hibernate classes such as HashSet, Session etc.
- Only an issue for lazy-loaded associations & collections
(verified).
- Hibernate beans with no lazy assocs were readily serialized.
- Fix: Hibernate.initialize() on all objects
- May not be sufficient - verify.
- Fix: Deep Copy beans:
- Manual Copy Constructors on beans.
- Use automated reflection based copy (including for collections).
-
Can use server-side classes on client-side but...
- Requires a “gwt.xml” file in referenced Java package (2 lines).
- May require scrubbing of non-compilable references.
- May require scrubbing of Hibernate loaded beans for RPC serialization