4.19.2007

Javascript Libraries?

So, before I get down to the nitty gritty of implementing this functionality, I have to decide what JS libraries I'm going to use. So far I'm looking in to

  • MochiKit
    I originally wanted to use MochiKit for the sole reason that it was the javascript framework I am most familiar with and have used before. On top of that, it claims to add a lot of functional programming features to javascript that fix javascript. Furthermore it integrates a bunch of cool visual effects that I think it stole from scriptaculous that are just awesome. Although visual effects are mostly irrelevant for the functionality we need, they nevertheless sway the right side of my brain :). But just to make sure I covered my bases, I thought it would be best to look into some other frameworks as well before coming to a final decision.

  • JQuery
    Upon first glance, jquery really impressed me. With a deeper look into it though, it also really impressed me :). The CSS3 selectors are extremely powerful, and so is the concept of chaining. I really like the chaining. At first I was unsure about it's capabilities to do AJAX, which don't seem as developed as MochiKit's, which offers a cool query string generator among other things. However, I came accross Simplifying Ajax development with jQuery, which really makes it clear how easy it is to do even some advanced Ajax stuff - primarily with the $.ajax() function. I also like what appears to be the ability to just automatically pass javascript objects as JSON strings, which is a huge plus. At this point, JQuery is my top choice.

  • Prototype
    After spending 5 minutes on the Prototype web site, and not finding anything as cool as chaining, I decided to ditch Prototype in favor of JQuery. Who says you shouldn't judge a book by its cover? Ok. I looked a bit more at Prototype and it does seem to have cool stuff like chaining as well. The AJAX capabilities look pretty cool too, especially things like the periodical updater with decay. Now I just wonder whether Prototype can use the same CSS selectors as jQuery. I'll do some more research into this when I get back from class.

    It seems that Prototype can also use CSS selectors.
Conclusion: It will be a difficult choice between jQuery and Prototype. They have many similar features and I think both have everything I'd need. At this point I think I'm leaning more towards jQuery because I've been able to find a bit more documentation/tutorials on their site. Fortunately, I won't have to make an actual decision until I start working on the implementation. There is still a lot more things to think about before I get to that point.

4 comments:

Martijn Pieters said...

Heh, didn't I say prototype does chaining during our call? :)

Unknown said...

Hi Paul, what I can say about JQuery is, that they have a great and very active community where the members are also very friendly to newbies.

JQuery was also one of the first Framework wich completely passes the OpenAJAX standards.

See: http://jquery.com/blog/2007/02/21/jquery-is-openajax-compliant/

And the tests here:
http://john.jquery.com/plugins/openajax/tests/

Probably also a interesting part is, that John Resig, the author of JQuery is now working for Mozilla Corporation.

Regards, Roger Ineichen

Martijn Pieters said...

One more interesting framework: MooTools. Like jQuery, it is prototype-inspired while trying to avoid conflicts (prototype extends the default JS types, which can conflict).

Martijn Pieters said...

Check out OpenAjax as well; I am sure prototype is not conformant, Roger pointed out that jQuery is, and perhaps MooTools is too.

I think that any library that tries to be interoperable (which OpenAjax tries to ensure) is to be preferred over ones that don't.