Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery vs Google Closure va GWT Pros & cons for large web application development

I am about to start developing a large web application.Which contains media(video,audio & images) and a large user base.

The traffic on website may also goes very high.

So here i am a little bit confused the should i use jquery/jquery ui or Google closure or GWT.

i am familiar with jquery and i worked a lot into that but for GWT & Google Closure this is my first time.

I am also comfortable in java so i can use GWT but i already mentioned the it's my first time with GWT.

so please suggest me the pros & cons of all these three in terms of cross browser compatiblity,ease of understanding,maintenance of code,rich ui desing support etc.

-Thanks in advance

if this question a duplication of some other than just post the link.

like image 903
Peeyush Avatar asked Dec 10 '11 08:12

Peeyush


3 Answers

I think it really depends on what kind of web-site you want to create.
GWT is probably best suited for so called SOUI (Service Oriented UI) and SOFEA (Service Oriented Front End Architecture).
In GWT web-applications you have one HTML host page which is served by your backend and all the UI workflow and flow synchronisation is done on the client side by GWT. So in case you want to achieve a desktop like app GWT is probably your best choice because it is a great toolkit which allows developing complex desktop like applications and provides all the advantages of JAVA development (testing, refactoring, etc).

For "traditional" web 2.0ish web-sites GWT might not be the best choice because it does have somehow bigger learning curve than JS frameworks (jQuery,dojo, etc).
Furthermore these web-sites have multiple pages and Javascript is used for UI enhancements and not for completely taking over flow synchronisation but just making the page more interactive. For these web-sites you usually have a good backend (Grails, Spring MVC) which takes care of flow synchronisation and the JS framework is just responsible for making the UI more interactive and for some UI changes.

An example for this kind of web-sites is stackoverflow. If you click on a link it will load a new HTML page. If you click on your inbox link it will use jQuery to open a popup and retrieve your notifications and display them.

Google Closure is probably closer to jQuery than to GWT. I think the biggest selling point of Google Closure are the client- and server-side HTML templates. I don't have much experience with Google Closure but it is heavily used by Google for their web-apps.

Because I have worked mostly with GWT here is a list of advantages and dis-advantages I can think of regarding GWT:

Advantages:

  • Robust toolkit
  • Development tools (testing, refactoring, eclipse, live-debugging)
  • Cross browser compatibility out of the box (with some caveats)
  • Availability of third party libraries (DTO serialization, MVP frameworks, etc)
  • Only code which is used is downloaded to the client (with JS frameworks you download the whole framework even if you only use one specific function)
  • GWT-RPC and RequestFactory for communication with a JAVA backend (no need to serialize or de-serialize yourself).

Disadvantages:

  • Bigger learning curve
  • Might not be suited for small UI enhancements
  • Compilation can take some time if code base is big and different browser and languages must be supported
  • Generated Javascript can become big in complex applications (solution: code splitting)

As a side-note: with each new GWT version the disadvantages become less of an issue as each new GWT version improves in compilation time and code size. GWT 2.5 is supposed to have some really good enhancements in this area.

To summarize: if you want to develop a desktop like interactive web-application I think GWT is probably your best choice.
However if you want to develop a more traditional "web 2.0ish" web-site jQuery/Google Closure might be a better solution.

like image 76
Ümit Avatar answered Oct 19 '22 11:10

Ümit


GWT brings all the Java IDE goodness to what is essentially JavaScript development. Like JQuery, GWT "normalizes" the browsers for you, so you typically don't have to user-agent checks or anything. What the Java IDE goodness gets you is really reliable refactoring support for changing Names, Packaging, Method Signatures, all kinds of stuff. ITS BEEN 2 YEARS SINCE I'VE DONE GWT, but I think its downside, especially on large projects, is the compile step. It is not fast, especially when you let it loose to compile all the Java for each of the browsers. If I recall correctly, and if it still does this today, it produces on really big JavaScript file for each of IE, FireFox, Chrome, Opera, and Safari. That takes time, my friend. There is a unit testing framework in there as well which is interesting, albeit slower than its pure Java counterpart.

GWT Benefit: Robust Tool support via Java IDE ecosystem. GWT Liability: Compile time

I don't know nearly as much about JQuery other than it too seems to have cracked the browser compatibility cookie allowing you, fair developer, to concentrate on your application. What I do know about JQuery is that it seems to have developer mindshare. I, who am no JavaScript expert, managed to integrate JQuery into my Java webapp and add an image preview "plug-in" called imgPreview (http://james.padolsey.com/javascript/new-jquery-plugin-imgpreview/) giving pop-up image previews to my bland table-based UI in about 30 minutes one afternoon. The browsers have grown up too in the last 2 years such that you can now dynamically debug your JavaScript in realtime in the console (Chrome rocks for this, but it is essentially the same in FireFox and Safari), as well as tweak the styles and do all kind of straight DOM manipulation.

JQuery benefit: Straight up JavaScript with no interpretation and developer mindshare JQuery liability: It is challenging to refactor JavaScript at anywhere near the level of a Java application.

My 2 cents worth.

like image 25
Bob Kuhar Avatar answered Oct 19 '22 11:10

Bob Kuhar


The main advantage of Closure Library over just jQuery is that is designed to take advantage of the Closure Compiler (in advanced mode). You get the rapid edit/debug cycle of raw javascript, and a fair size library of code and your customer only have to wait for the code that you actually use (assuming you've compiled it).

For GWT, it pays to take advantage of "dev mode" to avoid compilation.

like image 42
John Avatar answered Oct 19 '22 12:10

John