Join Octablog readers

 
 
25
Jan

Framework Wars: jQuery vs. mootools

by Eran Galperin on 3:16 am

While taking a break from Octabox work, I came across John Resig’s blog. For those unfamiliar with that name, John Resig is the creator and head developer for the jQuery javascript framework (check the links if you’re unfamiliar with any of those terms either). I have read his book “Pro Javascript Techniques” a while back, and it was nice read though I skimmed through much of it since I was already familiar with most of the material. I wish it had more “Pro” and less common sense materials - which are still good but aimed more at beginners or non-programmers. I’ve read the table of contents for his next books which sounds very promising.
I did ‘read’ his more serious work, namely the source files for the jQuery library, which are a testament to his and his developer group vast mastery of the javascript programming language.

As I was navigating the posts, I came across this small flame war between a mootools dev and John regarding some comments made at a mootools introduction presentation. This matter was consequentially resolved, with both sides and other parties releasing apologies (of sorts).

Before I’ll iterate my thoughts on the matter, I’ll go ahead and say that at Octabox we use jQuery exclusively as a tool for javascript development. This is not a knock on mootools, from the little I tried it and from feedbacks I heard it’s a very good javascript library (and their site is absolutely gorgeous by the way). Choosing a software library is a matter of personal and design preferences, and is influenced to a large degree from what you hope to get out of that particular library.

A short recap of the story: Omlo Maldonado, a mootools developer at the time, was giving a presentation on mootools as a javascript framework. During the presentation, he made several references to other javascript frameworks, jQuery included, in a non flattering manner to say the least. John Resig, being the creator of jQuery, took offense and responded on his blog, adding further fuel to this rivalry. A small comment flame war ensued and the matter was later resolved with all parties (and mootools lead developer) issuing apologies.

Being a software developer myself, I sympathized with John’s feelings in response to the allegations that were made. He and the jQuery team were accused of ’stealing’ code, and their entire approach and design were being looked down upon. While I can’t condone his inflammatory response, I can certainly understand it (I probably would’ve written something much worse if I was accused in this manner. I’m a pretty cynical and sarcastic person). The allegations were serious indeed and detrimental to the whole approach of open source development and coexistence of multiple design approaches.
And while all sides eventually apologized, I got the feeling that the air hasn’t been completely cleared between the two teams. It’s too bad, since it’s exactly the diversity of such frameworks and the inter learning between them that continues to drive javascript development forward.

I’ll end with some insights I hold on jQuery, having used it professionally for over 9 months:

  • jQuery lean packaging (15kb minified and gzipped) is a major plus. Previously we have been using Prototype at Octabox, and the switch to jQuery reduced our average page weight by over 50% (Here’s the original post I wrote back then. Seems like eons ago). The improvement to user experience with shorter page load times, the savings on bandwidth - those are all major benefits.
  • jQuery has one the best user communities I have seen. Their approach to user contributions via plug-ins is a great idea, and it has proven an invaluable resource for adding functionality not provided in the core (for those knocking on jQuery feature reduction for size benefits - have you seen their plugin library?). The plug-ins being separate from the core also allows developers to hand pick their features, and not having those force fed in the official release.
  • The use off CSS selectors as the driving scheme for selecting DOM elements is brilliant. Combining that with the chainable interface is the main reason I chose jQuery - It’s super convenient to use. All scripts I converted to using that interface have had size reductions of ~40% on average As a matter of fact, using the chainable interface has made me fall in love with fluent interfaces and has definitely influenced my design methodology.
  • Their documentation is very good overall. I have used many open source projects that didn’t have the documentation to match the level of their code.
  • Their UI component still needs work, and some libraries have more mature solutions (script.aculo.us, mootools and DOJO spring to mind). However they seem to be aware of that and have recently launched their UI specific project. By looking at their track record I don’t think this will remain an issue for much longer.

This guy and this organization share my sentiments. Also here and here

Can you tell I’m somewhat biased? ;-) I consider myself pretty hard to impress, but jQuery has earned my vote and I’m sticking by it (at least, until something better comes along :P )

Categories: JavaScript

11 Comments »

  1. Every time I start messing with another framework the animations are just never as smooth as mootools–but man that 15k footprint looks tempting.

    Comment by rpflo — 10 Jan @ 6:43 pm

  2. Same here I ended choosing MooTools to work with because the animations where so much smoother than any of the other frameworks

    Comment by Mark — 29 Jan @ 7:18 pm

  3. To me, animations aren’t the forefront of my reasoning for choosing a JavaScript library. To me a library should be stable, browser friendly, small, make your life a lot easier when writing code and fast. Animations come second as that is just a sprinkle in the frosting of what should be offered.

    Since the latest release of jQuery - 1.3.1 - things have dramatically changed. It is now noticeably faster than it’s previous release, animations run smoother, and amongst many things, event delegation is now built into the core - something that’s been lacking for a very, very long time.

    I have adopted jQuery since 1.02 and have never looked back. The UI library leaves a lot to be desired, though.

    Comment by Trey — 09 Feb @ 6:36 am

  4. […] Also jQuery has gained a lot of support lately (BTW it is also used in Oxite). Eran writes about it here. Maybe checking out performance benchmarks of jQuery, Dojo, Mootools and Prototype will help you to […]

    Pingback by Evaluating new technologies for next generation of web apps — 12 Feb @ 12:29 am

  5. jquery -> ford
    mootools -> bentley

    Comment by Tim — 12 Mar @ 2:40 pm

  6. Yeah I know animation shouldn’t be the only reason but it was the only reason I needed to pick a framework as frankly everything else I’m fairly comfortable coding for anyway

    Comment by Mark — 12 Mar @ 7:59 pm

  7. @Tim

    Ignorance is bliss.

    Comment by Trey — 13 Mar @ 1:39 am

  8. Just meaning I already wrote my own selector methods (not as grand as whats it the current frameworks, but does mostly what I’m doing in mootools now anyway) and ajax functions years ago, initially I started to use moo.fx with prototype.lite to tie some animations but used to drool over mootools’ smoothness so eventually bit the bullet and moved over

    Comment by Mark — 19 Mar @ 2:30 pm

  9. Chainable interface. Yes, it is great! Obviously it was inspired from the object oriented languages like Java where (I think) this kind of chain of actions was introduced.

    Comment by Webdev — 26 Apr @ 7:30 pm

  10. Speaking of size of the libs and speed of the selector engines, Mootools is 19k minified and gzipped (4k for jQuery, big woop), and Sly the selector engine released by Herald of the Mootools team wipes up Sizzle like a crying baby with crap in its diapers.

    Oh just for kicks - jQuery $() will it be a single node returned or a real array, who knows! The fun is in checking and then operating! :)P

    Comment by Daniel — 14 May @ 3:00 am

  11. I dislike animation and avoid using it, so that side of the argument is not really persuasive to me… I like jQuery because it elegantly and powerfully encapsulates the tasks of finding and manipulating elements and binding events. And most of all, I like it because it sticks to its own namespace and does not make alterations to built in objects! It lets JavaScript be JavaScript.

    Comment by Stephen — 05 Nov @ 7:59 pm

RSS feed for comments on this post TrackBack URL

Leave a comment