Introduction

Dojo provides a lot of power and attempts to make it digestable in three major layers: Dojo Core, Dijit, and DojoX. This book serves as a guide to these layers, introducing concepts as you need them and working downward from high-level usage to getting your hands dirty in building your own widgets, custom namespaces, and unit tests.

As you'll see, Dijit and DojoX build on the solid foundation that Dojo Core provides for all Dojo applications. With Core and Dijit locked into stable APIs and a heavy QA, i18n, and accessibility process many edge-of-the-web features for which Dojo is known are developed in the looser, more organic DojoX project. Throughout the book we will show you how these parts build on each other and use the infrastructure each provides to elegantly solve user experience problems which until now have been difficult for browser-based UIs to address.

Thanks for checking out Dojo and the Dojo Book. If things aren't clear in the book, just comment on the book page in question and we'll try to improve it. It's your applications that have inspired us to build Dojo and the stories of people improving user experiences with the toolkit keep us going, and it's with your help that we are evolving this book.

Licensing

You may use Dojo in commercial software without obtaining a separate license or incurring other obligations.

The Dojo Toolkit is dual-licensed. The preferred license is the Academic Free License v2.1. It is extremely liberal, allows for commercial use, and provides for sub-licensing. All Dojo Foundation projects release their code under the terms of this license. It is almost never necessary to exercise the "dual" portion of the dual-licensing terms since the AFL is extremely permissive.

For users who face the problem of artificial ambiguity the FSF has created regarding the compatibility of the AFL and the (L)GPL, The Dojo Toolkit may alternately be used under the terms of the BSD License. Both the AFL and the BSD licenses meet the licensing goals of the Dojo Foundation.

Dojo's "dual licensing" is different than that of many Open Source projects in that the terms of both licenses are Open Source and extremely permissive. There are no royalties or commercial use clauses to complicate the matter. In almost every case, you will not need to choose anything other than the AFL and in the common case you need not do anything to denote this choice of license. If you have questions regarding Dojo licensing, please do not hesitate to contact Alex Russell, current President of the Dojo Foundation.

The Role of the Dojo Foundation

Dojo is Open Source software, distributed by a non-profit foundation which has been set up for the purpose of providing a vendor-neutral owner of Dojo intellectual property. In order to ensure to users of Foundation projects that there is no ambiguity or hidden liability regarding the use of Foundation code, all contributors are required to provide signed Contributor License Agreements.

All committers on Dojo Foundation projects have a vote in Foundation matters. The Foundation is run by contributors, operates in a transparent way, and is funded exclusively by donations. The licensing goals of the Foundations are briefly covered on the Foundation page.

Third-Party Licenses

Dojo uses code from other open source projects, subject to the terms of their licenses. Those licenses and software copyright notices are listed below:

History

In early 2004 Alex Russell (original creator of netWindows) began looking to hire a collaborator on DHTML projects at Informatica. In the process many members of the DHTML community were contacted, culminating in the April 25, 2004 email titled "Selling the future of DHTML". David Schontzler (Stilleye) spent a summer working at Informatica, and Dylan Schiemann also joined Informatica at that time. The first lines of code contributed to Dojo were done by Alex and Dylan with the support of Informatica. There were many other community members that were active participants in shaping the direction of Dojo, including Joyce Park, Tom Trenka, Mark Anderson, Leonard Lin (who suggested the name Dojo), Aaron Boodman, Simon Willison, Cal Henderson, and Dan Pupius.

After several months of discussions on the ng-dhtml (now dojo-developer) mailing list about licensing, choosing a name, coding conventions, build tools, server configuration, and requirements, work began and the Dojo Foundation was formed. The foundation is a 501(c)6 entity designed to house the code and IP rights and today hosts several other projects as well. By March 2005 contributions from the community began to outweigh those of the core development team and today 8 major releases have been made with over 1 million downloads of Dojo to date. Contributions and code have come from more than 60 developers and companies and major users such as IBM, AOL, Sun, SitePen, Bloglines, Google, Nexaweb and others continue to keep Dojo's quality high and the community vibrant.

Why Dojo?

Today there are several high-quality JavaScript toolkits available and several hundred other toolkits of varying quality and completeness. Why, out of that sea of possible options, should you chose Dojo?

  • Breadth and Depth: Dojo is the "full stack". Instead of cobbling together components from several different sources, Dojo allows each component to build on a trusted set of high-quality building blocks by providing integrated infrastructure and a wide variety of optional modules. These components provide good solutions to common user experience problems and can be easily tweaked to meet your needs. From pane-based layouts to client-side charting and graphing to data binding to a time-tested module system, Dojo is solid infrastructure for delivering great experiences.
  • Quality: Infrastructure for internationalization and accessibility is woven through the entire fabric of Dojo. Keystrokes are hinted correctly. The components all fit together as a cohesive whole. Everything is customizable easily with CSS, but very little needs to be tweaked to get a great looking UI nearly everywhere. These are the hallmarks of a system which has been designed and tested to deliver great experiences, not only to users, but also to designers and developers.
  • Performance: Dojo is used on high-profile, high-traffic sites every day and Dojo's build tools are a key reason why. Dojo's package system makes it easy to manage large-scale UI development projects and the build system layers on top to make your applications scream; all without code changes. Dojo also packs high-performance implementations of common utilties into its core, and the rebuild of Dojo for 0.9 focuses heavily on performance and reduced code footprint. The result is a small, tight toolkit that is blazing fast. Dojo's performance alone makes it an ideal platform to extend and build on.
  • Community: Dojo is an open community. As a result many individuals and companies have been able to come together on a level playing field to build tools that benefit everyone. The licensing of the toolkit is designed to be as apolitical as possible and we work hard to ensure that getting your itches scratched is easy if you are willing to get involved. All development happens in the open and the barriers to entry are intentionally very low. We don't care where you work or how "qualified" you are, all we care is that you want to build products that makes user experiences better. Designer or developer or doc writer, the community Dojo values contributions of every kind and position in the community is commensurate with the quality of the work you do, not political wrangling. We're working to change the notions of who can be contributors in Open Source and we invite you to join us in charting a new path. If you want to build a great product and think you can help us, we want to hear from you.

Dojo vs. Other Toolkits

Several other toolkits are often compared to Dojo. What follows is not a comprehensive comparison, but rather a high-level comparison of the features and design goals of these alternatives and how they compare to Dojo's features, development process, and philosophy.

  • MochiKit: MochiKit is a high-quality JavaScript toolkit which makes writing JavaScript as pythonic as is reasonably possible while still achieving good performance. It follows many of the same conservative principles about packaging, naming, and global namespace usage as Dojo. Authored primarily by Bob Ippolito, it has great docs and tests but unlike Dojo does not ship with a widget system or extensive component set. Some code is shared between Mochi and Dojo (under CLA, of course). Mochi is not backed by a foundation and code lineage is not verified but it is very liberally licensed.
  • Prototype+Scriptaculous: These pervasive libraries provide much of the same functionality as Dojo Core but do not share the same conservative philosophy regarding global namespace contention, favoring shorter naming of commonly used functions over other concerns. They feature good documentation and broad community support as well as tight integration with Ruby On Rails (among other frameworks). Scriptaculous provides some controls (auto-complete, sliders, etc.) but is not a widget toolkit and does not have support for building widgets easily. Many add-on libraries are available for Prototype+Scriptaculous but they are not distributed with the library as such. They do not feature a package or build system (aside from their own distributables).  Prototype and Scriptaculous are not backed by a foundation and code lineage is not verified but they are very liberally licensed.
  • YUI: YUI is developed in-house at Yahoo and features extensive, high-quality documentation and examples. Designed for speed and targeted at a population of professional PHP developers, YUI is designed with the needs of Yahoo-scale applications in mind. A growing list of controls is available with the toolkit as are useful CSS normalizing and layout style sheets. No package system is available, but "roll up" files of common functionality are distributed and documentation makes clear what order to load files in. No CSS query or markup-driven widget construction system is available in YUI. YUI has an active community and liberal licensing but external committers are not allowed on the project and Yahoo has not clarified the code lineage and other IP rights around the toolkit. No source control access of any sort is available. YUI is edge-cached on Yahoo's CDN for use by all.
  • JQuery: A minimalist system focused primarily on operating on existing DOM structures, JQuery features a hybrid XPath/CSS query language (Dojo uses standard CSS 3 queries) and provides a rich set of options and operations on the results of these queries. JQuery packs Ajax, effects, and other utilities into a small core (beating all but MooTools). While there is no widget or package system in JQuery per sae, 3rd party component libraries are available which build on top of JQuery. The JQuery community is highly active, usually helpful, and external contributions and patches are accepted. Good docs for the system are readily available. JQuery is dual-licensed MIT and GPL with all copyrights resting with John Resig. It is not clear how IP rights are assigned to John by other contributors and under what terms. Several frameworks (notably Drupal) integrate JQuery.
  • EXT: Like Dojo's Dijit system, EXT is a component library. It features a large number of consistent, good looking widgets with an emphasis on pixel-perfect layout and desktop-like UIs across browsers. Originally developed to run on top of YUI and later JQuery, EXT now has it's own low-level library, removing the need for 3rd party dependencies. The EXT community is very active and good documentation is available for the library. It is licensed under the terms of the LGPL and commercial licenses of various forms are available. It is not clear whether or not external contributions are accepted (and under what terms) and anonymous subversion access is limited to those who financially support the project in some way.
  • GWT: Directly integrating server-side development and client-side development, GWT takes the perspective that JavaScript is a bug to be solved and uses advanced compiler technology to allow developers to write in Java and generate dynamic, JavaScript based UIs in the Google style. The default widget set is a strict subset of those provided by Dijit, but GWT takes great pains to optimize all generated code. A growing trove of add-on libraries are available to enhance the default components. Unlike YUI and EXT, GWT is being run as a real Open Source project, allowing external committers, and doing development in the open while managing IP issues in a very sophisticated manner (CLAs, code review, etc. Much like Apache or Dojo).  GWT applications can only be written in Java and are most often deployed on Java containers. Good documentation is available and a thriving community is helpful.

For the sake of comparison, Dojo:

  • Allows external committers and uses CLAs (like GWT or Apache) to ensure that there are no IP issues
  • Is very liberally licensed and provides anonymous SVN access to everyone. Committer privs are earned
  • Provides a relatively rich client-side component set but does not require tight binding to any server-side language ("protocols, not APIs")
  • Attempts to provide a balance between on-the-wire size and common-case functionality. Dojo Base is similar in size to Prototype.
  • Is very conservative about not stepping on the toes of other code in your pages and preserving the global namespace
  • Is edge-cached on AOLs CDN for use by all
  • Provides a package system which makes knowing which order to load things in a moot problem
  • Allows for incremental enhancement via markup and provides a very easy-to-use widget system for building your own reusable components which can then be easily instantiated via markup.