• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JQuery vs Ajax Frameworks

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

How do i compare JQuery against other ajax frameworks, like ZK, Prototype...
Could you give a comparation?


Sergio
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this topic for an overview of jQuery.

jQuery is not a framework per se, but more of a JavaScript library such as Prototype, but with a bit of a different approach (see linked thread).

And while jQuery has really great support for Ajax, it's not just an Ajax library. It has full support for all types of DOM manipulation, event handling, effects and animations, and all other manner of useful things that you usually need to do in JavaScript.
 
Author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jQuery sets itself apart by focusing heavily on DOM manipulation and traversal. Because it's central core is based around getting elements and doing things with them (show, hide, fadeIn, fadeOut, load contents from Ajax, etc.), virtually all plugins integrate into the library as though they were part of the core.

For instance, in jQuery you can do:
$("div.hidden-contents").addClass("shown").fadeIn("slow").load("some_url_for_ajax").

If you loaded in a (hypothetical) tree plugin, you could do:

$("div.tree").addClass("shown").load("url_with_tree_contents").tree().fadeIn("slow")

Pretty cool, huh?

In contrast, Prototype's raison d'�tre is to make JavaScript more like Ruby. MochiKit's is to make JavaScript more like Python, and so on.

jQuery takes the approach that JavaScript is a neat language that is used primarily for DOM scripting, but with a pitiful amount of built-in DOM functionality. It aims to fix that.

Hope that was helpful
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Yehuda Katz:

jQuery takes the approach that JavaScript is a neat language that is used primarily for DOM scripting, but with a pitiful amount of built-in DOM functionality. It aims to fix that.

Hope that was helpful



Yes very much it was helpful Yehuda Katz [for a beginner like me]

Thank you !
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With all the DOM manipulations mentioned, how does jQuery's performance differ from the rest of the frameworks?

Thanks a bunch.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find jQuery code is hard to read and write, it is kind of obfuscated (at least to me)
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's odd. After all, it's only JavaScript. I find it quite the opposite since when using jQuery on a page, the code tends to follow a similar pattern rather than just a jumble of code styles.

Is it the use of $ that you are not used to? Unfamiliar with CSS syntax so that the selectors look odd to you?

When using jQuery, most JavaScript statements form a wrapped set using the $() function, and then jQuery methods (called "commands" in the book) are applied. So a typical statement might be:


Once you get used to this pattern, since it is used so ubiquitously, it becomes very easy to figure out what's happening.

Some of the more advanced selectors (the expression that is passed to the $() function) can be complex, but that's CSS syntax and can be as complex or as simple as you like.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

That is exactly what I found horrible to read & write.
To be honest, I'm allergic to JavaScript
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Todd:
To be honest, I'm allergic to JavaScript



Which lends no wait to JQuery being difficult to read. I too found it "different" when I first started using it. Why? Because I was using prototype which takes a more OO approach to JavaScript. But once I realized what was happening with JQuery and the power of CSS Selectors and Chaining I realized it wasn't difficult to read anymore. How long did this realization take? About half way through chapter 2 of JQuery in Action.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Todd:
To be honest, I'm allergic to JavaScript


Well then, it isn't jQuery syntax you're having an issue with. That's sort of like saying, I don't like the java.util.text package because I don't like Java.

Seriously, I think that when people first see jQuery code, it's the $ that throws them if they haven't see it used as an identifier before, and perhaps the syntax of the more advanced selectors (which people love to throw around as examples).

If you replace the $ with jQuery ($ is just an alias for the jQuery() function for brevity) and use a simple selector, it's clear that all jQuery code is doing is run-of-the-mill JavaScript function calls.

Perhaps many people also aren't use to chaining JavaScript function calls -- a very common and useful thing to do -- and perhaps that could throw them a bit at first.

But the heart of jQuery is the pattern:

Everything else just builds upon that.
 
Right! We're on it! Let's get to work tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic