Slashdot Mirror


Dojo: Using the Dojo JavaScript Library

stoolpigeon writes "The number and functionality of web based applications has exploded recently. Many of these applications rely heavily on AJAX to provide a more desktop-like experience for users. As the number of people using JavaScript grew, libraries were developed to assist with commonly encountered issues. Jim Harmon's new book Dojo: Using the Dojo JavaScript Library to Build Ajax Applications aims to introduce readers to one of those libraries, the Dojo Toolkit." Keep reading for the rest of JR's review. Dojo: Using the Dojo JavaScript Library to Build Ajax Applications author James E. Harmon pages 316 publisher Addison-Wesley Professional rating 7/10 reviewer JR Peck ISBN 978-0-13-235804-0 summary a complete example rich developer's guide to Dojo The Dojo Toolkit, is a JavaScript library, created to increase the speed of writing JavaScript applications. It provides developers with widgets, themes, wrappers for asynchronous communication, client side storage and more. It does all this across various browsers and platforms without requiring the user to worry about differences in browsers.

The book follows an interesting pattern. It begins with a five chapter tutorial. The tutorial launches immediately into taking a straight html form and using Dojo widgets to add functionality. All of the code used in the tutorial is available at the book's web site. This tutorial moves quickly, introducing a number of available widgets and giving the reader a nice feel for how Dojo integrates with html markup.

What does not take place in the tutorial is the normal introductory material on just what Dojo is, how it is installed, or what it can do. I'm guessing that this will be a welcome change to those used to quickly brushing past the first chapter, or more, of any programming book. Harmon takes advantage of the fact that Dojo is available via the AOL Content Delivery Network, so the examples will work any javascript capable browser connected to the internet. He does give a quick explanation of what would need to be different to use local files.

All of the introductory material that I'm use to seeing is still in the book but it does not appear until chapter ten. There Harmon covers the motivation to develop Dojo, explains the history of the project, provides a bit of information regarding the dual-licensing of Dojo. (It is available under the BSD and Academic Free Licenses.) This leads into the last seven chapters, that cover the 'deeper' material in the book.

Between the tutorial and chapter ten, there are four chapters of widget documentation with examples and some explanation. Of the three sections this is the longest, though this is in part due to sometimes large sections of white space, as each widget begins on it's own page. The documentation covers each widget and provides a visual representation where applicable. There is some repetition as this section covers widgets that were used in the first section's tutorial.

The third section is entitled "Dojo in Detail." It's the level of detail that marks this book as more of an overview, rather than an in-depth treatment of Dojo. Harmon is true to the title, this book is an extremely pragmatic guide to getting started with Dojo as a means of adding Ajax to applications. It is not however going to take the reader to any great depth into the toolkit. There is plenty here to get started, and enough to hit the ground running, but anyone to get really in-depth coverage of the library will be disappointed.

The person who will get the most out of this book is someone with some knowledge of mark-up and programming but not to an advanced level. The developer with a lot of experience will probably be frustrated with the amount of explanation and repetition of simple material combined with the lack of depth. The reader with no programming experience may struggle, though they could keep up if they are willing to look outside the book for a few resources to get a good grasp of web technologies. They may become extremely frustrated with some of the later chapters where the code examples skip steps and leave the reader to assume what has happened in between what is shown and the output.

That said, this book allows the reader to dive in quickly, get a quick overview and move immediately to making use of the Dojo Toolkit. If one is not concerned with gaining insight on every aspect of the library but would rather just get into it immediately with a little guidance, this may be just right.

With this in mind, it would have been nice if the book had provided less time on documentation and more on examples and ideas for how to best use the capabilities of Dojo. It is nice to have a book that isn't so huge that it is overwhelming and difficult to find anything. But if something had to be given up to keep things compact, I'd have much rather lost things that are easy to find in the on-line documentation and subject to change as the toolkit develops. This keeps the book from being excellent, but it is still a solid introduction and primer.

You can purchase Dojo: Using the Dojo JavaScript Library to Build Ajax Applications from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

21 of 85 comments (clear)

  1. How bout something relevant... by RemoWilliams84 · · Score: 3, Informative

    I'll be the first with something relevant here. We use the Dojo tooltips and toaster widgets at work. They come in handy. Easy to use and very customizable. The tooltips have a few flaws but nothing that you can't easily work around.

    --
    "I don't have to think. I only have to do it. The results are always perfect, but that's old news." - Meat Puppets
    1. Re:How bout something relevant... by Chatterton · · Score: 2, Interesting

      I use dojo to do a quick prototype of an application. You can start pretty quickly and do some pretty things. But I am blocked by the absence of an official widget to upload files and the fact that the standard input for file upload doesn't work with dojo. None of the sample code I found on the internet to do this seems to work well :(

      But except that big problem and some other minor ones, Dojo look very good.

    2. Re:How bout something relevant... by eddy_crim · · Score: 4, Interesting

      here here! i agree, as a coder ive not tried the other javascript front end frameworks like prototype and jquery but i have tried the server-side ajax frameworks like GWT and i don't like the way that i am detached from the JS that is actuall being generated.

      Dojo makes writing JS very easy but the extensibility of it make it very powerful.

      The other thing worth noting that may or may not be a good thing is the way Dojo is backed by IBM and used extensively in their products. Hopefully this means dojo is here to stay.

      Finally if you use dojo on the client with a JSON-RPC-Adapter on the server you can move your MVC view and controller onto the client and just keep a model and service layer back on the server. This opens up some interesting possibilities.

      --
      hmmm.
    3. Re:How bout something relevant... by rufus+t+firefly · · Score: 5, Interesting

      I also had written a UI in dojo, starting with 0.3.x and porting forward to 0.4.x. However, their API jump to 0.9.x and then 1.x made any further porting nearly impossible.

      It was riddled with issues that had to be worked around by messing with undocumented properties and all sorts of other nonsense. (Check out the 0.4.x Wizard code for some examples.) Patches to fix problems weren't accepted, and the developers weren't very responsive to any criticism, saying that it would be fixed in the API incompatible next releases.

      I moved to GWT, and haven't regretted the move at all. Performance wise, the precompilation has made it much faster, and the code is much more maintainable in java than in javascript. There's something nice about programmatically creating a reusable UI in a sane typed programming language instead of hacking together something in Javscript.

      --
      "He may look like an idiot, and talk like an idiot, but don't let that fool you. He really is an idiot." - Duck Soup
    4. Re:How bout something relevant... by djbckr · · Score: 5, Interesting

      I have to say a word of agreement here; GWT blows the pants off of anything else I can find (I was trying to come up with a better picture, but I guess that'll do).
      Nicely documented, pretty easy to use, high performance, relatively small code footprint (for what it does).
      Newer versions have properly deprecated methods that makes it easy to move from version-to-version. I shudder to think about using *anything* else for this purpose. Dojo is nice and all (probably the nicest of its kind), but it's nothing compared to GWT.

    5. Re:How bout something relevant... by rufus+t+firefly · · Score: 2, Interesting

      Plus, if you're really stuck on the way Dojo looks and feels, you can just use Tatami, which allows you to use the Dojo toolkit from inside GWT. You get the extra Dojo library bloat, but it may help someone.

      --
      "He may look like an idiot, and talk like an idiot, but don't let that fool you. He really is an idiot." - Duck Soup
    6. Re:How bout something relevant... by kevin_conaway · · Score: 2, Interesting

      We use ExtJS and were able to do file uploads quite easily using a combination of their Ajax form submit and Commons FileUpload.

      If Dojo has a control to submit a form asynchronously, you should be able to pull this off. Feel free to contact me for more details

  2. look at you hacker... by rarel · · Score: 2, Funny

    Not sure I wanna use something called Dojo with the threat of Shodan still around... ;)

  3. Re:Is it jquery? by Bill,+Shooter+of+Bul · · Score: 3, Informative

    Close. I'd like to see an all out brawl between the supporters of Dojo, Jquery, Prototype, and any others I've neglected to remember. The book and or the review should have mentioned the competing libraries and the particular advantages of Dojo. That would be helpful. Telling me that the book about dojo explains how to use dojo is not. Its a waste of time for most slashdotters.

    --
    Well.. maybe. Or Maybe not. But Definitely not sort of.
  4. Re:Is it jquery? by hobo+sapiens · · Score: 3, Funny

    Well, I'll tell you one thing: IBM is a primary sponsor of the Dojo foundation. Not so for jQuery and prototype. If IBM isn't a good enough reason to stay the heck away, I don't know what is.

    --
    blah blah blah
  5. I recently bought 2 other related books by MarkWatson · · Score: 3, Interesting

    I bought "Mastering Dojo" and although I have not finished it yet, I like it. I got into using Dojo a few years ago when I was experimenting with Common Lisp back end code with a REST architectural style - and a rich client Dojo web interface. Dojo is very cool. I have also used Dojo in a Rails web app and tried it with a JSP based web app (just a test, not a real project).

    The other related book I bought recently is "Javascript, The Good Parts" that has made me appreciate the language more.

  6. Re:Is it jquery? by yivi · · Score: 2, Insightful

    dojo is natively supported by the Zend Framework (from version 1.6 onwards).

    That may be enough on itself as a deciding factor for you... or not. Since I wanted to start with any of this Javascript libraries, the fact that ZF supported this one made my choice much easier.

    Dojo documentaion is slowly getting better, but it is still sorely lacking.

    O'Reilly has two other books for dojo: Mastering Dojo and The Definitive Guide.

  7. Re:Is it jquery? by Anonymous Coward · · Score: 5, Informative

    I think you'll be disappointed to find out that the creators of Dojo (including me), jQuery, and Prototype actually get along really well, and are starting to discuss working together to share code and concepts more formally across our toolkits.

    As far as advantages of Dojo, in general, we let you build complex, advanced apps with things like native vector graphics, charting, grids, etc., but can still scale down and perform for even the smallest of features or unobtrusive JS. We also lead the charge in areas like accessibility, internationalization, etc.

    -Dylan

  8. Re:Is it jquery? by yivi · · Score: 2, Interesting

    I'm sorry to answer my own post, but I just wanted to add: if industry support is the thing tilting you one way or the other, maybe you should consider that jquery recently got embraced in different ways by both Microsoft and Nokia.

    So depending on your on your needs, it could go either way. Featurewise, I think that both are pretty solid.

    I.-

  9. Recently looked at Dojo, but chose jQuery by gbrayut · · Score: 2, Interesting

    I was recently looking for a javascript library to help solve cross browser issues with accessing ASP.NET based web services. The main interest was DOM traversal, simple GET/POST/SOAP requests, and XML parsing. I looked at a bunch of different frameworks, but finally settled on jQuery. It had everything that I needed in a small package with excellent support for plugins and add-ons. We ended up using an XML to JSON converter plugin since parsing arbitrary XML can be a pain to do in a cross browser world. Keep in mind that we did not use any of the UI or effects portions of the libraries, but if you are looking for an easy way to create javascript that will work in most major browsers I suggest jQuery.

  10. Documentation? by Futurepower(R) · · Score: 4, Insightful

    The big, big, big issue is documentation. Other things being fairly equal, the library that is explained best will get used more, and receive much more support.

    It's said when EVERY user must do extra work, rather than just one writer.

  11. Re:Is it jquery? by Arkham · · Score: 4, Insightful

    I can't help but think that all of these JavaScript/AJAX libraries keep reinventing the wheel over and over again. How many grid widgets written in JavaScript do we really need? How many toolkits for a progress bar or a div-based dialog box have to be developed? Is one of them really that compelling over the others. Consider:

    http://dojotoolkit.org/ - DoJo Toolkit
    http://www.activewidgets.com/ - ActiveWidgets
    http://www.prototypejs.org/ - Prototype
    http://script.aculo.us/ - Scriptaculous
    http://jquery.com/ - jQuery
    http://extjs.com/ - Ext JS
    http://developer.yahoo.com/yui/ - YUI
    http://code.google.com/webtoolkit/ - Google Web Toolkit (GWT)
    http://www.sproutcore.com/ - SproutCore

    Those are just the ones I have used personally. It's getting ridiculous. Personally, I like the approach GWT has, but of course that's only relevant to the java developers of the world. I'd love to see all of these "widgets" be compatible with one another.

    --
    - Vincit qui patitur.
  12. Dojo is complex for complexity's sake by HighOrbit · · Score: 2, Interesting

    Dojo has some cool and impressive examples (the fish eye menu is kinda neat). However,everytime I've looked at Dojo and tried to figure out how to use it, I've had to walk away shaking my head. It is usually easier to implement something myself instead of trying to figure out the all the undocumented spaghetti code and "helper" files and abstractions in Dojo. Dojo seems to have taken all the complexity jokes about java and ported them to javascript. Maybe they have gotten better in the last year or so, but the last time I looked, most of it was undocumented and the code as non-trivial to decypher.

    For people who want to use some simple, yet powerful JS/Ajax/CSS, I'v been recommending that they check out BrainJar. Brainjar has some pretty neat stuff that is much easier to figure out, although its random stuff and not a comprehensive toolkit. But brainjar will give you some neat ideas of the things you can to with JS and CSS. Check out the windowing demo and as a plus it won't screw with your mind like Dojo.

  13. Re:Comparison to YUI? by zuperduperman · · Score: 2, Interesting

    YUI is extremely well documented, has a great active forum and has (quite literally) hundreds of examples - dozens for each control / feature offered. They also offer a very nice, consistent theme that goes right across the whole library and integrates with every component.

    I haven't looked at dojo in a while but when I did, the documentation was *horrible*. You really had to go through a lot of pain to "grok" how it worked under the hood before you would be productive (this may have gotten better). My impression however is that it is much more cutting edge than YUI - folks doing research into new techniques are far more likely to put it into dojo than any where else (certainly not YUI etc.) - however as a result it is much less stable, less consistent and less well documented.

    For a full end to end framework for use in developing a commercial app I prefer YUI, because every aspect of it is mature and solid and the support from Yahoo for it is amazing. On the other hand, if you're doing something cutting edge where you really want to push the limits and use new browser features or super fancy never-before-seen effects - dojo could be the best choice.

  14. Re:GWT and jQuery by Nathanbp · · Score: 2, Informative

    I have to say a word of agreement here; GWT blows the pants off of anything else I can find

    Forgive my ignorance here, but why is Google using jQuery in their Google Code site if they could have used GWT?

    Google has said that many of their older websites use JavaScript of some sort instead of GWT because GWT had not yet been created when they started work on them, and they feel it would be too much work to move them to GWT. There are some examples of newer Google sites that use GWT that you can look up.

  15. 50% ? by Tablizer · · Score: 2, Interesting

    I browsed around the web for Dojo examples, and only about half worked. Not a good sign. Some outright crashed, others half-worked with things like text in the wrong place or only deletion working but not insertion. Reminds me of Java applets a decade ago.