To GWT or not to GWT

  6 February 2011
 

Since few days,I have been analyzing on how to write a rendering engine that uses the XML that comes from the server and renders a webpage-form or part of it. Well that should be simple …right? Define the XML, parse the XML and create DOM elements using one of the RIA libs like Ext, YUI, SmartClient ….

What if you are creating a lib for production ready applications with good or reasonable performance. The range of frameworks available kept confusing me for a while on what to use. I can write JavaScript code, but had to decide on the library to use. Finally it came down to two – Ext and SC(Smartclient-free-LGPL).. I like jQuery too, but it did not fit in very well in the core. I prefer SC over Ext due to its licensing and arguably its better performance while dealing with lots of data. (fyi… I am an Ext developer too)

When I started with SC, I needed a lot of patience to work with it. Getting started is difficult. The documentation isn’t so clear. I usually don’t read text but skim through it, so if there is some important point in the corner or in middle of lots of text, I would miss it. Additionally community interaction is more on smart-gwt (SC-GWT)… Mapping that gwt code to JavaScript code was sometimes painful. In the process, I always wanted to jump back to Ext. But later the patience paid off. In the end I came out more biased towards SC and still am. If you explore the not-free server features of SC, you’ll be further amazed.

So I decided on SC. But what about GWT, why not use it? I am not a java developer and in fact a better JavaScript dev. So the basic idea of writing java code to generate JavaScript eludes me. Plus java really means unnecessary lines of code to me. I am a .NET dev and then a fan of Ruby (and Rails) and then Python — so now you know what I mean. With those parameters, GWT wasn’t an attractive for me earlier.

That said, GWT isn’t just java to JavaScript. It goes well beyond that ..in minimizing multi-browser issues. Its easier to implement some of the best practices for Web 2.0. Its easier to unit-test too. Further, the road-map looks good too. But the UI is dull. I learnt that Google has hired good designers to make GWT look good and that further we may see better out-of-the-box UI. That’s future…so for now, I am looking into SC-GWT (smartgwt-LGPL)

Hey … wait … you might say… GWT has introduced UI binder which is almost similar to the thing you am trying to do…. so why re-invent the wheel? The answer for now is simple. GWT compiles the UI binder xmls and these are not available at runtime – i.e. the JavaScript does not deal with the xmls. One possible way to re-use it is to figure out a way to re-use the GWT compilation mechanism at runtime — it should be possible, but I haven’t tried it yet. And obviously GWT compilation is in itself a time-consuming process to be performed at runtime.

GWT obviously brings in few benefits but one big inconvenience for me…. writing lots of lines in java code and not using JavaScript and losing some of its flexibility. You can always mix stuff, but I think that should be avoided when possible.

You can achieve all the goodness of GWT in JavaScript (and beyond that) if you maintain good javascripting discipline….. how hard would it be?….really a lot harder when working in a team… If you have worked on writing enterpise web2.0 apps with large teams…everybody writing JavaScript at some point of time… where its hard to expect everybody to understand javascripting very well …. you’d know the scripting-disaster that comes with it….I think in that scenario, GWT helps minimizing the problem…obviously GWT cannot prevent somebody from writing bad code.

Another thing I like about GWT is its integrated development with Google App Engine. Although I am pretty new to both, I think it would result into better developer productivity. When I mention Google-app-engine, I must say that its easy to get lost into the different persistence techniques that come with it and you are likely to ask “Why? Google, Why?”. That’s when I miss the simplicity and certainty with MS technologies.. even if it means dealing with sub-standard at times.

(Update): After spending a lot of time on GWT, I am of the opinion that GWT is good for people who are better in Java and not JavaScript. It extends their ability. But myself being a fan of dynamic-interpreted languages - with little experience in Java - GWT is not a good fit there. I am better off writing JavaScript in combination with jQuery, jQueryUI, Backbone.js,HTML5,  Python for Google App Engine...

References:

To get started with GWT, you can check the article below… it covers up a lot of stuff and I hope I knew about it earlier…

http://www.vogella.de/articles/GWT/article.html

To get started with SmartGWT) and AppEngine, check this video:

Article: http://jumanor.blogspot.com/2010/12/primeros-pasos-con-smartgwt.html (The article is in Spanish …  use Chrome/Google translate for English)

In case you are interested more in architecting real world GWT apps… i.e. something beyond “Hello World” apps… check out these videos from Google IO:

Best Practices for Architecting GWT App

Architecting GWT apps




 

Subscribe to our mailing list


Contact    |    Privacy Policy    |    Refund Policy

© Copyright Anup Shinde. All rights reserved.