Saturday, June 04, 2011

GWT for client side code

Google Web Toolkit(GWT) is a framework which allows you to write client code using Java and compiles it into JavaScript. It also allows you to write server code but you can choose a server side framework of your choice (like RoR, Spring MVC etc.). If you choose a Java-based framework for the server side, you will have the advantage of using only one language for the entire application (with the exception of CSS of course).

For thin client application, where only minimal code is executed by the browser, there is not much that you can exploit out of the GWT framework as most of the code will be on the server side. But if you are building a thick client, where some JavaScript execution is expected, GWT is a pretty neat choice.

Some features/tools which help manage the client code better than using plain JavaScript are:

1) Gin for Dependency Injection
2) EventBus to manage interaction between various components
3) GWTTestCase to test views (if they have any logic). We should have minimal logic in views but we all know that the views are getting more n more complicated these days ;)
4) Widgets which you can simply plug in
5) Built-in framework for MVP development

There are many more reasons for choosing GWT and depending on your requirement, GWT can be a good contender.