Dojo vs JQuery, Part 2: Plugins, Widgets
Friday, June 5th, 2009Not long after I begin learning a new Javascript Framework, I find a need to create a plugin (or widget). I have created quite a few JQuery plugins (see previous posts) and have recently created a my 4th Dojo Widget (I have also created a few YUI widgets). I recently began working on a JQuery photogallery plugin (I know, why re-create the wheel). I actually created this photogallery quite a few years ago, but not as a JQuery Plugin, but as a Javascript object (class). I am now converting it into a JQuery plugin.
While working on a different project (that uses Dojo), I also had to create a photogallery. While I enjoyed the benefits of using both JQuery and Dojo to re-create the photogallery, I have to say that the ability to create a template (Dojo Widgets) can significanly decrease the time it takes to create a plugin or widget.
When I initially read about Dojo widget templates, I didn’t really understand the need. My perception was that if a developer was fairly proficient with creating and manipulating DOM elements, then what is the need for a template? Well, creating this plugin using both JQuery and Dojo gave me a more favorable perception of using templates – a tremendous advantage.
Although the requirements for the JQuery photogallery plugin was a bit more complex (and although I still find it easier in general to develop using JQuery), I have to say that having the ability to create a template gives Dojo a real advantage over JQuery when creating widgets or plugins. Advantage: Dojo.



October 15th, 2009 at 12:25 pm
It seems that you have had a lot of experience developing with different JavaScript frameworks.
What is your favourite?
I am currently using jQuery, however, I am curious to start playing around with Dojo.
I use python for a backend, and I have built a class that generates jQuery code for me (ajax, dialogs, etc..) so that my webserver has a better idea of what is going on on the client side. Since it knows about the javascript variables, and I can return javascript instead of json and have it evaled to manipulate the dom from serverside. This is great since my python backend knows about the jquery variables and html dom structure (web2py helpers)
My question is this, do you think that jQuery or Dojo is more suitable for that kind of application?
Thadeus´s last blog ..pygame font and py2exe =-.
October 16th, 2009 at 10:07 pm
I have found that it is more difficult to compare JQuery and Dojo (or YUI for that matter). Dojo and YUI, while bloated, have integrated interface elements into their frameworks from the beginning (creating web OSs). JQuery created jquery-ui only a few years ago. That being said, I have always found it easier (and quicker) to develop using JQuery. And their ui is more flexible.
As far as returning Javascript, wouldn’t it be more efficient to return data only. I may be a bit biased. I don’t even like to return html markup. data only.
October 17th, 2009 at 1:01 am
So if you wanted to create something that relies heavily on javascript ui, (like a webmail that looks like outlook), use Dojo. If you wanted something to just “enhance” your page to provide “usability” such as star ratings, or ajax suggest or simple one dialogs, use jQuery?
As far as returning javascript, I am learning javascript, and how it interacts with a webserver. To help me get started I wrote the python library that generates the jQuery code, so I could do something such as
return js.dialog(”Title”, “Content”);
that will render the element and include the necessary javascript to turn it into a dialog, all from python.
But perhaps for more advanced application (like my dojo example) there will be no way around learning javascript?
Thadeus´s last blog ..pygame font and py2exe =-.
November 6th, 2009 at 9:21 am
thadeus –
would you be willing to share your python library that generates jquery code? it sounds interesting!
cheers,
@rno
November 6th, 2009 at 11:55 am
Sure, it is located on my mercurial repository at http://hg.thadeusb.com/public/.r/Web/py2jquery/summary
I am currently going through a major overhaul and rewrite of the code. Take a look at the examples.txt for usage.
This is designed to be used with web2py, however it theoretically will work with other python frameworks as well.
Thadeus´s last blog ..pygame font and py2exe =-.
January 19th, 2010 at 10:44 pm
hello,
nice comparison of these two frameworks. Currently I’m using jQuery to make enhancements to websites, but i’ve just started learning ZEND Framework and it looks like it’s creators prefer Dojo.
Now i see when use which framework, jquery for simple ajax and visual enhancements, and Dojo for complex applications.
Thanks