I've been reading through a bunch of the "highest voted" questions for GWT. Several of these questions talk about the pitfalls or problems with GWT.
In the articles: Which Javascript framework (jQuery vs Dojo vs … )? and Biggest GWT Pitfalls?, some posters seem to suggest that GWT is not lightweight enough or that there are better alternatives that may be used.
Do most of you feel that there are problems with GWT that have not been fixed with GWT 2.0 -- which would make you inclined to suggest using a simpler framework for a new project?
To some extent, shouldn't GWT be somewhat future-proof (since you don't have to worry about it changing drastically from release to release and since it is backed by Google)?
I realize that the answer to this question depends greatly upon what you want to do or what you wish to make. I am looking at this from the perspective of starting a new web application that will eventually be used by millions of users.
Let's start with all the trade-offs I can come up with:
<div>
s into separate objects, that will make the code all nice and neat". Of course, I'm over-exaggerating it, but you get the point - it's easy to imagine that an unexperienced programmer could put a full-blown Widget
with lots of Handlers
in every cell of a FlexTable
... And then (s)he'll waste a lot of time wondering why the application feels sluggish ;) tl;dr: it's easy for beginners in GWT to make their applications "bloaty" by writing code that seems in line with what the documentation/samples/common sense ;) suggest
That's all for the trade-offs I can think of - if anyone wants to add something, please add comments.
Now for the advantages. I'm gonna skip some like internationalization, cross-browser compatibility for free, easy integration with other Google's libraries, etc, because they are kinda obvious and easy to grasp. I'll try to focus on the less emphasized but still very important features:
So it can optimize such a something like this:
public class ShapeExample implements EntryPoint {
private static final double SIDE_LEN_SMALL = 2;
private final Shape shape = new SmallSquare();
public static abstract class Shape {
public abstract double getArea();
}
public static abstract class Square extends Shape {
public double getArea() { return getSideLength() * getSideLength(); }
public abstract double getSideLength();
}
public static class SmallSquare extends Square {
public double getSideLength() { return SIDE_LEN_SMALL; }
}
public void onModuleLoad() {
Shape shape = getShape();
Window.alert("Area is " + shape.getArea());
}
private Shape getShape() { return shape; }
}
..to this:
public class ShapeExample implements EntryPoint {
public void onModuleLoad() {
Window.alert("Area is 4.0");
}
}
And then obfuscate this and minimize. Additionally, this is done in such way, that makes the resulting files more compressible via gzip.
Depending on your experience and/or preferences, the following might be an advantage (it is to me, but at times it's a PITA ;)) or not:
SuggestBox
has a lot places where you can override the default behavior with your own - you can specify a different way to display the suggestions (SuggestBox.SuggestionDisplay
), fire a custom action when the user selects a suggestion (SuggestBox.SuggestionCallback
) or just provide a custom SuggestOracle
for feeding the SuggestBox
with Suggestion
s...Bottom line is - try GWT, chances are you'll love it and will never want to write in pure JavaScript ever again ;)
We are building small (~2K Java classes) to medium (~6K) enterprise systems on regular basis using GWT since version 1.3 was out. I understand that there is a different set of problems to solve in public site having thousand clicks per second, but I will try to tell about our biggest problems in GWT 1.x and how GWT 2.0 approaches that.
Browser Memory Leaks IE6 leaks with GWT are tremendous, IE7 leaks can be compensated with periodic page refreshes, IE8 promises some stability in this area, but not yet widely accepted in enterprise. And yes, even valid GWT code without native JS calls leaks memory in certain cases. Especially when UI is complex and you are doing a lot of Panel.clear() calls. There are no useful tools to identify the real cause of the leak at the moment. Unless you know how to hack into browser itself.
Rendering Performance you have to write your UI code very carefully, especially when building commonly used custom widgets. Deep JavaScript, CSS and DOM knowledge is still required. There is a lot of materials in internet on this topic. You need to know how and when to get down from GWT widget level to direct DOM manipulations.
Size of Downloadable Content it was impossible prior to 2.0 to split module onto different downloadable pieces without having "hard" navigation built in the application. But that will clear JavaScript context and require window reload.
UI Developers Mind Shift Experienced UI developers just don't know Java and OOP. Experienced Java developers don't know CSS,JS,HTML and don't like building UI. UI Binder goes into right direction.
We have done migration 1.3 -> 1.5 -> 1.7 and it was always just a recompile and a couple of CSS fixes. GWT 2.0 removes a lot of deprecated code and initial approaches (project structure, GWTShell) and may be tricky to migrate quickly. But all features looks promising and its good that Google have dropped legacy code at some point. I am not sure about the stability of 2.0 though, as we have not used it yet in real projects.
Hope this helps.
We have a GWT app with a bunch of Selenium acceptance tests. I thought (like you) that it would surely be safe to upgrade GWT from 1.7 to 2.0. And it was - mostly. The app still worked the same for "human" users, but the selenium tests all broke. There's a newer version of Selenium in preparation (at alpha release, with many UnsupportedOperations), but if we want to stay with GWT 2, it seems we have to give up some testability. So be careful about "future-proof" assumptions.
Our decision to use GWT was made months ago, after comparing YUI and ZK. I'm still glad we chose GWT. The level of support on the GWT website and the general quality of the documentation seems very high.
GWT does module splitting and provides performance profiling which help to counter arguments that it is not lightweight enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With