Friday, May 1, 2009

GWT for RIA – boon for Java (dev)lovers

Recently, I have been working on porting Struts, uPortal based legacy application to GWT. This work was initiated a year back to replace unappealing, non-responsive and slow user interface. Other requirement was to make client side technology stack lighter. Presence of lots of client side technologies (Struts, uPortal, JSP, Tag libraries, Java Script, Configuration files, CSS, XSLT) made it cumbersome to implement simple UI changes.

After initial analysis, we were clear on requirement of more AJAX effect across application. It was further evident that AJAX framework should be preferred rather than writing AJAX "by hand". After evaluating some AJAX frameworks, we decided to go with GWT. Other frameworks like DOJO and YUI library are good in adding AJAX effect to existing application but they did not solve some problems related to fat architecture and big technology stack.

One of the primary reasons for going with GWT was its unique approach to develop complete application: client side, server side using Java. GUI development with GWT APIs is similar to Swing development and it is refreshing to forget JSP, JavaScript, and Struts and write everything using Java. I am very happy with experience so far and we have vastly improved presentation layer while retaining service layer.

With GWT, AJAX front-end is written in Java that gets compiled into highly optimized Java Script. Developers need not write Java Script while end users are provided with dynamic and standards-compliant AJAX experience. On deployment, JavaScript gets downloaded on the browser thus releasing the server side from handling presentation stuff.

I am overwhelmed by many developer friendly features of GWT. Usage of Java in presentation layer facilitates applying design patterns and creating reusable widget library. GWT approach for history management, internationalization, and service layer interaction is easy to understand and implement. I felt spoilt by choice of available tools, default support for all browsers and ability to debug AJAX in Hosted mode. I also noticed intangible benefits like elimination of training on multiple technologies, reduced dependence on technology experts, and reduced development cycle.

I have heard arguments that Flex is a better RIA choice than GWT. I think this may be because of lack of availability of all widgets in GWT. GWT does inherently provide lots of cool widgets but it is possible to use third party widget libraries if they are not sufficient. We used GWT-EXT, a very rich widget library.

I found some essential features i.e. lack of multiple module support, lazy loading of modules missing that may make GWT misfit for huge enterprise applications. I also faced some problems due lack of emulators for Java packages used in existing server side code.  Good thing is that there are workarounds available to solve these problems. I strongly recommend GWT if you are developing midsize application and need desktop-like look-n-feel.

No comments:

Post a Comment