Comparing backbone.js and Dojo

stwissel picture stwissel · Oct 6, 2011 · Viewed 8.1k times · Source

I'm looking at settling on my JS toolbox. For some product reasons dojo will be in there. Now I wonder if adding backbone.js makes sense. Do Dojo (which does a few other things - I'm aware of that) and backbone.js overlap or complement? What would be the conceptual differences in overlapping parts? Are there examples that use both together? (I know it is a rather broad question and might show my 2nd level of ignorance)

Answer

lorefnon picture lorefnon · Oct 6, 2011

Dojo covers a much wider scope than Backbone.js. If you are already proficient with Dojo then the only reason you would want to consider Backbone.js in your toolbox is because it is lightweight. You may or may not like the API difference - it is purely a matter of choice. If you are already using Dojo in a project, then there is really no point using Backbone.js in the same project because Dojo has all you need to build an MVC architecture although at a surfacial level it might not be so obvious. Dojo data stores are powerful and Dijit widgets are designed to be used with Dojo datastores. Using Backbone models for providing data backend for Dijit widgets would be very cumbersome. That is really unnecessary because in Dojo data layer and presentation layer are very neatly decoupled and works excellently out of the box. However if you just require a lightweight MVC structure for your app then Backbone.js might provide you a lighter alternative than using Dojo.But again depending on your app and your requirements one may be more appropriate than other...