aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes DOJO in comparison to jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DOJO in comparison to jQuery" Watch "DOJO in comparison to jQuery" New topic
Author

DOJO in comparison to jQuery

Deepak Mittal
Greenhorn

Joined: Dec 18, 2007
Posts: 8
I have experimented with both DOJO and jQuery and I liked both the toolkits.

My impression so far is that DOJO is good in widgets and UI components, whereas jQuery shines in writing very concise and readable logic.

I just want to understand from you what do you think : should I be making use of Both DOJO and jQuery in my applications (use whichever makes sense per use case), or is it really like using only one of them (having both of them in the same app doesn't make a lot of sense)?
Peter Svensson
Author
Ranch Hand

Joined: Sep 29, 2008
Posts: 54
It is a good question. I think that both Dojo and jQuery have very clean logic. Dojo is different in at least two ways;

1) Dojo is very strict on namespacing, so all functions, classes, objects, et.c. have a very clear name that relates to their place in the namespace. For example, the draggable window widget is called dojox.layout.DragPane and the function to do a CSS query is called dojo.query(). The reason for this is twofold; Firstly Dojo guarantess that it doesn not clash with any other toolkit, has overlapping functions, et.c. and secondly the namespaceing is always equivalent to directory paths, which enables intelligent and dynamic resource loading, which also can be used by custom classes and widgets.

2) Dojo has a very powerful templated widget system (I think only ExtJS has something similar), which modularizes widgets into a common structure. By extending the dijit._Widget superclass you get a lot of 'plumbing' for free, including automatic generation of element ids and widget lifecycle support.

Cheers,
PS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

To be fair to jQuery: on point (1), jQuery also is non-intrusive into the page's namespace. It's incursion being limited to the name jQuery, and optionally, the $.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Svensson
Author
Ranch Hand

Joined: Sep 29, 2008
Posts: 54
Bear, I'm sorry. You're right of course. jQuery plays nice as well.
I think I wanted to say that Dojo have a logical namespaced structure for where to put things, and got into the old Prototype argument again without switching on my head

That also means that Dojo can be considered more verbose.

Cheers,
PS
 
 
subject: DOJO in comparison to jQuery