Dr. Axel Rauschmayer is a freelance software engineer, blogger and educator, located in Munich, Germany. Axel is a DZone MVB and is not an employee of DZone and has posted 246 posts at DZone. You can read more from them at their website. View Full User Profile

GWT—An Important Java Technology: Features, Future and Wishes

04.05.2010
| 17648 views |
  • submit to reddit

The Google Web Toolkit (GWT) has become one of the most important Java technologies, as it gives it a credible web platform strategy. I used to be doubtful of the extra compilation step and developed with DWR and Dojo, but have since become a convert.

Cool features:

  • A single code base for client and server.
  • Great development tools, via Eclipse: refactoring, code navigation, etc. This was one of the reasons the creators of GWT chose Java as the source language. Server-side JavaScript certainly would have been a possibility, and compiling JavaScript to JavaScript is not unheard of, either.
  • Very quick turn-around: after making changes, the server and client can be reloaded quickly to reflect the changes (only the first start of the client is a bit slow, subsequent reloads are fast).
  • Development tools easy to install: All you need is two Eclipse plugins and you are done.
  • IDE support: The Eclipse plugin helps with various coding tasks and errors (such as keeping Service and AsyncService consistent)
  • Web application easy to install: GWT produces a WAR file. Drop it into a servlet container such as Jetty or Tomcat. Done.
  • Fast and reliable GUI layout: Still limited compared to what Swing and SWT offer, but for the first time acceptable.
Extending the basic features: For someone who has already programmed Swing or SWT, it is very easy to get started with GWT. After a while, you will probably be looking for advanced features. Luckily, a lively community has grown around GWT to fulfill this kind of need.
  • gwt-dnd: Implements Drag and Drop in pure GWT.
  • Smart GWT: GWT does currently not have too many widgets. Smart GWT is a GWT wrapper around the SmartClient JavaScript client. While GWT is really good at this kind of wrapping, there is some baggage involved: load times of web applications increase, and there is a new API to learn.
  • GWT Mosaic: Also extends GWT, but as pure GWT and with less widgets/features.
  • Other wrappers for JavaScript libraries exist. But beware, some of them have very restrictive licenses.
What the future will bring:
  • Currently, the GWT incubator hosts experimental features. Long-term, its parts will be migrated to either separate projects or the GWT core.
  • A post reveals interesting things about GWT’s future. For example, it will get data-backed widgets.
What I am missing:
  • More widgets: The current widgets are limited (menus don’t ensure that they are visible, no support for shortcuts, no resizable dialogs, no context menus, etc.) and there are not enough of them. I expect this area to improve quickly, though, now that all the important foundations have been laid (event handlers, modular CSS, layout panels).
  • Switching back-ends: Many computers are only intermittently online. Programming an offline mode for a GWT application is difficult, because the server usually hosts important functionality. A hypothetical way of solving this is by installing a back-end locally. The client could switch between this back-end and the server. Managing installed back-ends should work similar to Java Web Start. A local back-end could also provide a GWT application with desktop features, because it has access to desktop resources such as the file system.
  • Better client-side modularity: I love Eclipse’s modularity, especially when working in a team. You can have a core plugin that is extended via other plugins residing in separate projects. It would be nice if one could extend a GWT application in a similar fashion. On the server side that is possible via OSGi. On the client side, that is currently not possible.
  • Sending binary data from server to browser: For example, one cannot create images on the server and send them to the client via RPC. Data URIs are a work-around, but a poor one.
  • Annotations for hiding code from the client: If an object is transferred back and forth between client and server, there are often some server-only methods. An annotation would allow one to hide those methods. There is an issue for this feature. You can star it, if you would like to see it fixed.
  • Instantiating classes via class literals: There is no Class.newInstance() in client-side GWT. One has to resort to sending a factory to the client.
  • Two two useful methods: Class#getSimpleName(), String.format() are simple to implement, so I don’t see the reason for not doing so in client-side GWT.

 

From http://2ality.blogspot.com/2010/04/gwt-important-java-technology-features.html

Published at DZone with permission of Axel Rauschmayer, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Hernán González replied on Mon, 2010/04/05 - 6:42am

The link to the article is wrong (htm -> html).

http://2ality.blogspot.com/2010/04/gwt-important-java-technology-features.html

Axel Rauschmayer replied on Mon, 2010/04/05 - 1:48pm in response to: Hernán González

Thanks. Fixed it.

Lucas Godoy replied on Mon, 2010/04/05 - 6:48pm

Hi, I'm taking my first steps with GWT and it has some things I don't like (at first sight):

  • It's seems very intrusive. We still haven't found a good way to mantain logic separated from the GWT stuff. You can see that yor app is writtenin GWT just by looking at the package names. But it could be that there is a way to do this properly and we still haven't found it.
  • Integration with Maven is only partial. If you want to deploy your app as a WAR and use the built-in jetty server that comes with GWT, you're fin. But if you want to do something different, like packaging as a jar and use your own embedded Jetty, you'll have to do some extra work with Maven that takes some time and it's not straightforward.

Axel Rauschmayer replied on Tue, 2010/04/06 - 5:40am in response to: Lucas Godoy

  • Maven: I don't currently use Maven, so I can't really comment. But controlling anything under the hood is indeed complicated. For example, I've only looked for it briefly, but haven't found a way to configure the Jetty that GWT uses (with the previously used Tomcat, it was more obvious).
  • Intrusiveness: I hear you. I maintain an Eclipse version and a GWT version of the same application and that is a bit ugly. Annotations for ignoring code would really help here. Once you go 100% GWT, though, having explicit packages for "client", "server", and "shared" makes it much easier to understand what's going on.

Olivier GERARDIN replied on Tue, 2010/04/06 - 6:32am

The jetty that GWT uses isn't really meant to be configured, it's only there so you can quickly test an app without deploying to an app server, but any serious development will require a "real" app server.

As of GWT 1.6 (if I'm not mistaken), you can override defaults for package naming, so the requirements for "client" and "server" packages are not hardcoded.But I do agress that sharing code is indeed difficult, and often limited to very simple POJOs used for moving data between client and server.

Nemanja Maksimovic replied on Tue, 2010/04/06 - 6:44am in response to: Lucas Godoy

We still haven't found a good way to mantain logic separated from the GWT stuff. You can see that yor app is writtenin GWT just by looking at the package names. But it could be that there is a way to do this properly and we still haven't found it.

 

 

If you are considering separating  business logic from presentation in GWT maybe this could be a good guideline:

http://code.google.com/webtoolkit/doc/latest/tutorial/mvp-architecture.html

Siegfried Bolz replied on Tue, 2010/04/06 - 7:20am

I am working for nearly one year on a very big GWT project for a bank, and the rapid development with GWT was the key to success for this project. The customer is very astonished when he see what we realize in a web application! Try this with JSF and some Ajax-Libs and you will need some years for this. We don't have to touch any JavaScript, just working with good old Java. It's a big fun! :-)

Michael Vogt replied on Tue, 2010/04/06 - 2:28pm

I always wonder when someone says something is wrong at the way GWT works. GWT is opensource. Everybody is welcome to send patches to Google. I work with GWT since version 1.5 and could not be happier with it. Both, the speed of development and the speed it runs in the browser are excellent. The whole setup is completely configurable with class overwrites, generators and linkers which you can provide. The QuakeII demo shows how far you can go with it.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.