Dojo 0.9
========
Intro:
------
Dojo is very clearly a success. The entire spectrum of web application needs is
represented by Dojo's current user base. From high-profile, high-traffic
installations to enterprise applications, Dojo provides the inventive, modular
backbone of many application UIs. This success has created new problems, and
Dojo 0.9 is aimed at addressing these issues while attempting to learn from our
own recent history as well as the history of Ajax library development in order
to deliver the very best, most useful, and most comprehensive set of tools for
building great web experiences.
This document addresses the non-widget namespaces of Dojo with the
understanding that all widget infrasturcture along with all pruning/splitting
of those namespaces is the exclusive perview of the Dijit maintainer.
Axioms of Dojo 0.9/1.0 API design:
----------------------------------
* Remove the magic
Too many 0.4.x APIs are magical. Where a plugin system is required, it
MUST NOT silently affect existing behavior. Requirement of additional
functionality SHOULD have an associated increase in API surface area.
* Pave the fast paths
It is our job to expose those things that can be responsibly used to
build great experiences. Nothing more. Given the constraints of the
browser environment, this means chosing winners.
* What we leave out is as important as what we put in.
* Code duplication in the trunk is unacceptable. Code duplication in the
leaves is undesireable, but more tollerable.
* Fewer idioms, better applied
Today, Dojo has no clear "identity" in its calling conventions and class
hierarchies. In many cases, there are too many classes to acheive what
appear to be single goals. In other cases, there are simple data
structures/classes operated on by multiple functions but that knowledge
or pattern is not shared by the rest of the system. Dojo 0.9 should seek,
from naming to class design, to reduce the number of "things" users need
to think about in the system. In many cases, this means giving users more
ways to take actions on fewer objects.
* Reward users for using more of Dojo, not less
In may ways this is subjective, but every K of file size should give
users something that they can appreciate on a daily basis.
Major Proposed Changes:
=======================
Base vs. Core:
--------------
Splitting up the Dojo project has caused much consternation amongst committers
and users. Contributors and committers are worried that their favorite features
may not be easily available or that their modules will be moved out to some
sort of second-class ghetto. Users are worried that Dojo will loose critical
functionality that their applications depend on.
Neither will happen.
Many modules are going to be pruned and potentially split up in the creation of
Dojo 0.9, but critical functionality will not be lost. Additionally, the new
web-based build system will expose to users the entire spectrum of Dojo (dojo,
dijit, dojox) as being available at build time. Users will still be able to get
any, and all, of Dojo.
For developers, there will be a new distinction: base vs. core. As outlined
below, dojo.js will *always* include a useful set of functionality that all web
applications can take advantage of. This is the Base.
Dojo Core is a superset of Base. It includes modules which are of exceedingly
high quality which the Dojo team is committed to maintaining and supporting for
the long haul. Modules that are part of Dojo Core that are not part of the Base
distribution (dojo.js) will be available in all builds and releases and can
therefore be relied upon to be available. Users will need to explicitly include
this functionality via
Could now be written as:
Note that the prior syntax is still available, but is not likely to be
advantageous since the new variation is smaller and easier to use.
The Split:
==========
APIs in Base:
-------------
// loader
dojo.require()
dojo.provide()
dojo.moduleUrl()
dojo.dojoUrl()
dojo.registerModulePath() // or whatever it's called this week
dojo.platformRequire() // was kwCompoundRequire
dojo.version
dojo.is* // see below for details
// i18n
dojo.requireLocalization() // need to find a way to make this code smaller, perhaps move to i18n?
// misc util
dojo.deprecated()
dojo.experimental()
dojo.getObject() // strToObj() ?
dojo.exists()
dojo.global()
dojo.doc()
dojo.addOnLoad()
dojo.addOnUnload()
dojo.cookie()
// lang util
dojo.eval() // was dj_eval
dojo.hitch() // was dojo.lang.hitch
dojo.partial()
dojo.declare() // was dojo.lang.declare() new, lightweight version
dojo.extend() // was dojo.lang.extend()
dojo.mixin() // was dojo.lang.mixin
dojo.toJson()
dojo.fromJson()
// crockford funcs, et. al.
dojo.isString()
dojo.isArray()
dojo.isFunction()
dojo.isObject()
dojo.isArrayLike()
dojo.isAlien()
// array extras
dojo.forEach() // was dojo.lang.forEach
dojo.every() // was dojo.lang.every
dojo.some() // was dojo.lang.some
dojo.map()
dojo.filter()
dojo.indexOf()
dojo.lastIndexOf()
// node utils
dojo.byId()
dojo.query()
dojo.NodeList (described in "NodeList.txt") // any reason for a dojo.Node?
dojo.createElement(obj, parent, position)
dojo.place(node, refNode, position) // was dojo.dom.insertAtPosition
// style utils
// note, we must document the standards vs. quirks vs. explicit box model
// toggling upshots of using the following box functions
dojo.borderBox(node) // returns { w: 0, h: 0 }
dojo.borderBox(node, boxObj)
dojo.marginBox(node) // returns { w: 0, h: 0 }
dojo.marginBox(node, boxObj)
// in coords, x and y are absolute while w and h are border-box
dojo.coords(node) // { x: 0, y: 0: w: 0, h: 0 }
// need a setter for coords or a moveTo method?
dojo.style(node) // returns computed style obj
dojo.style(node, propertyName) // pixel value of property
dojo.style(node, propertyName, value) // sets it
// I/O // was dojo.io
dojo.Deferred
dojo.callQueue("queueName", "dojo.xhrGet", {/*args */}) // returns Deferred
dojo.xhrGet()
dojo.xhrPost()
dojo.rawXhrPost()
dojo.formToQuery()
dojo.mapToQuery()
dojo.wrapForm(formNode) // was FormBind
dojo.formToObject(formNode)
dojo.formToJson(formNode)
dojo.queryToObject(str)
// event
dojo.connect()
dojo.disconnect()
dojo._addNodeListener()
// effects
dojo.fx // was dojo.lfx
dojo._IAnimation
dojo._Animation // must be a Deferred
dojo._PropertyAnimation
dojo._defaultEasing()
dojo.fadeIn()
dojo.fadeOut()
dojo.slideIn() // new, replaces wipeIn
dojo.slideOut() // new, replaces wipeOut
dojo.animateProperty() // was dojo.lfx.propertyAnimation
// color functions. Were in dojo.color
dojo.extractRGB()
dojo.rgb2hex()
dojo.hex2rgb()
// environment test variables (boolean):
dojo.isBrowser
dojo.isRhino
dojo.isSpidermonkey
dojo.isMobile // ?
// browser test variables
// integers corresponding to version numbers
dojo.isFF // may need to roll up gecko rendering numbers
dojo.isIE
dojo.isKonq
dojo.isSafari
dojo.isOpera
// desupported:
// dashboard
// WSH
// Adobe SVG (already dead)
// Native SVG
// may need to add:
// Apollo
// WPF/E
// Mobile browsers:
// NetFront
// Opera Mobile
// PIE
// BlackBerry
// Reindeer (S60 webkit)
In Core but not Base:
---------------------
dojo.undo
dojo.dnd // modulo trimming and rework
dojo.lfx.html (everything not listed above)
dojo.rpc
dojo.string
dojo.i18n
dojo.html and dojo.style extras
dojo.topic // was dojo.event.topic
dojo.data
dojo.io.script
dojo.io.iframe
dojo.AdapterRegistry
dojo.validate
dojo.date
dojo.fx
_Chain
_Combine
// things users might actually use
chain()
combine()
Unsure:
-------
dojo.regex (?)
dojo.ns
dojo.dom // most of this NS can be removed, but where does the rest go?
Moved to dojox:
---------------
dojo.gfx
dojo.cal
dojo.charting
dojo.storage
dojo.dot
dojo.sync
dojo.DeferredList
dojo.profile
dojo.svg
dojo.crypto
dojo.flash
dojo.math.* (math.js will remain, albiet trimmed)
dojo.collections.*
dojo.behavior
dojo.uuid
dojo.xml.XsltTransform
dojo.advice // was dojo.event.connect()
dojo.selection
dojo.io.cometd
dojo.io.repubsub // was dojo.io.RepubsubIO
dojo.io.xip
Removed:
--------
dojo.render
dojo.animation
dojo.graphics
dojo.logging
dojo.props
dojo.debug (replaced by console.*)
dojo.xml.Parse
dojo.text
dojo.docs (?)
A Note On Function Movement:
============================
Dojo committers will note that some functionality that was once left to utility
namespaces is being migrated directly into the core of the system. This is by
design.
Today, many namespaces (dojo.a11y, dojo.uri.*, etc.) are assumed to be better
left alone as utilities because there are scenarios that do not demand them.
This, generally, is a false assumption. Most non-trivial uses of Dojo require
many of these functions and in serveral places, "lower level" implementations
within the bootstrap or in other modules exist in order to provide the same
behavior to code that needs to run earlier in the lifecycle. Correcting this
false choice is something that we should take the opportunity to do in 0.9. We
have enough experience with the existing namespaces to now say what's really
critical and what's not.
vim:et:ts=4