Cough, AJAX

Dominic Mitchell dom at
Wed May 24 20:59:07 BST 2006

Matt S Trout wrote:
> Dominic Mitchell wrote:
>> Andy Armstrong wrote:
>>> Can anyone recommend an up to date book on dynamic web stuff with JS? 
>>> Something heavy on accurate technical detail and light on fluff would 
>>> be splendid :)
>> Seeing as nobody else has mentioned it, I personally quite like 
>> Prototype.
> Prototype is a joke - it manages to effectively prevent you from using 
> any other javascript library by intentionally polluting global 
> namespaces to the point where doing an iteration on an objects 
> properties no longer works because prototype has stuffed extra crap into 
> there to "make things easier". Consider it equivalent to stuffing 
> UNIVERSAL:: with a couple dozen extra methods - this is going to mess 
> with your ability to use can().
> The fantastic thing is that the viewpoint of the developers and a lot of 
>  the users appears to be "that doesn't matter, you should just built 
> your  other library in the prototype environment", which is clearly a 
> wonderful idea. Sigh.
> $ is even better, given it's actually noted in the standard that $ is 
> allowed as an identifier explicitly for machine generated code so it 
> doesn't collid with real user code.

Yes, Prototype is fairly invasive.  But it's still very useful.  If 
you're not designing the worlds next wonder-Ajax whizzy application and 
instead just need a small amount of help to spice up some existing 
pages, then I think it's a really good way of going about doing that.

And I don't personally care what the standard says about $() -- I find 
it to be an extremely useful shortcut.

>>  From what I've seen of dojo, prototype feels a lot more lightweight 
>> and more like a functional language.
> If you want to make javascript pretend to be something else, try 
> mochikit, which is also rather shiny.
> prototype is lightweight because it's a collection of nasty hacks and 
> convenience methods thrown together into one file with a vaguely common 
> interface and referred to as a "library". Reminds me of cgilib, kinda, 
> except that prototype actually *looks* like it might be usefully 
> subclassable until you try.

I don't deny that it's a fairly random collection of functionality.  I 
have tried subclassing bits of scriptaculous and it worked for me.  *shrug*.

> And anyway, dojo's smaller builds (the IO and Ajax ones) are also pretty 
> lightweight. They just have actual design and engineering, which of 
> course has a slight overhead. The prototype.js source makes my eyes 
> bleed more than my first attempt at grokking did, and is far far 
> less conceptually complex; dojo is actually quite pleasant to skim through.

I have to admit, I checked out dojo from svn to try and have a nose 
around.  I kind of gave up after seeing how much of it there actually 
was.  The ajaxian tutorial you linked to was slightly better at 
comprehending what's in there (but those boys really need to learn about 
making source code readable -- margins & indents matter).

>> Whatever you do, though, make sure you use a library.  No point in 
>> reinventing the wheel...
> Although in the case of prototype.js the wheel is square, spiky, can 
> only be fitted to one specific model of Reliant Robin and refuses to 
> share the road with any other brand of wheel.

Whereas Dojo is more like an 18-wheeled monster?


More information about the mailing list