Ajax, Dojo and Domino. A Simple Demo. Oh and the Survey Results
As of early (thanks to Felix FM on the radio at 06:30!) this morning there had been 270 votes on the Which Framework Should I Focus On? survey and the results looked like this:
Not a massive number of votes cast but enough for it to be indicative of the general view and for the randomness variable to have been removed.
It's an interesting result although by no means surprising. What it doesn't tell us is how many of the Dojo votes were cast by people who have no preference for it but just think it's "the way to go" because of IBM deciding to use it. Or how many people didn't vote for YUI because Microsoft tried to by Yahoo! Politics aside though it's useful for me as it's obvious there's no interest in Mootools (which is ironic as the survey app is built on it), YUI or (to a degree) jQuery. From now on I won't use either of these three for demo purposes.
Which just leaves me to choose which one I should use. For that choice I'll narrow it down to either Dojo or Prototype (Ext, to me, whilst amazing is something different). My own preference would be Prototype as I know it fairly well already, but, like some of you it seems, I'm curious to learn Dojo — what with it being "included" in future versions of Domino.
Yesterday I put half an hour aside and knocked together a simple AJAX with Dojo demo in Domino. It turns out it wasn't half as hard as I'd thought. Not only that but I was surprised to see that it only needed the base dojo.js, which weighs in at 74kb, which is actually smaller than Prototype. I'd always imagined Dojo to be one of the heavier ones, but that must just be when using GUIs and widgets built on it. For the basic stuff it's not that much heavier than the rest.
If you looked at the demo I just pointed to you might be wondering what /apps/dext.nsf and /toolkits.nsf are. Well, the latter is a collection of all the latest toolkits in one NSF (100MB in size!) and the former is the starting point of something big. More on which later.
As for deciding which to use, I need to use Dojo some more and then make my mind up.
Mootools is a little like Opera, a -great- product that few seem to care about.
Your demo doesn't seem to work in Opera btw.. ;)
My problem with prototype is, that - at least the way I use it - it creates too much code spread. The - I think - ruby-on-rails driven class approach doesn't seem to fit very well. In that more low level category I think jQuery might be better. Also some of the widgets out there (like leightbox -> dutch version of lightbox working with divs) seems to require an older version of prototype and I have no time to upgrade the leightbox code to a newer version of prototype.
So the fact that dojo is a more managed approach with a lot of bigger vendors backing it might really pay off. Though we really can't know.
Especially for usage in Domino I would really prefer a higher level approach with all sorts of widgets and services (like i18n, which is slow). This creates more compact and better maintainable code.
regards
Axel
What is it that people don't like about MooTools? When I was first looking at js frameworks it seemed to be well documented and the examples were quick to implement. Were MooTools just late to the game? Is it limited it some way?
Maybe most importantly... is there anything like the mootools demo pages for any of the other frameworks?
Dojo is faster than mootools. Even mootool's speed test show how much faster Dojo is.
{Link}
It's a funny thing that some will vote for Dojo because of IBM's involvement, whereas I see that as a definite negative. Nothing against IBM, but the open source JS framework world moves entirely too fast for the likes of IBM/MS/etc..
Case in point, Ext-js did not even exist when IBM made its commitment to Dojo (I think it was YUI.ext but the code base has changed and the feature set has ballooned since then).
Companies like IBM/MS should not throw their hat's into the ring on any one side, but make sure they implement abstraction layers that allow for any framework to be used.
The link is hard to see in the comments above.
mootools speed check -> {Link}
Well, I'm really disappointed by the results.
Prototype is just one big hack, whose purpose is to make translation from Ruby to JS easier. That's why it's not well maintained by its creators, nor is it going to get the refactoring that it sorely needs to be a "good" stand-alone library.
Dojo, simply put, is overly complex and poorly documented. Also, when some/all of the "RIA" pieces are included, it slows to a crawl. The reason why efficiency is a non-priority to Dojo is that Alex Russell's philosophy is that hardware will eventually catch up.
As for my favorites, jQuery is by far the easiest to use. Everyone who gives it an honest shot finds that it's faster to develop in, because it just makes sense and is well-factored. And YUI, while it is complex almost to the level of Dojo (and, clearly written by programmers attuned to thinking in Java), it is the most well-documented of all the libraries. If you really need to know how to use a piece of it, there will be an example, and there will be a fully described API listing, with some explanations to go with it.
One thing that I will say, though, is that over the past two years or so, the libraries have borrowed ideas from one another, and have prompted their maintainers to fill in each other's gaps through friendly competition. For example: If it wasn't for jQuery having the first great element selector, the other libraries wouldn't have written their own good ones. Now, they're comparing the relative speeds of their selection engines - but they all have one, including Ext.
Perhaps I should try putting together demos of things using the libraries that you're "throwing away". If I ever get the time... :)
I voted for Dojo over Prototype for various reasons.
1. Dojo will be used in Domino by IBM.
2. Dojo is being used heavily in IBM Websphere Portal. Most of our clients (>65%) are using websphere Portal along with Domino and there is lots of integration involved between two.
I once sent what I thought was a perfectly reasonable request to the Prototype team: put semicolons and curly braces where they belong. Their response? "We don't wanna." Prototype is absolutely littered with places where removal of a single carriage return (much less regex-based compression) can break your entire application. I was a big fan of Prototype back when I knew nothing about JavaScript, but once I started exploring the other frameworks, I realized that it had taught me some bad habits that I then had to unlearn.
I think Dojo is overly bloated, but at least if you're mimicking their source to write your own code, at a minimum you'll be picking up good syntactical habits, as well as a few other good practices to follow. Ext is even more noticeable in that regard. And their documentation is stellar.
Jeff's dead on: there should have been an abstraction layer to allow any framework to be catered to in the markup Domino renders. And as of 8.5, there will be: the JSF render kit. We'll be able to rewrite the layer where Domino actually turns backend objects into markup. I suspect that'll be a beast of a task, but early next year (if not sooner), I imagine you'll start seeing custom render kits that cater to Ext, YUI, "Protaculous", even Mootools.
My advice is to become intimately familiar with Dojo so that you can take advantage of what will be included out of the box in Domino later this year, but explore what other frameworks (Ext is my favorite) will allow you to do if you continue to "roll your own", whether that be in existing Domino versions or utilizing custom render kits when those are available.
We use MooTools on IdeaJam and it was a perfect match for the features and functionality we need. It's lightweight and very easy to use with Domino.
I've found that performing an AJAX GET with Dojo is fairly simple, but I have yet to get it to properly do a POST. I ended up just using my own AJAX library.
Personally, I prefer a little framework I found called DOMAssistant by Robert Nyman. I've used it in some pretty functional apps and find it pretty easy and powerful. It is not nearly as full-featured as some of these other frameworks, but it does the job.
{Link}
Keith
Is there *any* way to use Dojo, without adding invalid html to your site?
I see a lot of dojo attributes in the examples:
* djConfig
* dojoAttachPoint
* dojoType
* iconClass
* jsId
* optionsTitle
* region
* url
* widgetClass
and the list goes on ... :-(
I hope the decision to use Dojo is not a sign, that valid html is not a design objective for Domino.
@Jake - Keep up the good work!
I'm currently using Ext but I voted for Dojo for many reasons:
1) All our Non-IBM platform Java applications are using Dojo because it is integrated with DWR.
2) Of course IBM's support
3) If we can develop application with dojo, it will be a lot less work to integrate from end (portal environment) with both domino and java application. I mean dojo grid is same with java apps or domino data...
Thanks for survey Jake...keep up the good work
Cheers!
Gurmeet
Don't know if this is related - wanted to know if any of you guys had experience of web based gantt / resource management widgets / applications - something that can be plugged into a basic Domino application.
Ideally looking for some sort of javascript widget / applet or such like that is fairly simple in nature...
Thanks again
Chris
@Chris
I first started my ajax apps on mootools way back in the day. Yeah, their documentation was good -- and it changed with seemingly every release. I quickly got tired of re-writing whole scripts, and move to Ext by way of jQuery!
The problem with Dojo is that in some cases what you are actually having to download is huge, it's tries to be all things to everyone. The same goes for EXT, 5.9MB! This is why we use jQuery - 22Kb. No contest.