BT

Debate: Prototype vs. jQuery

by Dio Synodinos on Jan 23, 2009 |

With Ajax dominating the Web development scene on the client-side, the question “which JavaScript/Ajax framework is the best” has become a common one. Glenn Vanderburg’s article which compares Prototype to jQuery caused diverse responses from industry experts Douglas Crockford and Dion Almaer.

Glenn Vanderburg starts off by talking about his professional experience with JavaScript and explains how he had the opportunity to work with both frameworks:

Like most programmers who’ve done Rails development, I’ve become very familiar with the Prototype library for JavaScript. Even apart from being built into Rails, Prototype was a natural choice for me. I knew JavaScript pretty well before I started working with Prototype, and was very pleased by how the library filled in some of the weak spots in the language. Additionally, having already been a Ruby programmer for a few years, Prototype’s philosophy seemed very natural; it clearly draws inspiration from Ruby.

Along the way, though, I’ve been hearing an increasingly strong chorus in favor of jQuery. I had taken a cursory look at jQuery and was impressed, but didn’t see anything compelling enough to make me switch. But increasingly the voices favoring jQuery have included people I really respect, including (over the past few months) several of my colleagues here at Relevance.

I’ve now spent serious time working on two different projects with jQuery. I’ve worked alongside some experienced jQuery users, and really increased my knowledge and level of comfort with jQuery. The work has included a reasonable variety of JavaScript tasks, from simple to complex, so I’ve had a chance to enjoy jQuery’s sweet spot and also to see how it stretches.

He goes on giving a detailed list of pros and cons and leans towards Prototype:

I don’t think this makes a slam-dunk case for Prototype over jQuery. And certainly jQuery could improve; its design is not fundamentally limited. (For that matter, many of what I consider the missing pieces in jQuery are available as plugins.) It’s unfortunate that some of jQuery’s API flaws can’t be fixed without breaking compatibility, but in a future version even that may be an option.

At a minimum, though, Prototype can hold its own. For me and many others, it’s still the JavaScript library of choice.

His analysis caused Douglas Crockford, senior JavaScript Architect at Yahoo and father of JSON, to respond in favor of jQuery:

Ultimately, I didn't find Glenn's argument to be convincing, although some of the commenters were happy to hear that they could feel good about remaining ignorant about jQuery. jQuery, being the later library, had the benefit of learning from Prototype's trials, coming up with a wonderfully expressive programming model. But mistakes were made, and jQuery's sudden popularity makes it seemingly impossible to correct those mistakes. Apparently the jQuery community forgives them. Glenn does not. John Resig is also a smart guy, and I imagine that he is frustrated at being knocked for his mistakes while being unable to repair them. Perhaps now he knows how Brendan feels.

Dion Almaer from Mozilla disagrees and finds Prototype closer to his taste:

These days, without any real context (e.g. skills on the team, what the project does) I kinda think:

  • jQuery is fantastic for taking a website and making it dynamic. Easy. elegant. Beautiful. If I was a designer doing a rich site I would stop here.
  • Dojo is fantastic for building a large scale application that will do a lot, and end up with a ton of JavaScript. Everything you need will be found there. This isn’t to say that Dojo can’t be used on the small anymore. The new core is small and fast and good.

Prototype, for me, fits in between these worlds. It is small enough to feel small (not a huge library to learn) yet large enough that I don’t jump out into creating a lot of my own code.

Of course, as Dion points out this debate doesn’t take into account a number of other great frameworks, libraries and toolkits like Dojo, YUI, GWT, MooTools, Ext JS, SproutCore and more.

So, which do you think is the best Ajax framework around?

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

OO vs Functional? by Ronald Miura

It seems that Prototype is better if you want to write OO code. But jQuery's approach is just more functional and declarative, which isn't bad, just different. It's like saying that CSS sucks because it can't instantiate objects or do loop statements.

If you really want to code your whole application in javascript, you probably want to go with Prototype. Or Dojo. Or ExtJS. But I haven't yet found a better (simpler, easier, lighter) library than jQuery for just make my pages richer and more dynamic.

Extendable by Bolla Sándor

Hi,

I used JQuery in early stage of a large intranet application, but meanwhile I switched to ExtJs of it's very clean extendible modelling and widget creation modelling behavior. JQuery is rather a rich GUI tool dispite ExtJs it is more enterprise ready. Though I don't have any experience with prototype and looking through only the documentation I think it's closer to ExtJs than JQuery is.

I found JQuery convenient to get richer ui (fast) on the site but came accross incompatibility using different plugin versions. While ExtJs is ready to use components are different to handle but the consistent usability of them become familiar after a while and is faster in many things like building grids,pages or windows like layout.

r. Sandor

Adoption is also important by Gajapathi Kannan

It would be great if ComScore can come up with a way to find out how many websites run on JQuery, Prototype, DoJo, ExtJs, YUI, etc., so the community can get a clear idea on adoption and enterprises that are looking for devlopers can make better informed decision instead of personal preference. One thing to add for the sake of adoption rate, MS has confirmed during their PDC, that they would support jQuery in ASP.NET MVC framework...

Typo by Jarkko Laine

"Dion Almaer from Mozilla disagrees and finds jQuery closer to his taste"

You probably mean Prototype.

Re: Typo by Dio Synodinos

Fixed, I appreciate the feedback!

progress? by Zenyk Matchyshyn

What's also important is the progress, IMHO jQuery has much better progress in terms of new functionality and speed. For example new improvements in 1.3 version are amazing: www.rozrobka.com/2009/01/jquery-13/

This discussion and more at JSConf 2009 by Chris Williams

I think this discussion about the positives and negatives of each framework, what they try to accomplish, and where they are going is best suited for something a bit more personal. We set up JSConf www.jsconf2009.com for this very reason. Each of the frameworks you mentioned in your debate, and some others not mentioned, including Objective-J/Cappuccino, target specific things and do those things very well. Therefore its really a question of what is the task more than which framework/library is "better". I invite you to check out the conference as it is dedicated entirely to this discussion and others about the language of JavaScript. Cheers.

Re: Adoption is also important by Tal Shterzer

I've been using ASP.NET MVC Beta along with prototype & scrip.aculo.us and I should point out that they work perfectly well together.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

8 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT