Prototype VS jQuery - Strengths and Weaknesses?

I don't want to open another "Yet Another Js VS Js" thread.

I guess, in the end Prototype and jQuery are both JS and have almost the same methods and functions and need almost the same lines of code for identical tasks.

For a real Rich Internet Application, what are the real strengths and what the weaknesses in Prototype vs. jQuery?


Solution 1:

I initially liked the idea of Prototype's extending elements with new or modified methods.

However, I've discovered a number of reasons this is a bad thing (TM)

Do some googling and you'll probably find some other reasons, but the primary reason is that Prototype cannot be guaranteed to "play nice" with other frameworks or libraries, as other libraries expect the behaviour of elements and methods to be "standard", and due to the things Prototype does, you may find a number of things that are broken by it.

The most recent example I discovered was Prototype screwing with JSON and stringify. I was using EasyXDM, and it simply did not work in some cases where the prototype.js library was loaded. As I was writing a framework to be used by others, and thus did not have control over the content of the page, I needed to create and do everything in an IFRAME in order to ensure things such as prototype.js did not play havoc with what I was trying to do.

...so jQuery wins hands-down for me, because I just don't think its right for a framework to automatically screw with the standard behaviour of the DOM and javascript. YOU should be in control of these things, Prototype takes some of this control away from you....

Solution 2:

I use jQuery over prototype as well, just look at the top of this page for why:

jquery tagged questions : 531,752
prototype tagged question : 2,465
Updated 9/22/2014, on 12/14/2011 jQuery - 135,641 / prototype - 2,327

jQuery is very terse, concise code. Prototype I find much more verbose, though often equivalent in many areas for functionality. However if you need help getting started, you want the larger community. More support, more of the same questions you'll have already out there answered and easy to google, and more plug-ins, code you're probably looking for to do something...already written.

For the same reasons, the larger the community, the more code, the more complex code, meaning that the simple stuff has been written and many complicated situations solved as well, chances are if you're writing a very rich application you're going to run into some pretty complicated questions or situations...there are more resources out there to help you handle this.

Again...for the same community size reason, more deficiencies in the framework have been found and the gaps filled, because a larger community was scrutinizing it. This means that when you come across a problem, chances are someone else did too, and some method or option was added to keep you moving, not jammed up because you hit something the framework couldn't do.