Myths and misconceptions about GWT

Logo GWTHere is, in no particular order, a list of myths and misconceptions that I’ve gathered from reading GWT-related discussions on various websites.

Myth: GWT is a JavaScript library/framework/widget set

GWT is no use for JavaScript programmers, so it doesn’t provide anything as JavaScript: no library, no framework, no widget set. It does provide a Java library, which includes a widget set and JRE emulation classes, but these are all in Java and meant to be used from Java code.

Myth: GWT is a framework

You see this one quite often, and even the wikipedia entry for GWT used to describe it as such. The T in GWT stands for Toolkit, and that’s exactly what it is: a set of tools (in the broad sense), any of which you may or may not use. The difference between a toolkit and a framework is a subtle one, and very hard to explain, but in a word you can say that a framework is about providing reusable behaviour, while a toolkit is about providing reusable functionalities. A framework calls your code, while your code calls a toolkit. GWT provides very little predefined behaviour, and the only time it calls your code is when invoking the entry point of your class, which is the bare minimum.

And of course, you can write frameworks on top of GWT.

Myth: GWT is only for Java programmers

It’s true that GWT lets you program AJAX apps in Java, but you can also see it this way: GWT lets you write AJAX apps with the best state-of-the-art IDEs, debug them, refactor them, test them, all this in a statically-typed object-oriented language (which happens to be Java).

I think this should appeal to more than only the community of Java developers. To tell the truth, I even think that GWT alone makes it worth learning Java.

Myth: GWT generates poorly performing JavaScript

You hear this one often too. Actually it’s quite the opposite: GWT will generate far more optimized code that the vast majority of JavaScript programmers can write. I’m not saying it’s not possible to write more efficient code by hand, it probably is, just like it’s possible to make an application more efficient by hand-writing assembly code, but the improvement you can expect is marginal. So bottom line is: it’s not worth it.

Myth: GWT requires a Java backend

This misconception probably comes from the fact that GWT includes a simple and efficient RPC mechanism for calling server-side methods implemented in Java, but it’s not by far the only option. GWT handles XML and JSON like a charm, and can communicate with any type of server-side implementation over HTTP.

Myth: GWT has a poor palette of UI components

This is not totally untrue, but the thing is: it’s not the point. To be fair, GWT’s builtin widgets can be described as minimalistic, but they are still sufficient to build a complete and rich user interface. However, remember that GWT is not a framework, so it doesn’t have to be complete. If you want a complete palette of rich widgets, you should turn to third-party libraries such as Ext GWT or similar.

Myth: GWT apps have long startup times

Nonsense. Code loading times are not longer than any AJAX app, probably less because the generated JavaScript is obfuscated which makes it quite compact. And if your application is slow to initialize, it’s certainly because you are doing too much during startup: think lazy initialization.

Myth: Your site has to be all-GWT or nothing

Again, nonsense. GWT was designed from the beginning with the goal that it can be integrated into any web page. To add GWT behaviour into any existing web page you just need to add very little HTML code and it’s done.

Myth: UI customization/skinning is limited

GWT relies on CSS for styling. While this has its drawbacks, like the possibility to introduce browser dependencies that GWT tries so hard to avoid otherwise, it means that it opens the whole CSS world to GWT apps. It means you can radically change the appearance of a GWT app without touching a single line of code (this is not theory, we’ve done it). It means you can let web designers to their job of styling the app using the language they know (CSS), while letting developers do their job of providing behaviour using the language they know (Java). Bottom line: GWT skinning is as limited as CSS.

One thought on “Myths and misconceptions about GWT

  1. Also since GWT compiles various versions of your application compliant to each browser / locale smaller custom javaScript files are loaded into the browser, then if one used pure javaScript library to design their webpage.

Leave a Reply

Your email address will not be published. Required fields are marked *