The past few weeks I’ve been playing around with the Google Web Toolkit and I’m pretty persuaded that it’s the best choice for implementing Rich Internet Applications. Google itself used it for the Google Waves front-end and for a complete re-write of the Google Adsense admin application. There are other companies out there using GWT in an enterprise environment ,e.g. Lombardi Blueprint.
How to communicate with the server?
GWT supports two ways to communicate with the server. The first is GWT-RPC which requires a Java server side because you need to implement a Servlet. Now this sounds more painful than it is. In fact it’s pretty straight forward. The really nice thing about it is, that you don’t have to think about serialization / deserialization of your objects. The Google Web Toolkit will take care of that.
The second approach is rather classical and that is to send and receive JSON or XML. Clearly this enables you to use whatever server side framework and that is great. The downside of this flexibility is that you have to take care of serialization by yourself. Luckily Ryan Dewsbury provided a code generator in his GWT Applications Book which automatically generates the serialization code for you. Check out the code on his webpage.
Ok cool, so that means I should take which framework?
There are so many web frameworks out there that it’s not hard to loose completely overview. For my personal preference I can narrow down the number of frameworks to consider to these two: Ruby on Rails and Grails, the Java web application framework based on the Groovy programming language.
Ruby on Rails is currently by far the most popular web application framework. What I really love about the framework is that you get all in one. A descend MVC architecture, Templates, easy REST, testability, database migrations, a very healthy and active community (which is really really important), Ruby, hundreds of plugins, you name it. The framework has gone through two major iterations and can be considered business ready. Companies like Thoughtworks generate a big part of their annual revenue with Ruby and Rails projects. There are great hosting companies (Engine Yard, BrightBox, Heroku to mention just a few), the deployment became much easier than in the early days and when it comes to performance you have a whole bunch of great choices to improve it (check out this series of screencasts).
Grails uses Groovy as language. Both Grails and Groovy look very similar to Rails and Ruby. Grails is still pretty young but I believe in the coming years we will see a lot more Grails applications. One reason for this is the very tight integration with Java. So are for example most valid Java programs also valid Groovy programs. This makes it really easy for Java developers to try it out. Also Grails builds up on proven Java technologies like Hibernate, SiteMesh and Spring. So though Grails might still have some quirks, the technologies underneath are out there for quite a while and used in thousands of applications. This also makes it easier to re-use existing code and infrastructure and sort of gradually move towards a more agile environment. It’s really made simple to use technologies like JMQ, JMX or libraries like Lucene.
Despite Grails is build upon things you know from JEE you don’t have to go through configuration hell. Grails puts Convention over Configuration and sets useful defaults just like Rails does.
Conclusion
Ruby on Rails is the original, it’s proven and you finally don’t have to worry any more about the Java technology stack. The only downside in terms of using GWT on the front-end is that you can’t use GWT-RPC.
Grails is great if you need to integrate with Java. Because of the big Java community we will see more talk about Grails in future. It’s also a good choice in combination with GWT. There’s a plugin for GWT and also AppEngine.
All in all I believe you don’t do anything from with either framework. It’s about personal preference. I’d like to see some performance comparison between GWT-RPC and the JSON/XML approach with generated serializer though. Your choice might be influenced by existing systems or libraries you have to use. This is true in both directions. With JRuby becoming a more and more mature Ruby implementation, Java integration is not anymore just a dream, although it’s not as tight as in Groovy / Grails.
Update:
Mastering Grails – Grails in the Enterprise
Proof of Concept : Learning Groovy, Grails, JRuby, and Rails