InfoQ

News

Who needs GWT On Rails?

Posted by Sebastien Auvray on Jan 09, 2008 09:17 AM

Community
Ruby
Topics
Ruby on Rails
Tags
Rails,
AJAX,
GWT
Rails and GWT are both hiding Javascript manipulation from the Ajax development cycle. GWT chose to solve that by using a compiler which will convert Java into browser-compliant JavaScript and HTML. Jon Crosby made it possible to use GWT over Rails with GWT On Rails plugin.
GWT on Rails integrates GWT client side compiled JavaScript with Rails RESTful web services by providing client and resource generators, migration support, asynchronous RESTful client support, and Rake automation.
It's only a few steps: GWT Client generator, GWT model generator, and you'll have your GWT client ready.
GWT On Rails uses GWT-Rest to interface with JSON Request Rails plugin.

While Ajax integration into Rails is already neat, indirectly introducing Java into Rails is not a common pattern. Following this skepticism InfoQ got in touch with Jon to get his motivation for writing GWT on Rails plugin.

It's always nice to see new plugins extending a framework but doesn't GWT on Rails go against Rails philosophy by introducing unnecessarily Java weight in the development cycle?
Most of Java's weight comes from JEE, which is not part of GWT on Rails. Client side GWT uses the Java language to generate JavaScript; The heavy server side platform never makes it into the picture. In the past, using GWT may have been associated with Java on the server side too, but GWT on Rails breaks this connection. Of course, I'm not the first to do this. JanRain used GWT on the client and a Python/Rails mix on the server side to build Pibb.
I have found most architectural decisions are a set of trade-offs that can only be weighed in their specific context. For me, having fast, compiled JavaScript that gets even faster with each GWT release, in addition to avoiding most of the cross-browser debugging time sinks, was closer to the Rails "just works" philosophy than the alternatives I explored.

Do you know any serious architect who would use GWT On Rails? (Apart from a situation where he would have an existing GWT client ready and would like to switch to Rails).
In addition to a server side switch from Java to Rails, as you mentioned, there is also the case of the Rails developer wishing to build desktop-like interfaces with a good JavaScript toolkit. GWT on Rails builds on a high quality toolkit from Google and adds a Rails-friendly RESTful client, plus tools to keep client side JavaScript models in sync with ActiveRecord models on the server side.
For projects that are mostly forms-based with a little Ajax sprinkled in for effect, GWT on Rails may be overkill. For those wishing to push the boundaries of JavaScript-based web applications, I think GWT on Rails is worth consideration.

No comments

Reply

Exclusive Content

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.

Security (CAS and OpenID) with Ruby

In this talk from QCon SF 2007, Justin Gehtland explains two open solutions to distributed identity and their Rails integration components: OpenID (using ruby-openid) and CAS (using rubycas-client).