Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Dojo: Using the Dojo JavaScript Library

samzenpus posted more than 5 years ago | from the read-all-about-it dept.

Programming 85

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.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.

cancel ×

85 comments

Sorry! There are no comments related to the filter you selected.

Wait, really? (0, Informative)

Anonymous Coward | more than 5 years ago | (#25469877)

Nobody cares?

Re:Wait, really? (0, Offtopic)

boxxertrumps (1124859) | more than 5 years ago | (#25469995)

Nope.

Re:Wait, really? (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#25470187)

So I'll take the opportunity to moan about Slashdot.

Every time I load a page Firefox spends an age waiting for genweb.ostg.com. Sort your bloody servers out you cheap bastards.

Re:Wait, really? (0)

Anonymous Coward | more than 5 years ago | (#25471141)

Also get rid of the retarded shortcut keys without modifiers. I'll accidently press q or something and suddenly I've lost my place.

Nobody cares? (0)

Anonymous Coward | more than 5 years ago | (#25469955)

Story has been up for a while and this is the first post!

Re:Nobody cares? (0)

Anonymous Coward | more than 5 years ago | (#25471439)

Appears to have been a blip in the slashdot. For some reason, it showed up as being posted at 9am. I got the first post at a little after noon, and now the story is showing as being posted a little before one.

book reviews? (0, Offtopic)

mattwarden (699984) | more than 5 years ago | (#25470143)

Why isnt this under book reviews?

Old news (0)

Anonymous Coward | more than 5 years ago | (#25470279)

javascript is pants.

Re:Old news (0)

Anonymous Coward | more than 5 years ago | (#25470571)

You've got some crumbs stuck in your beard.

Re:Old news (1)

VeNoM0619 (1058216) | more than 5 years ago | (#25470821)

Ok... what will it take to make javascript shirt then?

Is it jquery? (-1, Flamebait)

Anonymous Coward | more than 5 years ago | (#25470449)

No. Then I don't care.

Re:Is it jquery? (3, Informative)

Bill, Shooter of Bul (629286) | more than 5 years ago | (#25470901)

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.

Re:Is it jquery? (3, Funny)

hobo sapiens (893427) | more than 5 years ago | (#25471093)

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.

Re:Is it jquery? (2, Insightful)

yivi (236776) | more than 5 years ago | (#25471405)

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 [oreilly.com] and The Definitive Guide [oreilly.com] .

Re:Is it jquery? (2, Interesting)

yivi (236776) | more than 5 years ago | (#25471639)

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.-

Re:Is it jquery? (5, Informative)

Anonymous Coward | more than 5 years ago | (#25471563)

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

Documentation? (4, Insightful)

Futurepower(R) (558542) | more than 5 years ago | (#25471977)

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.

Correction. (1)

Futurepower(R) (558542) | more than 5 years ago | (#25474457)

Should be: "It's sad when EVERY user must do extra work, rather than just one writer."

Re:Documentation? (0)

Anonymous Coward | more than 5 years ago | (#25480485)

Agreed. And dojo documentation sucks big time. We chose dojo for a project based on documentation (there was a fantastic set of example 2 years ago). then, in a typical "engineer like to break things" attitude, those examples were removed, and documentation now sucks very very big time.

It is getting better lately, but not that much better.

Re:Is it jquery? (1)

Bill, Shooter of Bul (629286) | more than 5 years ago | (#25472397)

Interesting. The violence I was hoping for was only metaphorical in nature. Competition is only good when there is an ability to differentiate the offerings. I think I'll have to take a look at DOjo then. Native vector graphics sounds great.

Re:Is it jquery? (0)

Anonymous Coward | more than 5 years ago | (#25476373)

I'd like some non-native vector graphics. Where do I get it?

Re:Is it jquery? (1, Informative)

Anonymous Coward | more than 5 years ago | (#25471591)

Funny you say that.. i just went to the AJAX Experience conf this month in Boston. The dev'ers of the four big ones were on stage together (+ Yahoo!). Things were a bit tense once in a while, but for the most part, they were polite.

Re:Is it jquery? (4, Insightful)

Arkham (10779) | more than 5 years ago | (#25472027)

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/ [dojotoolkit.org] - DoJo Toolkit
http://www.activewidgets.com/ [activewidgets.com] - ActiveWidgets
http://www.prototypejs.org/ [prototypejs.org] - Prototype
http://script.aculo.us/ [aculo.us] - Scriptaculous
http://jquery.com/ [jquery.com] - jQuery
http://extjs.com/ [extjs.com] - Ext JS
http://developer.yahoo.com/yui/ [yahoo.com] - YUI
http://code.google.com/webtoolkit/ [google.com] - Google Web Toolkit (GWT)
http://www.sproutcore.com/ [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.

Re:Is it jquery? (1)

lysergic.acid (845423) | more than 5 years ago | (#25472567)

i can't help but think that all these cars keep reinventing the wheel over and over again. how many four-wheeled gas-powered automobiles do we really need? how many cars with driving wheels or airbags or cupholders have been developed? is one of them more compelling than the other?

not everyone programs in the same style. not every toolkit is suited to the same programming style. it's good that web developers have a variety of toolkits to choose from. are all the different CMS packages out there reinventing the wheel? what about all the programming languages? all the operating systems? there isn't just a single approach to every problem. the toolkits that are useful will gain a large following and continue to be developed. the ones that aren't will fall into disuse and die. there's no sense in complaining about choice.

Re:Is it jquery? (1)

scurvyj (1158787) | more than 5 years ago | (#25477725)

Totally agree Arkham, and some of them are so 'wanky' it begats pointless. Dojo is a culprit here too.

Re:Is it jquery? (0)

Anonymous Coward | more than 5 years ago | (#25480003)

"How many grid widgets written in JavaScript do we really need?"

how many <insert widget name> do we need ? Just one. But one that works.

I had been caught numerous times with some code that did 90% of what I needed, and then you have the choice: hacking existing code, alone or with the help of primary author -or- creating a new wheel.

I ended up myself reinventing the wheel again and again because that was simply the easiest thing I could do, adding more noise to the crowded debate.

Give me the browser that implements the high level widgets everyone need, and I'll be extremely happy.

Ahh, ok, we need to get the standard first... Jeez...

Re:Is it jquery? (1)

D Ninja (825055) | more than 5 years ago | (#25473411)

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.

Obviously Dojo [wikipedia.org] would win, given the fact that it has produced hundreds of exceptional fighters in its time.

Re:Is it jquery? (1)

Jansingal (1098809) | more than 5 years ago | (#25477363)

dojo would win hands down, no question!

Problem (0)

FluffyWithTeeth (890188) | more than 5 years ago | (#25470487)

Of course, the real problem comes when dojo destroyers come to challenge your entire office.

Seriously. We paid good money for that damned sign.

Dojo vs jQuery (0)

Anonymous Coward | more than 5 years ago | (#25470741)

I'm just starting out with javascript. I've only done bug fixing on existing sites, and have never used a framework. What are the pros and cons of Dojo and jQuery?

Re:Dojo vs jQuery (1)

micheas (231635) | more than 5 years ago | (#25479407)

I'm just starting out with javascript. I've only done bug fixing on existing sites, and have never used a framework. What are the pros and cons of Dojo and jQuery?

Pros of Dojo and jQuery:

  • Much less developer time.
  • Fairly good cross browser support.
  • Much easier to debug code.

Cons:

  • Simple tasks require a much bigger download. (in the case of yui can be somewhat mitigated by leaching off of yahoo's hosting.)
  • Encourage the use of javascript as a band-aid for broken cms logic.

How bout something relevant... (3, Informative)

RemoWilliams84 (1348761) | more than 5 years ago | (#25470779)

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.

Re:How bout something relevant... (2, Interesting)

Chatterton (228704) | more than 5 years ago | (#25471037)

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.

Re:How bout something relevant... (2, Interesting)

kevin_conaway (585204) | more than 5 years ago | (#25474827)

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

Re:How bout something relevant... (1)

vhogemann (797994) | more than 5 years ago | (#25480515)

ExtJS uses a clever hack to allow async file upload... a hidden iFrame. So it's not really an async upload, but looks like one.

I guess one could implement the same trick using Dojo with a little effort.

Re:How bout something relevant... (4, Interesting)

eddy_crim (216272) | more than 5 years ago | (#25471209)

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.

Re:How bout something relevant... (0)

Anonymous Coward | more than 5 years ago | (#25471463)

hear hear, actually.

Re:How bout something relevant... (5, Interesting)

rufus t firefly (35399) | more than 5 years ago | (#25471531)

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.

Re:How bout something relevant... (5, Interesting)

djbckr (673156) | more than 5 years ago | (#25472029)

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.

Re:How bout something relevant... (2, Interesting)

rufus t firefly (35399) | more than 5 years ago | (#25472333)

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

Re:How bout something relevant... (1)

MemoryDragon (544441) | more than 5 years ago | (#25479605)

Tje dojo library bloat is not that big. Dojo core is compressed around 50kbyte (compressed means just junk stripped, you get more if you go for real compression but that would cost initialization time)
The full dijit widget set is 200 kbyte, not that much considering it covers around 30-40 components!
And if you need just a subset you can roll your own custom builds and uses dynamic code loading if you miss something.
Also have in mind that if you roll your own custom build the browser cache can trigger so all this is loaded only once!

Re:How bout something relevant... (1)

rufus t firefly (35399) | more than 5 years ago | (#25480573)

Tje dojo library bloat is not that big. Dojo core is compressed around 50kbyte (compressed means just junk stripped, you get more if you go for real compression but that would cost initialization time) The full dijit widget set is 200 kbyte, not that much considering it covers around 30-40 components! And if you need just a subset you can roll your own custom builds and uses dynamic code loading if you miss something. Also have in mind that if you roll your own custom build the browser cache can trigger so all this is loaded only once!

The point is that a lot of it is duplication, since a great deal of that functionality is already covered by GWT, and all of the dojo "boilerplate" is reproduced. For example, none of the RPC stuff is used, since GWT favors its own implementation over dojo.io.bind() or its descendants. Pure GWT is faster than GWT + Dojo, but I'm not sure by exactly how much.

Re:How bout something relevant... (1)

MemoryDragon (544441) | more than 5 years ago | (#25482593)

Problem starts if you do not want to use java or GWT... ;-)

Re:How bout something relevant... (1)

rufus t firefly (35399) | more than 5 years ago | (#25483477)

Problem starts if you do not want to use java or GWT... ;-)

It's definitely a different approach to creating web-based applications. Far more programmatic and structured than straight up Javascript toolkits. Looking at it purely with regard to maintainability and forward porting, GWT leaves just about everything else in the dust. The downside is you have to like to code everything in Java. In the end, it's all about personal preference.

GWT and jQuery (1)

jDeepbeep (913892) | more than 5 years ago | (#25474849)

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?

Re:GWT and jQuery (2, Informative)

Nathanbp (599369) | more than 5 years ago | (#25484203)

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.

Re:How bout something relevant... (1)

MemoryDragon (544441) | more than 5 years ago | (#25479601)

Well GWT is bound to java and generates the code on the fly, for many this is a big reason not to touch it. I never used it adittably since my work is in another domain. But talking to a guy who extensively used it basically just resulted in a confirmation of what I suspected. He said, GWT is excellent as long as you use just what GWT provides the problems begin once you have to dig into the core of the generated javascript code and if you try to alter that one. This is machine generated code and not very readable not very touchable from the outside.

But comparing Dojo and other toolkits which are pure javascript to a solution like GWT, is comparing apples and oranges. Dojo is javascript only and never will leave that domain and for that it does currently the best job of all libraries out there!
GWT is javascript generated code from java classes. So go figure how inappropriate the comparison is in reality!

Re:How bout something relevant... (1)

zuperduperman (1206922) | more than 5 years ago | (#25476175)

I had a similar problem. For about a year you had to choose between Dojo 0.4 - 0.6 which had some very poor documentation but which were obsoleted by massive breaking API changes coming in 1.0. But 1.0 had no documentation and was nearly impossible to decipher and use. So there was simply no good version of dojo to use at all. Add to that the fact that the default dojo theme just looked amateur and ugly - it was a non-starter for us.

We moved to YUI which is like entering a different universe to dojo - hundreds of pages of documentation, great looking default theme, examples, entire videos on how to use it. No regrets.

look at you hacker... (2, Funny)

rarel (697734) | more than 5 years ago | (#25470863)

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

Re:look at you hacker... (1)

Delkster (820935) | more than 5 years ago | (#25470917)

Don't worry -- it's not 2072 yet.

"Story" tag (0)

Anonymous Coward | more than 5 years ago | (#25470949)

Some annoying wanker keeps tagging everything "Story", even if it's not a "Story". Please stop doing this.

Department Of Justice?!? (0, Offtopic)

supernova_hq (1014429) | more than 5 years ago | (#25470979)

Anyone else read that as "DOJ: Using the DOJ JavaScript Library"?

Re:Department Of Justice?!? (1)

MillionthMonkey (240664) | more than 5 years ago | (#25477695)

Yeah the DOJ JavaScript Library continually sends AJAX requests to the FBI and the NSA in the background while your page is open.

I prefer Mojo over Dojo (1)

zukinux (1094199) | more than 5 years ago | (#25471101)

since, if you got any mojo, you can get some girls (ask Austin Powers if you don't believe me). if you got some dojo, you cannot get anything?!

vs. Scriptaculous? (1)

blackfrancis75 (911664) | more than 5 years ago | (#25471283)

I'd like to take this opportunity to start a holy war between Dojo and Scriptaculous/Prototype. Aw hell, why not throw in Ext too.
Wait, I'll get some popcorn.. OK - Go!

Re:vs. Scriptaculous? (1)

TheCycoONE (913189) | more than 5 years ago | (#25474043)

Perhaps I'm wrong, but it seems to me there isn't much of a holy war going on in the JavaScript framework world. At least not nearly to the same extent as Linux vs. Win vs. Mac, Emacs vs. Vi, Python vs. Perl. If I were to hazard a guess, I'd say these other holy wars exist where tools in the same domain space are are developed with radically different philosophies, whereas most/all JavaScript frameworks have more or less the same philosophy - it's just how far they take it and exactly what methodology they used to accomplish it. Some of them are even built on each other eg. Ext on YUI, Rico on Prototype, etc.

Relevance? (1, Insightful)

Anonymous Coward | more than 5 years ago | (#25471313)

Is Dojo even relevant anymore now that Microsoft has embraced jQuery?

Re:Relevance? (1)

trouser (149900) | more than 5 years ago | (#25475543)

Is Microsoft even relevant anymore now that Vista?

I recently bought 2 other related books (3, Interesting)

MarkWatson (189759) | more than 5 years ago | (#25471315)

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.

Re:I recently bought 2 other related books (0)

Anonymous Coward | more than 5 years ago | (#25472763)

You just wait until "Javascriptn The Bad Parts" is out...

Recently looked at Dojo, but chose jQuery (2, Interesting)

gbrayut (715117) | more than 5 years ago | (#25471859)

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 [jquery.com] . 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.

Re:Recently looked at Dojo, but chose jQuery (1)

Sancho (17056) | more than 5 years ago | (#25473593)

That's a ditto moment. It sounds exactly like where I was about 2 months ago.

I consider a framework essential for DOM traversal these days. If you want to run in multiple browsers, you'll either be writing one yourself or using one that's pre-written. There are a lot of really good frameworks out there, but I picked jQuery for the exact same reasons you did--it's no-nonsense, low-cruft, and highly extensible. Highly recommended.

Re:Recently looked at Dojo, but chose jQuery (0)

Anonymous Coward | more than 5 years ago | (#25476987)

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.

What plug-in did you use, and what were your experiences with it? Thanks in advance.

- T

Learning curve (1)

dino213b (949816) | more than 5 years ago | (#25472475)

Being a practical type, I must confess that the learning curve with Dojo has been rather steep; having said that, once you get over the first major hump - it's literally all downhill from there. But, I'm not defending Dojo. Instead, I'm complimenting the book.

This book appears to solve the learning curve problem by starting with a practical tutorial and then going into guts.

IMO, the biggest problem with Dojo's userbase growth has been that Dojo seems to be both large and small at the same exact time, making it difficult to get oriented. One thing that developers should keep in mind is that Dojo is very scalable; performing a custom build will whittle it down from its 37+ MB source distribution (yes, graphics included) to however low you need it (in my case, couple of hundred kilobytes - smaller than some logo images out there).

In my case, I've completely embraced Dojo as a reliable way to quickly produce backend systems with it - and - more recently - front ends.

But that's just work. As for fun - without Dojo, I don't think that I would have put my open source project together or released it to the public. There are so many hours in a day and I don't have time to reinvent the wheel; Dojo was there for me.

For some amusing interaction between Dojo and PHP (not using the Zend framework..), see the videos / screenshots from http://eval2.sourceforge.net/ [sourceforge.net]

How the heck did you do a "backend" in Dojo? (1)

HighOrbit (631451) | more than 5 years ago | (#25472695)

I've completely embraced Dojo as a reliable way to quickly produce backend systems with it - and - more recently - front ends.

Producing a 'backend' system with a JS library must be a neat trick, since JS is client side. However, I totally agree with you about the learning curve. I couldn't make heads-or-tails of the code.

Re:How the heck did you do a "backend" in Dojo? (1)

dino213b (949816) | more than 5 years ago | (#25472891)

Apparently you can't make heads-or-tails of terminology either. You're thinking strict code execution, while I'm thinking conceptual division. In this case, I thought it was pretty obvious that I was referring to a CMS; I'll be sure to spell things out clearly next time.

And- just for the record, neat trick indeed. JavaScript can be and is executed server-side as well as client-side. The Dojo release build system works like that. See http://www.mozilla.org/rhino/ [mozilla.org]

Re:How the heck did you do a "backend" in Dojo? (1)

Sancho (17056) | more than 5 years ago | (#25473657)

JS is client side

http://en.wikipedia.org/wiki/Server-side_JavaScript [wikipedia.org]

Just 'cause it's fun pointing out the mistakes of others, you know?

Re:Learning curve (1)

MemoryDragon (544441) | more than 5 years ago | (#25479621)

I fully agree here, the learning curve is really steep because dojo is so extensive. It is basically to javascript what the java runtime is to java. It is a complete coverage of the entire domain of what you need in third party libs.

Also I think the learning curve used to be much steeper in the past, thanks to three excellent books (I prefer the one from pragmatic programmers though) and to the improved manuals online, which unfortunately really have a load of black holes in there!

As for the build size, I dont think this is an issue. If you run custom builds you can get the thing down to sizes between 50-500kbyte no matter how big the source distribution is (have in mind the source distro has several skins, a huge load of unit tests, demos etc...) which you all remove in a custom build.

Sure it takes time to invest learning it, but what you get from it is impressive!

Dojo is complex for complexity's sake (2, Interesting)

HighOrbit (631451) | more than 5 years ago | (#25472529)

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.com] . 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 [brainjar.com] and as a plus it won't screw with your mind like Dojo.

Re:Dojo is complex for complexity's sake (1)

LDoggg_ (659725) | more than 5 years ago | (#25473525)

Couldn't disagree more.

Don't think of dojo as just a collection of scripts for widgets or animations like in scriptaculous.

Dojo is a HUGE library that gives you the ability to pick bits and pieces where they might be helpful and in a way that hides some of the uglier browser-specific things that you don't want to deal with.

For example, using connect() to add an onclick to a DOM element will put some sanity to attributes of the mousevent object that gets passed.
Sure I could write a bunch of code to get around the browser differences myself, but it's pointless when there's a free library like this to do it for me.

Comparison to YUI? (1)

eison (56778) | more than 5 years ago | (#25472727)

How does Dojo compare to Yahoo UI (YUI)?

Re:Comparison to YUI? (2, Interesting)

zuperduperman (1206922) | more than 5 years ago | (#25476299)

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.

Re:Comparison to YUI? (1)

MemoryDragon (544441) | more than 5 years ago | (#25479645)

Btw. if you need examples and documentation on dojo there probably is no better site than

dojocampus.org

I am way happier with this site than with the original dojo documentation!

Re:Comparison to YUI? (1)

MemoryDragon (544441) | more than 5 years ago | (#25479635)

YUI has mainly the objective to cover widgets, it is comparable to the Dojo dijit widget set!
The code itself and how the class files are done how the widgets are initialized are pretty similar. YUI however has the better documentation.

While dojos has improved it is necessary to get one of the tree dojo books to really grasp everything correctly.

In the end I still would choose dojo over YUI due to the fact that dojo is so much more. Around 90% of my work in javascript definitely I just use the dojo core 10% are the widgets and YUI is more widget centered!

So it depends on your needs, but I think you can even mix both, I have not seen anything in YUI which would prevent it to be mixed with other libs (unlike Prototype which is the high school bully of all javascript libraries)

stoolpigeon = Jim Harmon (0)

Anonymous Coward | more than 5 years ago | (#25475551)

stoolpigeon = Jim Harmon

Hello Jim,
Enjoying free publicity?

Why JavaScript at all? (0)

Anonymous Coward | more than 5 years ago | (#25476085)

I still don't understand why anyone would want to use JavaScript for web front-end development. It's just insane.

And I think I should point out that I'm not saying this because I dislike JavaScript as a language or do not have enough experience with it to know what I'm doing. As a scripting language, I like it and have used it on the server side in a few instances where we needed the ability to dynamically run code on the server without re-deploying our application. And I'm part of a team that was tasked with re-writing our entire application as a "Web 2.0" (I hate that term) application.

So lest anyone think I'm just trying to say something inflammatory, my comments come from 2 years of hands-on daily usage of JavaScript and I even understand what is involved in writing a JavaScript framework that will perform in all of our target browsers (IE6+,FF2+,Safari2+).

Because at the time (roughly 2 years ago) when we set out to re-write our application, none of the available JavaScript-only libraries performed up to our needs...it seems that none of them make performance a priority. Sure most of them allow you to quickly make simple pages that are pretty to look at, but once you get to something moderately complex, the page gets unacceptably slow in at least one browser (almost always IE6, but rarely the other browsers get in on the act too). They all pretty much fall prey to one of the many "gotchas" when it comes to JavaScript (excessive object creation, excessive DOM traversal, etc).

So we ended up rolling our own. It wasn't the kind of thing that could be released publicly since it relies almost entirely on convention rather than strict APIs, but with a lot of work we were able to get it to perform the way we need it to. Along the way, we've written approximately 3000-4000 jsunit tests, so that should give a pretty good picture of the combined size of the framework and application.

And yet even with this accomplished, it still took an excess amount of time to develop front-end functionality and there were still a ton of bugs in the UI (mostly in IE6) that we couldn't seem to catch with automated testing. And that burden on QA was eating all their time preventing them from having the time necessary to test back-end logic in a comprehensive fashion.

So about 3 months ago we determined to do another evaluation of the JavaScript libraries available. And once again, none of the pure-JavaScript libraries was up to handling our test page (not our most complex, but close to it).

But what we did find was that GWT has evolved to the point where we can use it and, simply put, it smokes even our own framework when it comes to performance. We had dismissed it immediately when we did our original evaluation since it made it too difficult to embed it into existing pages, but that's no longer the case. It allows us to leverage our Java expertise, since we write our back-end in Java. It allows us to write our unit tests for the front-end in JUnit and run them along side our back-end tests in our continuous integration setup. We've cludged together a means of doing the same for JSUnit, but it requires individual "worker" machines that run the tests on each browser, which makes the tests take forever to run. As we replace all our JSUnit tests with JUnit tests, the time necessary to do a continuous integration build is steadily decreasing, and faster build times lead to less time when the build is unstable.

So now we're developing all new pages in GWT and slowly replacing existing pages. And while there still are bugs in the UI, the defect rate in our GWT-based pages is at least an order of magnitude less than we had using JavaScript. And when we do get bugs, they get fixed faster since hosted mode gives us a real debugging environment.

And it's this experience with GWT contrasted with the experience both writing/using our own framework and doing a ton of test pages with the various frameworks that leads me to the original question...Why would anyone want to use JavaScript anymore? With all the advantages that GWT gives without any real down side, why would anyone subject themselves to the pain of developing in JavaScript?

No. (0)

moniker127 (1290002) | more than 5 years ago | (#25476911)

Honestly, fuck dojo. Javascript does not need libraries. Old people get their hands on every language and try to make it more complicated that it needs to be / is.

Re:No. (0)

Anonymous Coward | more than 5 years ago | (#25477331)

Old people? WTF are you talking about?

I've met a few of the contributors and I doubt there's anyone over 40 in the group. And even if there was, what does that have to do with anything?

If you've ever written anything more complex than "hello world", you'd know that libraries make things less complex.
Re-inventing the wheel is complicated and usually a waste of time. Reusing a tested piece of code is easy.

Dojo is UN-documented (1)

scurvyj (1158787) | more than 5 years ago | (#25477615)

Ok something that must be said here that seems to have been overlooked. Dojo is actually unusable - and yes I mean that perfectly seriously - unless you have somebody around who already has experience with it. It is completely undocumented - the documentation that exists is sketchy and often wrong. No just listing the class method parameters automagically is not sufficient. My workplace has just ditched Dojo and is investigating JQuery - with some success thus far - purely on this basis: Dojo is unmaintainable and very slow to work with because of the complete failure to document it and provide good examples. Its a pity because some of the Dojo widgets are very cute and work very well - if you can ever figure out how to use them. I'm sure this book will help enormously - but I regard it....no, it has to be regarded - as a vast looming FAIL that a book is *required* to use a library, particularly when its just a JAVASCRIPT library too. Dojo widgets are also overly-clever in some areas, eg. simple collapse trees don't exist, and this is a major letdown - shops with requirements for cleanliness and maintainability will not use the magic mojo, they will go with simplicity (eg. JQuery) instead. In summary: Dojo = FAIL for me/us, mainly for documentation reasons, and its a crying SHAME.

Re:Dojo is UN-documented (1)

MemoryDragon (544441) | more than 5 years ago | (#25479653)

For a better documentation look here

http://dojocampus.org/ [dojocampus.org]

Also buy one of the books. The documentation has becomed better however on the original site.
I really can recommend the pragmatic programmers book however to get a full grasp!

dojo seems like a neat library but... (0)

Anonymous Coward | more than 5 years ago | (#25478173)

it has a fatal flaw.

It is built around the idea of using the dojoType attribute to declare dojo wigets.

But dojo type isn't a real attribute! Modern browsers only accept it because they have to accept all sorts of garbage for html. If you are trying to serve xhtml, it will break your shits.

So, I'd say it's fatal flaw is lack of decent xhtml support. Xhtml has the concept of namespaces that should make custom elements easy... so I don't know why they've left things like this.

Re:dojo seems like a neat library but... (1)

LDoggg_ (659725) | more than 5 years ago | (#25478379)

You don't have to use those attributes. Things like djconfig on the script element is a convenience. You can still specify everything you need to in the script.

Cross-Domain Ajax (1)

cparker15 (779546) | more than 5 years ago | (#25484255)

If JSONP isn't an option for you, and you need to make use of a REST endpoint on another domain (or even subdomain), see if you can get the service provider to add Dojo's XIP [dojotoolkit.org] server files to their server.

50% ? (2, Interesting)

Tablizer (95088) | more than 5 years ago | (#25493901)

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.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>