Trying Google Web Toolkit again – and liking it

Development, JavaScript January 11th, 2010 @ 11:01

A while back, I tried out Google Web Toolkit to see if it was any interesting. My main concerns after that early glance was the stability of the applications and the possibilities to mix GWT code with plain JavaScript code.

Giving it another stab

I decided to give it another go last week, when re-building the mixtape interface for my side project Spotiseek. A few things led me to creating an “Ajax” application with GWT:

  • quite a few requests are required to present the view – I needed the requests to be cached in the client to reduce the server load
  • I needed an application built on stable and easily maintainable code
  • I figured it would be a good chance to learn more about GWT
Spotiseek Mixtape based on Coldplay

Spotiseek Mixtape interface

Drawing some conclusions

After completing the first release of the new interface, I feel confident enough to draw a few conclusions:

Positive: It’s Java!

When looking to write stable and easily maintained code, I really can’t find any better candidate than Java. Since I’ve been working with Java for a number of years, I’m of course very comfortable with developing GWT apps.
The syntax is nice and clean and of course the magic of the fantastic IntellJ IDEA is indispensible.

Positive: It does what I want it do do

It might appear a ridiculuous header, but I have to say it’s very easy to create widgets that does exactly what you want. There’s little confusion on how to actually construct the application.

Negative: Problematic project setup in the IDE

Even though IntelliJ is a fantastic IDE, there’s appearantly some improvements that could be made to the setting up of GWT projects.

Just setting up a GWT project is not a huge matter, but trying to add a GWT project module to an existing web project was a lot of hassle. There was a lot of problems getting the built-in build/make process to put the files in the right place etc.

Negative: Surprisingly poor community support

I honestly thought that the usage of GWT would be more widely spread across the internet. But when I – from time to time – got stuck with an issue, there wasn’t really that much help from Googling.

There are of course a few good forums and such where many questions are answered, but unfortunately not the answers I was looking for. I had to dig deeper in the Google documents in  order to get enough info to draw my own conclusions.

EDIT: One nice resource I’ve found is Matt Raible’s blog.

Maybe it’s not inadequate for most issues, but I had expected more…

(Sort of) Negative : Building everything from scratch

Usually, you try to mix as much HTML and JavaScript as possible in order to write code more efficiently. Building it all up from scratch is often a quite expensive process and rarely gives you the most maintainable code.

But with GWT I didn’t really see any way of not building everything from scratch. Partly because it’s very easy to do so, but also because I didn’t find any good way of reusing existing HTML components.

I’m not sure it’s a true negative having to build everything from scratch, but it requires a somewhat different approach than you might be used to.

To sum it up…

Even though there was a few problems during the development, I’m glad I chose to develop the application in GWT. It’s resulted in a nice (enough) application, built on code that is stable and easy to maintain.

Also, I’ve learned a lot about GWT development and will have no problems going forward with the development.

(Apart from the conclusions I’ve drawn, there’s of course a bunch of positives that comes with developing GWT applications. )

Maybe not suitable for all products

As I’ve stated before, I still feel that you should always consider if GWT is the best approach for your particular application.
I guess a certain amount of complexity is required, as it’s probably more tedious to write GWT Java code than regular JavaScript. If you’re going to develop a small-sized application, you’re probably best of doing it the old fashion way.

SEO issues with JavaScript applications

Of course, there are some issues with building your applications in JavaScript. One of them being the drawback in Search Engine Optimization (SEO), as your content is hidden from the indexing robots.
I know Google have proposed a new standard for specifying JavaScript content, in order to make the robots understand how to activate the content. But we’ll see what happens there…