views:

3690

answers:

6

I need to decide between jQuery and GWT for my new project. I haven't programmed in JavaScript for a while and I was looking into GWT for the last few days and it looks pretty awesome generating all the different JS for different browsers and all...but it takes more time developing in Java than the same thing using jQuery at least for this project, the documentation is pour, example how should I know which elements should I use when designing the page not enough doc for this to (reference would be nice). I've been using jQuery for most of my projects and its pretty straight forward - awesome. The point is I should convince the client that jQuery is better suited for this project and I need more arguments to support this..I could really use some help, thanks in advance.

+7  A: 

"Horses for Courses"

Pick whichever one makes the most sense for the project. Some things to consider

  • Tight timescales and more familiar with one over the other
  • Speed and maintainability for other developers to use the chosen tool. Prevalence of one over the other may have implications here too
  • Have any code that could be used already in the project e.g. plugins, utility functions, etc.

Without knowing specifics about what the project is about, what your experience is and how open the client is to using different technologies/frameworks, there will be no decisive answer here.

Make that list of compelling arguments for one over the other, as I have started here and then discuss with others involved on the project to come to a conclusion.

Russ Cam
Thanks for your help :)
BobiYo
Hey BobiJo, have you thought about acception this answer or are you waiting for a better one ?
Azder
+3  A: 

my personal opinion would be for jQuery but thats because I never use Java and really like using the jQuery plugins.

AutomatedTester
A: 

Active user group and recent gaining popularity clearly indicates jQuery is the winner.

rajakvk
it depends on what you are doing - there is no one size fits all library out there. jQuery is great for progressive enhancement of an existing marked up page, while gwt is meant for building complex, large scale application UI in the browser. You'd probably find it hard to make the google Wave client UI using jquery.
Chii
Php is also a winner too but that doesn't mean we should use it
mnml
+17  A: 

I would suggest using GWT for teams with people who don't understand JavaScript but (perhaps) are more comfortable with Java. You're likely to save yourself days if not weeks in compatibility testing, and will avoid a lot of common JS pitfalls that people new to the language smash into. It has great packaging features for css sprites, embedded data and more.

However, if you know and understand JavaScript, I would use JavaScript, whatever your library of choice may be. Although I haven't had a chance to inspect GWT's generated code too closely, I saw some examples at Google I/O, and while it looked all candy and sparkles, you're likely create more elegant JS code doing it the ol' fashioned way.

Also, while Google may be good, no one is perfect, and debugging JS that you wrote is easier than debugging JS that was generated from Java that you wrote.

Justin Johnson
+1 - nice answer
Russ Cam
Thanks Justin, this really helps
BobiYo
I recently posted on the subject: http://phiz.posterous.com/gwt-its-not-you-its-me
AlexJReid
A good post indeed.
Justin Johnson
You do not debug Javascript code, you debug Java code.
Alberto Zaccagni
It's nice not to be bound to a frameworks javascript implementation. Had a problem with this in wicket, where some of the javascript didn't work with IE8 for instance. Had to override it and wait for the next release.
Espen Schulstad
+6  A: 

If your group is most familiar with Java and you're planning on doing significant amounts of client-side functionality then you should at least evaluate GWT. The type safety, Eclipse debugging and shared code between the server-side/client-side will feel comfortable to your Java development team.

However, if your team is used to JavaScript programming with jQuery or another JavaScript library then it may be easier to stick to a technology that is pure JavaScript. GWT has a way of taking over large sections of the page, which is unfamiliar to most JavaScript developers. By take over the page I mean that typical GWT code likes to create its own DOM Elements instead of adding functionality to existing Elements on the page. This is why many GWT apps have a "loading..." screen when the page first loads. This isn't necessary, but it's the most common style of GWT development.

The fact that generated code comes out of GWT is less relevant for most GWT developers. GWT allows you to compile Java into something equivalent a normal java *.class file but in a JavaScript syntax that the web browser understands how to interpret. GWT acts much more like a compiler than a template-driven code generator. There are times that you will need to inspect the generated code but for the most part your debugging will be in Java via your Java debugger.

Another thing to think about is that regardless of the client-side technology you choose, your development team will need to be familiar with HTML, JavaScript, CSS and browser programming in general. GWT lets you write client-side code in a familiar Java environment but it doesn't hide the fact that you're working from within a browser.

A: 

I agree with Russ Cam that it depends on what your team is familiar with. When I am doing work for my personal business apps, I much prefer GWT. I find javascript, even with jquery, to have annoying object oriented syntax. If you have an app with 10,000 lines of UI code, jquery strikes me as something that would lead to a mess of hard to maintain code with poor reuse.

Does anyone know of a large scale project done in jquery?

I think if you are trying to squeeze every last byte out of the resulting filesize, don't use any library and write the javascript from scratch (ie: google homepage fade effect).

Something to think about regarding javascript/jquery versus gwt. If you use common object oriented principles and design patterns, you will likely get better performing code with gwt. Why?

Let's take the example of polymorphism. If you write an app that uses heavy polymorphism in javascript, you will get the benefit of maintanability and code reuse this provides. However, your code will also get the performance hit of using polymorphism.

Now, if you used gwt, you will also get the benefit of maintanability and code reuse this provides, BUT the gwt compiler will optimize away the polymorphism into concrete class usage, hence increasing performance.

devadvocate