Saturday, January 10, 2009

What makes Dojo diferent?




Dojo (and also Ext, IIRC) have a couple of semi-unique features, being proper data abstractions in the client layer and extendable, hierarchical widgets systems.

I know Dojo best, so I'll use that as an example;

Data abstraction means a separate API layer between widgets (or other classes) and the actual data. All dojo.data datastores (as they are called) have the same kind of API, but manages access to data differently. For example theres one store called ItemFileReadStore, which just read in a JSON object from an url and provide it as a bag of items to widgets.

Let's say that you use this data store to provide data to a combobox which implements type-ahead (which the Dojo one does). After testing you want to have a more advance data store which only fetches some items at a time (because the amount of data on the server is too large to load at once) and caches it. That means switching to the JsonRestStore, which uses the same API as the first one, et.c.

Here are some good articles that give more meat on dojo.data;

http://www.sitepen.com/blog/2008/06/13/restful-json-dojo-data/




The widget system in Dojo let you define custom widgets and place them on the page, using a single element with special properties. Dojo scans for these elements and look up the widget definition (in a JavaScript file and the HTML template for the widget (pointed out by the JavaScript file).

Dojo then calls special functions in the widget class according to lifecycle events, and also manage unique id creation for html template elements, instantiation of subwidgets, et.c.

Dojo uses this system for all its own widgets internally, and many custom widget projects I do for customers start out with subclassing an existing widget (using Dojo's pseudo- OO). The reason this work so well is that Dojo have proper namespacing, which also correspond (but can be overridden) to directory hierarchies, so class/widget lookup is both straightforward and understandable.

At the moment jQuery have no data abstraction or widget subsystem (unless I've misunderstood jQuery UI completely, in which case I would very much like to be corrected :), and neither have YUI.

Now I've done it again. :) This is my next blog post, apparently.

Cheers,
PS

5 comments:

Heather said...

Nice post. I look forward to part 2 ;)

Peter Svensson said...

@Heather: Great, now I have to write a second part! :)

oakleyses said...

tiffany and co, polo ralph lauren outlet, louboutin shoes, louis vuitton outlet, louboutin outlet, kate spade handbags, air max, michael kors outlet, polo ralph lauren outlet, louis vuitton outlet stores, nike shoes, louboutin, michael kors outlet, oakley sunglasses cheap, longchamp handbags, chanel handbags, kate spade outlet, michael kors outlet, true religion jeans, oakley sunglasses, louis vuitton, coach factory outlet, michael kors outlet, nike free, christian louboutin shoes, prada outlet, michael kors outlet, burberry outlet, tiffany and co, coach purses, burberry outlet, true religion jeans, ray ban sunglasses, prada handbags, michael kors outlet, coach outlet store online, louis vuitton handbags, tory burch outlet, air max, gucci outlet, jordan shoes, longchamp outlet, louis vuitton outlet, coach outlet, ray ban sunglasses, oakley sunglasses, longchamp handbags

oakleyses said...

hollister clothing store, north face outlet, valentino shoes, air max, soccer jerseys, lululemon outlet, abercrombie and fitch, uggs outlet, moncler, moncler, nfl jerseys, jimmy choo outlet, new balance shoes, celine handbags, giuseppe zanotti, rolex watches, chi flat iron, ugg pas cher, mont blanc, herve leger, canada goose jackets, wedding dresses, canada goose, canada goose, moncler, bottega veneta, canada goose uk, babyliss pro, mcm handbags, baseball bats, ghd, ferragamo shoes, ugg australia, soccer shoes, canada goose, p90x, birkin bag, canada goose outlet, ugg boots, instyler, ugg, beats by dre, ugg boots, asics running shoes, north face jackets, iphone 6 cases, moncler outlet, reebok outlet, marc jacobs, insanity workout

oakleyses said...

michael kors, nike roshe, michael kors pas cher, nike free pas cher, polo ralph lauren, nike blazer, sac burberry, air jordan, hollister, longchamp, nike trainers, nike roshe run, vanessa bruno, vans pas cher, north face, timberland, louis vuitton, longchamp, sac longchamp, oakley pas cher, ray ban sunglasses, hollister, michael kors, ray ban pas cher, polo lacoste, nike huarache, barbour, new balance pas cher, sac louis vuitton, sac hermes, nike roshe run, vans shoes, sac guess, mulberry, nike free, mac cosmetics, abercrombie and fitch, lululemon, louboutin, air max, air force, louis vuitton uk, hogan outlet, converse pas cher, north face, nike tn, ralph lauren, hollister, sac louis vuitton, nike air max