InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Debate: Prototype vs. jQuery

Posted by Dionysios G. Synodinos on Jan 23, 2009

Sections
Architecture & Design,
Development,
Enterprise Architecture
Topics
.NET ,
Rich Internet Apps ,
Ruby ,
Java ,
Web 2.0 ,
Javascript
Tags
jQuery ,
AJAX ,
Prototype

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?

Dionysios G. Synodinos is a Web Engineer and a freelance consultant, focusing on Web technologies

OO vs Functional? by Ronald Miura Posted
Extendable by Bolla Sándor Posted
Adoption is also important by Gajapathi Kannan Posted
Re: Adoption is also important by Tal Shterzer Posted
Typo by Jarkko Laine Posted
Re: Typo by Dionysios Synodinos Posted
progress? by Zenyk Matchyshyn Posted
This discussion and more at JSConf 2009 by Chris Williams Posted
  1. Back to top

    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.

  2. Back to top

    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

  3. Back to top

    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...

  4. Back to top

    Typo

    by Jarkko Laine

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

    You probably mean Prototype.

  5. Back to top

    Re: Typo

    by Dionysios Synodinos

    Fixed, I appreciate the feedback!

  6. Back to top

    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/

  7. Back to top

    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.

  8. Back to top

    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.

Educational Content

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.

Beauty Is in the Eye of the Beholder

Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.

Architecting Visa for Massive Scale and Continuous Innovation

John Davies examines Visa’s architecture and shows how enterprises have architected complex integrations incorporating Hadoop, memcached, Ruby on Rails, and others to deliver innovative solutions.

Max Protect: Scalability and Caching at ESPN.com

Sean Comerford unveils ESPN.com’s architecture, what components are used and why, and the current changes the website goes through.

The Seven Deadly Sins of Enterprise Agile Adoption

Are there repeated patterns of failure on Enterprise Agile Enablement efforts? Sanjiv and Arlen discuss Seven Deadly Sins to avoid when adopting Agile in an enterprise.

Questions for an Enterprise Architect

Erik Dörnenburg answers: What is Enterprise and Evolutionary Architecture?, discussing 4 issues: Turning strategy into execution, Ensuring conformance, Where do the architects sit? Buying or building?

Wrap Your SQL Head Around Riak MapReduce

Sean Cribbs explains what Map-Reduce and Riak are, why and how to use Map-Reduce with Riak, and how to convert SQL queries into their Map-Reduce equivalents.