Esri support for Dojo over jQuery...

7732
20
12-15-2011 09:22 AM
EricDaniel
Occasional Contributor III
It seems clear that since the Esri JS API was released that Esri has showed a strong favoritism towards Dojo for some reason and I'm sure they have had their reason for this.  However, I think it's become clear in the last 1-2 years that jQuery is the premier JavaScript framework.  In fact, this looks to be Esri's focus in the JS mobile space with jQuery mobile.  It would certainly be nice if we could use the same framework for both desktop web and mobile without feeling like we lose a bunch of extra support and widgets that Esri provides when using the Dojo framework.  Secondly, we would not have to include both libraries. 

So my question:  Is Esri going to begin to show more support for jQuery where we can completely utilize only that framework?  Do others agree with this direction?
20 Replies
derekswingley1
Frequent Contributor
It seems clear that since the Esri JS API was released that Esri has showed a strong favoritism towards Dojo for some reason and I'm sure they have had their reason for this.

The API was initially designed to be built using dojo and we do not plan to change that. One of the biggest things that dojo has over jQuery is support for vector graphics via dojox.gfx.


...it's become clear in the last 1-2 years that jQuery is the premier JavaScript framework.

jQuery is the most popular JavaScript framework, no argument there. 

In fact, this looks to be Esri's focus in the JS mobile space with jQuery mobile.

jQuery mobile was usable before dojox.mobile so we used it (and continue to use it) for some samples. But they're just that- samples. We have additional samples showing how to use libraries other than those included in the JS API if that's what you want to/must do. But we encourage you to give dojo a fair shake. It is just as capable as jQuery. If you're after the jQuery style of selector syntax, check out dojox.jq.


Is Esri going to begin to show more support for jQuery where we can completely utilize only that framework?

No, not in the near future. The ArcGIS API for JavaScript will continue to be based on dojo for the foreseeable future. We will continue to provide a compact build that is smaller than the full API. We're looking into making a more modular build system publicly available that will let you build an even lighter version of the API for your app that is tailored to your specific needs.

This same thing also recently came up on the ideas site and I posted a reply earlier this week:  http://ideas.arcgis.com/ideaView?id=08730000000bsrjAAA
0 Kudos
EricDaniel
Occasional Contributor III
Thanks for reply and great insight Derek.  I just expressed this on the Ideas site but I wanted to do that as well here in case you won't see that.  My concern here is as we all know jQuery is very popular , and very likely to become increasingly popular and likely increasing the gap between expericiend jQuery developers vs. experience with dojo.  I see the same thing happening with JS API as HTML5/JS/CSS will begin to pull more people away from the browser plug-ins within the Esri ecosystem and beyond.  So regardless of technical reasons, I think you will see continue press to support jQuery in favor of lesser known dojo framework.  As a possibly gauge in how much more popular jQuery is, if you go to the popular Stackoverflow forum you will see dojo has been tagged in 2310 posts (595 followers) vs. 135,995 posts (20,100 followers) for jQuery, nearly 60 to 1. 

As for technical reasons, does the HTML 5 Canvas not reduce a little bit of the need for the dojox.gfx?  Also, I imagine there are many jQuery plugins that would help here like jQuery SVG which some might argue work much better than the dojo implementation.  And what if jQuery adds vector graphics support in it's core library and most believe it works much better than the dojo version?  Just seems like a matter of time if we all agree jQuery is much more popular that is going to greatly surpass dojo. 

I may be completely wrong, but I just see a huge surge likely coming to GIS with jQuery experience over the next year and with many open source options going that direction in the GIS arena I see this becoming a problem for Esri JS API long-term.

Also, although an older post now, if you read through the comments section you will see the large number of well known in the GIS space that would like to see more effort put into jQuery over dojo.  http://spatiallyadjusted.com/2010/09/20/arcgis-api-for-javascript-2-1-now-with-legends/
0 Kudos
derekswingley1
Frequent Contributor
Hi Eric,

As I said before, no argument that jQuery is more popular. Dojo was not chosen because of the size of its user base/community; it was chosen based on the features and tools it provides.

Regarding canvas, we still support IE7/8. In those browsers, there is no native support for canvas. It's all VML, which dojox.gfx nicely abstracts away for us. There's also the android browser...I'm not sure about its capabilities with Ice Cream Sandwich, but at 2.x and 3.x it's canvas only (no SVG).

jQuery has a huge plug-in community and it's impressive what's available. But I'm not ready to advocate leaning on that community to support a product that we build.

A while back, Rebecca Murphey (prominent web development blogger, nothing to do with GIS) wrote about some of the things jQuery is missing. There's some great info in those posts:
http://blog.rebeccamurphey.com/on-jquery-large-applications
http://blog.rebeccamurphey.com/on-rolling-your-own

At the end of the day, we're not telling you that you can't use jQuery. We are saying that for the immediate future, we've made our choice, and we're not moving to another library that does a subset of what dojo does. I linked to examples in my previous post in this thread that shows using jQuery alongside dojo. If you must use jQuery, that's what we're recommending.
0 Kudos
EricDaniel
Occasional Contributor III
Hi Derek,

Thanks again for the info and your candor on this, it is much appreciated.  I definitely understand the reasoning but I think many in the community don't or just don't agree.  I imagine you get this kind of negative feedback on using dojo alot.  As seen in that blog post comments I listed above alone, about everyone is negative towards dojo.  The open source community seems to embrace jQuery over dojo as well. 

I get that you are hesitant to lean on the jQuery plug-in community but many of these efforts are probably bigger than dojo community all together. So that is being traded for relying on the dojo framework.  The same argument against relying on jQuery plugins could be used against relying on a framework at all such as dojo or even jQuery.  As I said before, I just see this as problem today and is only going to get bigger as time goes on due the popularity of jQuery.
0 Kudos
JeffPace
MVP Alum
Hi Derek,

Thanks again for the info and your candor on this, it is much appreciated.  I definitely understand the reasoning but I think many in the community don't or just don't agree.  I imagine you get this kind of negative feedback on using dojo alot.  As seen in that blog post comments I listed above alone, about everyone is negative towards dojo.  The open source community seems to embrace jQuery over dojo as well. 

I get that you are hesitant to lean on the jQuery plug-in community but many of these efforts are probably bigger than dojo community all together. So that is being traded for relying on the dojo framework.  The same argument against relying on jQuery plugins could be used against relying on a framework at all such as dojo or even jQuery.  As I said before, I just see this as problem today and is only going to get bigger as time goes on due the popularity of jQuery.


If popularity were the determining factor we would be using Flex (sorry, tongue in check).  Even where I work jQuery is more popular.  And amongst developers  so is IIS vs Tomcat, .net vs javascript, etc..

Dojo is an appropriate tool for the task, and it is just a tool.  It works, and is worth learning.

To me the important message is they are not mutually exclusive.  We use dojo and jQuery side by side in our app. 

var tabs = jQuery(dojo.hitch(this,function() {
                            jQuery( "#infoPopupTabs" ).tabs({
                                selected: 1,
                                select:dojo.hitch(this, function(e, ui){
                                    this.readDetailSizePreference();
                                })
                            });
                        }));


For example of a tabbed infoPopup container.

Not being argumentative, just pointing out a preference for jQuery does not have to be preference against Dojo.
0 Kudos
derekswingley1
Frequent Contributor
Hey Eric,

I'm happy to have this discussion and provide as much info as I can about why we use dojo. I've tried to imply this, but I think I need to be more clear:  popularity should not be the primary reason for picking a tool/framework/technology.

jQuery is not the right tool to build our mapping API. It provides a great DOM API, event management tools and AJAX tools. That's it. It's missing a number of things which we would prefer to not re-invent.

One thing I'd like to see is a write up of things that dojo does poorly and could be improved by switching to jQuery. There's plenty of vague dojo bashing, but that doesn't go very far as to making a case for switching from one framework to another. "Dojo sucks, jQuery doesn't" and "everybody else is using it" are not persuasive arguments. And the latter isn't true in the online mapping space.

Regarding other open source mapping options, the only one I know of that uses jQuery is jQuery Geo (which is still in alpha, at the time of this post). The rest, Leaflet, Polymaps, OpenLayers and others I'm probably forgetting, don't use a framework. So if you want jQuery with those, it's up to you to include it.

At the end of the day, it's all JavaScript. I think our time is better spent getting to know the language, our tools and how to make cool stuff rather than holy wars over which framework is best. I'm hoping you'll give our API (and dojo) a fair shake rather than dismissing it solely because it's not built on jQuery.
0 Kudos
EricDaniel
Occasional Contributor III
I promise this is my last post on this topic since I completely agree that our time is better spent making cool stuff rather than these holy wars.  Yes, popularity should not determine what framework to use, but what is it about jQuery that makes it so popular?  Is it for technical reasons, probably so.  Is dojo better for GIS, maybe, sounds like it is for Esri but not for the opensource GIS community it seems.  I think you nailed it when you said those opensource frameworks don't use a framework.  And that is my main point with all of this and that's why I think you see the negative comments with Esri leveraging dojo heavily. 

That would be great if someone could write up something on comparing dojo to jQuery rather than the bashing with no legitimate argument.  I definitely don't have enough background in either to do that.  Maybe Jeff could put something like that in a blog post or something?
derekswingley1
Frequent Contributor
...what is it about jQuery that makes it so popular?

There are a ton of ways to answer this but I think the killer feature was/is the DOM API. The native DOM API provided by browsers is a PITA. jQuery masks this from you by providing simpler and easier ways to grab some elements and do something with them. This is why I mentioned dojox.jq in my first reply in this thread.

Is dojo better for GIS, maybe, sounds like it is for Esri but not for the opensource GIS community it seems.

It's not that dojo is better for GIS, per se. It's that dojo provides a more extensive set of tools that we want to be available to use ourselves and make available to developers using our API. Internally, we use dojo's build system. For devs, we like the idea of having a class/module system baked into the API as well as a robust widget lifecycle system. We also use dojo because it normalizes browser inconsistencies but so does jQuery so this isn't really a point that sets dojo apart (but one worth mentioning since we're now talking about some of the pros/cons of using any framework). 

I think you nailed it when you said those opensource frameworks don't use a framework.  And that is my main point with all of this and that's why I think you see the negative comments with Esri leveraging dojo heavily.

As I said before, we use dojo to avoid replicating work already done by others in the web development community. We don't want to spend our time fighting browser inconsistencies or shimming our new features into legacy browsers. The dojo team has committed to doing that work and we are thankful.
0 Kudos
JeffPace
MVP Alum
I promise this is my last post on this topic since I completely agree that our time is better spent making cool stuff rather than these holy wars.  Yes, popularity should not determine what framework to use, but what is it about jQuery that makes it so popular?  Is it for technical reasons, probably so.  Is dojo better for GIS, maybe, sounds like it is for Esri but not for the opensource GIS community it seems.  I think you nailed it when you said those opensource frameworks don't use a framework.  And that is my main point with all of this and that's why I think you see the negative comments with Esri leveraging dojo heavily. 

That would be great if someone could write up something on comparing dojo to jQuery rather than the bashing with no legitimate argument.  I definitely don't have enough background in either to do that.  Maybe Jeff could put something like that in a blog post or something?


Sorry, I am not the right person for that.  I see value in both, and could care less about the differences.  Both good tools, both useful.   Both have shortcomings, both have value.  I much prefer to learn a tool and get the job done than to complain that I can't use a different tool.
0 Kudos