JavaScript
Article

jQuery is better than DOJO! (11 Reasons)

By Sam Deering

jquery-vs-dojo

This post is now outdated, It has been kept here for entertainment purposes only.

Overview

Both jQuery and DOJO are JavaScript Development Frameworks/Packages that provide functions to make the writing of JavaScript code easier, faster and more efficient. Both have strengths and weaknesses, advantages and disadvantages but here on jQuery4u we love jQuery and think it’s the best so this list is all about how jQuery kicks DOJO a$$! In my opinion, Dojo is a framework and JQuery a library so it can be hard to compare them in most areas… but we’ll give it a go!

jQuery Official Definition

“jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.” source: http://jquery.com/

DOJO Official Definition

“Dojo saves you time, delivers powerful performance, and scales with your development process. It’s the toolkit experienced developers turn to for building superior desktop and mobile web experiences.” source: http://dojotoolkit.org/

10 Reasons why is jQuery better than DOJO!

js-min-filesizes

Update 06/07/2011: I must just add that DOJO has improved a hell of a lot since I wrote this post and some of the info here is a bit outdated (although most of it is still relevant).

  1. jQuery library is slightly smaller than DOJO! – When you download and look at the filesize your get jquery-1.6.2.min.js is 89.4kb and dojo-1.6.1.min.js is 92kb (compressed).
  2. jQuery is less confusing than DOJO! – Dojo is becoming an operating system – without providing the necessary documentation… Dojo epic fails in online documentation.
  3. jQuery works better with Firebug than DOJO! –  jQuery great with Firebug debugging whereas some of the cryptic messages that are displayed from Dojo Toolkit are nearly impossible to figure out!
  4. jQuery is easier to learn than DOJO. Another Fact. If you just do a Google search on “jQuery Code Snippets” and “Dojo Code Snippets”… how many people want to share their code?
  5. jQuery has more plugins available than DOJO! – jQuery has hundreds of unofficial plug-ins in a directory at plugins.jquery.com while DOJO doesn’t really do plugins but there are a few here: http://dojotoolkit.org/reference-guide/dojox/editor/plugins.html.
  6. jQuery community is far larger than DOJO! – If you measure jQuery and DOJO on metrics like the number of people using it, the number of search queries run on Google, the number of books sold, etc, you’ll see jQuery is ahead by a wide margin.
  7. jQuery is better with AJAX than DOJO! – It works with AJAX faster than DOJO. Fact. jQuery.AJAX() is king and also provides shorthand versions in jQuery.getJSON() and jQuery.getScript()
  8. jQuery has sexier looking syntax than DOJO! – This ones a personal opinion of mine… a very subjective observation! (but check the code below and you will see why!)
  9. jQuery loads faster in IE6 and 7  than DOJO! – Proof is below!!!  (results by Slickspeed).
  10. jQuery is updated more regularly than DOJO! – Simply better performance due to more updates and bug fixes from a dedicated team. See The Performance Results Tables.
  11. Dojo doesn’t even have it’s domain name! – http://www.dojo.com is about figuring out how friends can help one another on the path to mastery.

speed-results-jquery-ie

Example of code in Plain JavaScript

Consider this JavaScript snippet, which uses simple string functions:

var value = "Hello" + name ", it's " + time + " o'clock";
value.replace(".", ":");

Example of code in DOJO

Even simple string functions are harder in DOJO:

dojo.require('dojo.string.substitute');
var newstring = dojo.string.substitute("Hello ${name}, it's ${time} o'clock", {
    name: "Horst",
    time: new Date()
});

Example of code in jQuery

Consider this jQuery snippet, which disables all SELECT tags on a page:

$('#formid').children('select').prop('disabled', true);

Example of code in DOJO

Here is how you might go about doing it in DOJO, yes I know it’s ugly!:

dojo.forEach(
  dojo.query("select", document),
  function(selectTag) {
      selectTag.disabled = true;
  }
);

Well, I hope this short post helps spread the word that jQuery is better than DOJO! Please don’t take my post the wrong way i’m obviously a jQuery Fanboy at heart! ;-)

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

  • Rusco

    Well, I think you can’t compare a Formula 1 car with a VW Golf.
    JQuery fits well for writing Webpages and small- and simple Webapps, you do not need a Formula 1 car to go shopping.

    If your Webapps get bigger and you have to scale your project over people and time you better stick to Dojo.
    See for example:
    http://www.slideshare.net/AddyOsmani/tools-for-jquery-application-architecture-extended-slides
    and
    http://www.slideshare.net/rmurphey/the-jquery-divide-5287573

  • http://www.drupal.org novell morris

    I agree with an earlier comment that you can’t really compare jquery to dojo, as you, yourself, mentioned; because they are intended to solve varying degrees of complexity… People mistakenly associate simple syntax with elegance, instead of looking at the big picture. The truth is that jquery, while popular and easy, seems to, nonetheless, promote spaghetti code when used in any serious type of application. Because of the shortsightedness that many who start using jquery have, the propensity is toward snippets of script tags littered throughout the application, making it very difficult, from a maintenance perspective, and frequently leading to both a fear of making changes, and extending apps, and a very understandable hesitance to maintain such an encoded app/webpage!

  • http://il.linkedin.com/in/yossico Yossi Cohen

    It is a shame seeing a framework with an excellent foundation (well engineered!) such as Dojo losing community attention, which leads to the symptoms mentioned here (bugs, lack of community support, dev. tools, etc.). Dojo perception around widgets, data management and data binding provide very elegant separation of design and logic programming. Can anyone come up with similar concepts (by example please) around widgets with JQuery?

  • JD

    To do serious client-side applications, you need a framework that is built with object-oriented programming as its top priority – not easy one-liners like your jQuery examples. jQuery is a good fit for a single-file plugin, or basic linear code. If OOP, design patterns or project management are important, go with Dojo or Ext JS.

    In the “olden” days of the web, back when $(‘#myDiv’).fadeIn() was all it took to impress visitors, jQuery made a lot more sense. As user expectations for feature-rich web apps rise, I predict a slow exodus away from jQuery to more verbose “computer sciency” frameworks. jQuery’s accessibility has done wonders for the web’s aesthetic qualities, as visual designers make their first foray into coding, but I’m worried the majority of designer-jcoders will eventually hit a wall as user expectations increase. By the way, I happily use jQuery daily, but claiming one is “better” is what sparked my comment. Further reading: http://blog.rebeccamurphey.com/2009/11/12/dojo-confessions-or-how-i-gave-up-my-jquery-security-blanket-and-lived-to-tell-the-tale

  • JOE

    Maybe if you compare jquery with dojo core without adding any dojo.requires (not to mention those in dijit and dojox) it might be superior. Just barebones dojo with jquery (there is no such thing as barebones jquery because jquery is already barebones!) But when it comes to design patterns, Dojo is superior. Checkout wiki comparison of frameworks or what you can do with it such as the ArcGIS Javascript framework, which is built on top of Dojo.

    Mu conclusion is that jquery is just popular but when it comes to scalability, maintenance and mastering, dojo is the right tool for me.

  • http://stevenjoseph.in steven joseph

    Here’s a dojo one liner for the sake of one liners


    dojo.query('select').attr('disabled',true);

    Does seem shorter than jquery. Hmm

    • someone

      you didnt select the #formid element. Hmm

    • dardub

      $(‘select’).attr(‘disabled’, ‘disabled’);

    • http://www.facebook.com/PRABAL9 Prabal Srivastava

      $(‘#formid select’).attr(‘disabled’, ‘disabled’);

  • f_mele

    “dojo.string.substitute” is a base for javascript templating systems. This is a PLUS for Dojo, not the opposite!
    Point 5 (more plugins) is a con for me due to tedious searching for the right one as a lot are bad coded (and they rarely work flawless).
    Point 11 doesn’t need consideration.
    jQuery is a basic library while Dojo is a complete framework.
    Last but not least: jQuery’s selector engine is Sizzle and Sizzle is made by Dojo!

  • Sami Siddiqui

    Well The Last Example of DOJO Seems Very Extensive +Plus for Dojo. And It Doesn’t Look Ugly yeap it makes you think a bit :D

  • JDMcK

    LoL, well, simply put as of late 2012 … jQuery is built into Vis Studio these days, works easy with sharepoint and is used in more android apps than ANY other lib … duh! jQuery IS the .Net of JavaScript

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.