tags:

views:

299

answers:

6

At work there's a bit of discussion around what client side framework we should use for our front end web applications. Currently it's a showdown between GWT and jQuery and I'm kind of on the fence but leaning towards jQuery.

From what I can tell, GWT and jQuery are trying to solve different problems but are compared to each other because they both end up existing in the web applications space.

I suspect that if this is the case, then comparing the two may be fruitless so what I'm trying to get my head around is if comparing jQuery to GWT is even an apples to apples comparison in the same way that jQuery and ExtJS can be compared, or would it be more beneficial for our team to ask certain questions of our application and use the answers to determine which framework is a better fit for us?

+4  A: 

In a word, no. GWT is a Java framework which produces JavaScript. jQuery is a JavaScript framework. Although you can use them both to develop client-side code, it's a completely different mode of working, as evidenced by the fact that you use a different programming language. The number one question to ask is, "Will we be significantly more productive working in Java or JavaScript?"

Craig Stuntz
...you can be productive in JavaScript?
R. Bemrose
@OMG Unicorns, with jQuery: yes.
Iceman
+1  A: 

The approaches taken to build a web application may differ with both GWT and jQuery, but the end result is the same. So yes they are both comparable frameworks for your purposes of trying to pick one. Although one compiles Java down to Javascript, while the other uses plain Javascript, side-by-side feature comparisons are senseless and depend on the project at hand.

Instead of leaning towards one or the other, just build prototypes of your product using both, and document the pros/cons of each, and then pick the one that suits your needs best. One is not better than the other. Both solve problems in web application development, and sometimes these problems overlap, and sometimes they don't. I have done several projects using both frameworks, and can safely that one-sided answers will be pure speculation based on our experiences which may or may not apply to your case.

Anurag
+9  A: 

In addition to what Craig mentions, there is another, hardly-ever-discussed reason. Are you building a web-site or a web-app?

A website is the traditional way of doing things. User clicks on a link, browser goes to server and downloads new html. At times, you put in AJAX calls to populate lists or to save some data, but most of the times the transition from one page to another happens on the server side.

A web-app is different. Think gmail, google calendar, google docs. There is only 1 html page in the system. Once it downloads, transition from one view to another is done on the client side. Clicking on a link does not load fresh HTML, its just a javascript method call (which may or may not go to the server).

GWT is really suited for building complex web-apps. If you try to build a website with GWT, you are going to get frustrated with the technology. JQuery is more suited for web-sites, where you want to do certain jazzy stuff on a page, but at some point you want to go the server and download fresh content.

You will be more productive if you make a choice based on what your end goal is - website or webapp, rather than deciding on what your path is - java v/s javascript.

sri
I'd disagree. While jQuery can certainly provide the feature of merely jazzing up a traditional website, it is also suitable for creating a web app.
justkt
@justkt - Yes, you can use JQuery to build webapps. I am just trying to say GWT was specifically designed to build complex webapps, and has features that help you manage the complexity. You *could* use jQuery to build something like google wave, its just that the complexity is bit too much. You *could* use GWT to build a website, its just that the overheads are a bit too much. So, its a choice only an architect can make.
sri
I think this is the most fundamental difference between jquery and GWT, even more so than the language difference (which is already a big difference). jquery's strength is the progressive enhancement of web pages, while GWT's strength is the the development complex single-page web applications.
kwyjibo
A: 

If you have good skills with Java (and experience with Swing/SWT - for concepts), don't hesitate to use GWT. On the other hand, jQuery is more popular and it is quite easy. There is no "bad pick" with those 2 wonderful frameworks.

Xorty
A: 

The short answer to your question is yes, GWT and JQuery can interface with eachother, using GWT's JSNI features to call or be called by JQuery functions.

The longer answer is, why would you want to. GWT and JQuery both solve a similar problem, making JavaScript less of a pain to write and maintain, but they both do it in different ways, and using both together would require more work than using just one or the other.

There's also a considerable amount of overlap in features, so your users would end up downloading code to make XHR requests, handle events, manage history, etc., when in practice they don't need both.

Unless you're planning on slowly porting a GWT app to JQuery, or vice versa, there's no good reason to have your app written in both.

Jason Hall
A: 

Another option is GQuery, the GWT port of jQuery: http://code.google.com/p/gwtquery/

This way you can use the same library to write both complex single page apps and do JQuery-style progressive enhancement.

Coming from a javascript background, I found the learning curve for GWT was huge in comparison to learning another js library, because my Java was poor. That said, I've stuck with it and I have found GWT to be excellent for complex projects, mainly due to Java's strong typing and excellent IDE support which catches so many errors that would have required hours of debugging with js.

Will