I came across GWT late 2009 and I did not initially understand what the purpose of it was. However since then I have used it in projects with both failure and success as a result. Since my technical domain usually is the web new technologies such as GWT is discussed on architectural project upstart forums. I have from time to time in such forums been asked to present some of the pros and cons that I have encountered using GWT. I though it might be of interest for someone else so here it goes..
Often (mistakenly) the main reason for choosing GWT is that it solves the awkward browser quirks, we as web developer have to cope with. Since these quirks are such boring and cumbersome tasks for web developers to solve, we soooo eagerly want to believe every attempt and product sales pitch that argues that it have solved it. However I have yet to se such a product that works flawlessly GWT is no exception! Choosing GWT will not solve this problem completely for you!! It will however give you standardized framework to plugin your own fixes for each quirk using what GWT calls “deffered bindings“.
GWT has a few rather nice features that is to seldom promoted.
Resources on the web is scarce one of the most scarce resources is the capacity of the network it self. As processor resources follow more’s law networks do not. As processors gets faster and therefore also cheaper we are getting more and more competent devices in our hands. All this computing power gets rather dull if not utilized in a network however since the network do not follow the same progress as processors we need to utilize the network as smart as possible. This has been done for quite some time in the web with the technique of using css sprites. So if this has been around for some time what is the deal with GWT and resource bundles? Well as nice as css sprites are they are not real easy to create. For them to work you first need to create a large sheet with all (or some) of your images then calculate and position them with css. This has to be repeated each time you add a new image to your site, it tends to get rather cumbersome. What GWT does is at compile time do this for you.
Name spaced css with strict scoping
Have you ever started out defining css class names at the start of a project just to go back renaming them since you realized that the names you gave them does interfere with some new features? If answered yes on that question I guess that you also remembered what a search & replace hell that was? If you answered no, might it be because you did not bear doing it, instead you keept the old names and gave the new features quirky names that did not really represent what the feature was all about?
Well GWT brings name spaced CSS to the table along with strict scoping. What is that? GWT mapps a .css file to a interface and mapps each css class name to a method. In doing so it also gets the benefits of the JAVA name spaces. If you use this feature in GWT you can in one part of your application give the “largeButton” css class the meaning of a red 100px wide button and in another part 500px wide without the classes interfering with each other. Above that GWT will at compile time tell you if a css class no longer is used or if you misspelled a css class name. This is a real time saver.
This is not really plain GWT however if you include reference to the GIN modules you get an almost (It do not support all features of Guice) feature complete dependency injection framework. I cant really cover the benefits with a DI container in this post so you either already know what DI framework does or you really need to read up upon it.
Solves browser caching
GWT has utilized many proven GOF and Fowler patterns such as MVP, Observer, Command etc. There are a few examples using these patterns which can help you to start of in the right direction.
Well no framework is flawless and they all have their trade offs.
Turn around time
GWT still depends on java.util.Date for time and date logic. This is not good since many of the methods on the Date class is deprecated. read more here..
So how can such old and boring things as “compile time checking” and “Static typing” be the main reasons for GWT?
Need more input before making a decision? Read this:
Since I first wrote this, a survey has been conducted which might answer even moore questions for you.