Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

jQuery inspired by prototype?

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks similar to prototype. How would one compare the two?

Thanks
Sapna Grover
 
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
Everything is inspired by something. There are no unique ideas. Protoype an JQuery pretty much try and solve the same problem which is how you make JavaScript pleasant to use. And they both try and make it simpler to do mundane and often times complex things with less typing. Of course, they do much more than that we well.

The largest difference I see between Prototype and Ajax is Prototype feels more like an Object Oriented approach where JQuery feels more like an expression language. Consider this...

Prototype
-----------
new Ajax.Updater(...)

JQuery
-----------
$.load(...)

Both do the exact same thing, more or less. They take the response from an AJAX request and shove it on the page.
 
Sheriff
Posts: 67637
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
Aside from the fact that the both use $ as a core function name, and are both JavaScript libraries, they are about as different in approach as you can get.

Prototype took the invasive path of modifying the core objects in JavaScript to make them look more like Ruby. As Gregg pointed out, it uses, and expects its users to use, an object-oriented approach to JavaScript. In addition to modifying the core JavaScript objects, it also adds a lot of names and objects to the global namespace.

jQuery is non-invasive in that it does not modify any JavaScript object. Rather it uses a wrapper to wrap new functionality around elements rather than directly modifying them. It adds only two names to the global namespace: jQuery and $, and the latter can be undefined if you want to use jQuery on the same page as Prototype. jQuery can be used with object-oriented JavaScript or plain functional style JavaScript.

I think both are strong and well-written libraries, and choosing either depends upon which approach you prefer. Personally, I have adopted jQuery for use in all my personal projects as I like its lighter, non-invasive style (and there are tons and tons of jQuery plugins to do just about anything one might need). In my day job, we use both.
[ January 16, 2008: Message edited by: Bear Bibeault ]
 
Author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jQuery was inspired by a number of things, including Dean Edwards' Base and the original Behaviours library that was written on top of Prototype. John is also friendly

Prototype's primary mission is to make JS more like Ruby; jQuery's primary mission is to make it easier to do DOM Scripting. See other threads from this week for more details.

There's a lot of jQuery's approach that has been adopted by Prototype. Most notably their revamped event system looks a lot like jQuery's event system. Then again, pretty much everyone has come on board with things like full CSS3 selectors and simplified events.

For an interesting historical perspective, check out John's initial post where he talked about the ideas that would eventually become jQuery: http://ejohn.org/blog/selectors-in-javascript/
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic