Menu Close


Since I remember every JS programmer I know uses jQuery. It was my frolic to try MooTools few years ago. I really loved it, and since first use it’s my library of choice. Since I use jQuery a lot, for the team-work sake, let me briefly explain why and when, in my opinion, MooTools is better.

If you are looking for technical differences I advise you to read this great article/page: I am just going to show difference in attitudes and it’s outcomes.

Consider reading a book which starts with a following sentence: “He picked up a gun and fired“.  If it’s mystery novel sentence is good, it leaves you witch shred of information about what happened. This makes you eager to read another sentence – you want to know who is the shooter. But when It’s exactly other way around when it comes to programming:


Who is this “he“? Well, it would be much clearer if code above was prefixed with such line:

var he = new Policeman("Jake");// or var he = new MadMassMurderer("Dexter")

It puts “he” into some context, context of his/it’s identity. you automatically expect policeman to not shut to innocent pedestrians, in opposition to mad mass murderer. It’s great to leverage natural human thinking while programming.

Of course in simplest, and most common case, when “he” is DOM element, or jQuery element it doesn’t matter witch library you use:

var he = $('#Jake');//works in both

In simple cases jQuery and MooTools are very similar, so it such cases MooTools = jQuery (this equation is true from developer’s point of view, jQuery is few Kb smaller).

But when you are writing big system(or long novel as in metaphor) you will meet a need to have objects that are complicated more than DOM elements (in metaphor: if your book is about ninja-unicorns You have to describe them a little bit – how they look like, how much legs do they have?). Worst thing to do in such case is to try use tools that are not applicable to do the job with, and as such I see jQuery (“Ninja unicorns entered the building” – if you don’t know how much legs they use to walk on you cannot know how this scene should look like, according to the author). you may even get where you wanted, reach your goal, to but you will realize that you have created a monster at first time when trying to reuse of maintain such code. Code itself won’t tell you anything about what something is, it will just tell you how it behaves – that is what jQuery does. Sure you can study(or maybe guess) structure of an object by it’s behavior, but it’s time consuming and most of the times boring and frustrating. It’s easier to follow the story, when you know who characters are. If it think I’m overestimating, please, try to read some of your co-developer’s jQuery code from old and hard project.

When developing complicated systems, ability to reuse code seems crucial, so please remember: code is written once by one developer, but in most cases read many times by others. Just let it be self-documentary and portable – use MooTools when needed. I ask for it as someone, who may need to read and understand your code in future. MooTools>=jQuery.


Leave a Reply

Your email address will not be published. Required fields are marked *