tags:

It appears that many people, including decision makers, are not fully aware of important GWT abilities and limitations. Many features in recent releases of GWT and related projects can be real game changers for the developers and for the end users. Here I am going to address common misconceptions and provide solutions to common issues.

 

"GWT does not support browser history (back button, bookmarkable URLs)"

That was never true, though in earlier versions of GWT this was not so easy to manage. GWT provides access to the browser history using static methods in its History class, which is sort of fine for small applications. In GWT 2.1, Activities and Places were introduced, letting you programatically associate history tokens with your activities. A cleaner solution in my opinion is provided by the GWT-Platform project - an MVP framework which, among other things, lets you use annotations to associate URL tokens with your presenter, and also lets you easily create and parse URL tokens with parameters.

 

"A large GWT application would take a long time to download, so we would be better off using HTML pages"

A large GWT application does not mean long initial loading time. GWT 2.0 introduced code splitting, which lets you decde which code should go into the initial JavaScript segment that the user downloads (and other segments as well), letting you optimize the initial loading. The mechanism provided by GWT requires you to make an asynchronous call where you want to split the segments. A much nicer way is provided by GWT-Platform - it lets you use annotations to mark a presenter as a code segment, or bundle together several presenters in a bundle which will compose the segment. Regardless of the abstraction you use for code splitting, you must check that you get the results you intended using the compiler reports.

 

"Any Java developer can write GWT code with no knowledge of HTML/CSS/JavaScript"

Not true and most likely would get you much worse results than plain HTML/CSS/JavaScript. When you write a web application you have to understand web technologies. If you use code to set the look and feel instead of CSS, you would end up with a huge hard to maintain Java code instead of a few lines of CSS. If you use widgets for everything instead of HTML panels you would consume a lot of memory and could possible make the application slower and even crash. It's also possible that a JavaScript library with your desired functionality already exists, and wrapping it with GWT is better than implementing it from scratch. Learn web technologies!

 

"GWT is awsome! I will use it for every web project"

GWT IS awsome, but it's not ideal for every situation. If all you need is to display some static content, or just need some simple JavaScript functionality (client-side form validation for example), using GWT is an overkill, and you would probably not benefit from its advantages as much.

 

"GWT is not crawlable"

As Ajax applications become more popular, the need came for search engines to be able to crawl them, even if they are a single-page site. To make your application crawlable, its history tokens should start with "!", as described here.

 

As you see, many of the concerns that were true in the past have been addressed over time. Whenever you think something is missing in GWT you should google for it, most likely there is a solution in GWT or a third-party library.

8

Comments

Great post. I would like to add three other issues: 1. The build process for large projects is a real pain. 2. Waiting for Google to fix bugs is a drag. They aren't as responsive as other frameworks. 3. GWT isn't like jQuery-UI, Ext-JS or the like. Without working with a designer you get nowhere...   Finally, and on a more personal level, since JavaScript/CSS/HTML knowledge is mandatory - why bother?! As far as I'm concerned - learning GWT is a waste of time. Getting professional with JavaScript/CSS/HTML has a better ROI. Also, writing Java code isn't nearly as fun as JavaScripting...

The phylosophy of GWT from the begining was "performance above all", even if that means less fun for the developer. Bottom line is, if done properly, a big JavaScript application could be orders of times smaller and faster if it is written in GWT than if it would have been written in plain JavaScript, even if minified. Also, there are cases where you may benefit from using Java. Using a staticly typed language with a good IDE does have its advantages, and there are cases you would benefit from using the same Java code both in the server and in the client. It's up to whoever starts a project to decide if it the above points matter, and it's specific to the project and the targetted browsers.

It's all true in theory. Unfortunately reality isn't like that... Anyway - why miss the joy of JavaScript for the torture of Java? (Speaking of good IDEs...) Also (as already mentioned) - You have to know your way in JavaScript/CSS/HTML anyway...

I talked about real world cases. If you need to build a super rich and complex web application (like Google Wave client), using GWT can significantly improve performance, reduce JavaScript code size, and remove the need to write browser-specific code. GWT should definitly not be thought of as a default solution for web projects. Also it's a very common practice to write specifc rich components with GWT and embed them in an HTML/JavaScript web application.

I couldn't agree less, but I'm not going to waste any more time on this... You're abviously stuck in your GWT corner... Maybe this will open your eyes

 Adi   I think that the link you gave is problematic since the % of super complex applications in the overall applications in the world is very small.   Most of the traditional application developers are familiar with JavaScript and GWT is waste of time for them, but for organizations which has swing or java developers GWT is a great solution, and in case of super complex web applications with thousands of lines include junit tests; GWT is the best alternative.   Another thing there is a big difference between “know your way around” in JavaScript then being an expert.   In addition there are great examples of Java libraries ported to web using GWT.   Here are some examples: http://code.google.com/p/quake2-gwt-port/ http://code.google.com/p/gwtbox2d/ ·         http://gwtbox2d.appspot.com/   Also great example of Cross platform game library for N≥4 platforms http://code.google.com/p/playn/ with this library there is a great example that take XNA game written in C# then ported to Java and using GWT created web game based on Canvas.   I think GWT is great but it all depend for when using it! Avi    

i appreciate your opinion, but i think you're wrong. fortunately, few days after i first commented here ThoughtWorks published their technology-radar for july 2011 where parts of it deal with GWT, declaring it as an old and irrelevant technology. i'm not sure what you're supposed to do with this information, but i am sure i'm not gonna waste anymore time on this issue. it holds no interest for me.  

Relative to the subject you have no interest in it, you express a lot. Interesting what you say on the subject which is of your interest :-)   That reminds me of arguments C vs. Java. the guys who favored C syas that you can do crazy stuff with C while Java is simple and doesn't allow as much freedom, and they where right, yet java is a live.   Anyway I think that there are other factors besides the technology itself when deciding what language to develop. Such as level of knowledge in the organization, how easily you can maintain the code, and others...   I do not think I can convince you so I'm giving up.   Bye,