Why Not? Rewriting jQuery and Scriptaculous in GWT

jQuery has just turned one year old and, to celebrate the matter, they have released version 1.1 to the world. Looking at the changes and improvements has me considering the situation in that other framework I've been working with of late -- GWT. GWT has a tame little DOM class behind which it hides the messy browser discrepancies; still, it looks just like the document element with its getElementById and company.

What I want is the coding style of jQuery in GWT. I'd like to be able to write something like

// $("p").after("Hello");
jQuery.S("p").after("Hello");

Now one of the first things that people did with GWT was splice in libraries like Scriptaculous via JSNI. It was easy and ladled all sorts of neat effects into a GWT-based application. Why rewrite perfectly good Javascript libraries when they could be included with such ease? Well, as it turns out, there are more than a few reasons.

  1. Writing utility and effects libraries in the GWT allow the browser specific stuff to be handled where it belongs -- in the GWT.
  2. Splicing in complicated and voluminous Javascript native code complicates testing and debugging. Rewriting the Javascript libraries in Java allows the whole sticky mess to be debugged and tested in hosted mode.
  3. The DOM class is pretty dull, just like the document element. There is a reason why libraries like Prototype and jQuery came about with their compact chained-method style. It's just a lot more efficient and snort-inducing fun to manipulate the DOM this way.

It might be a little bit difficult to really get a 1-1 port of something like jQuery, but it's certainly worth a try. If I have time this week, I will have a look at both jQuery and Prototype/Scriptaculous and see which one is the easier one to tackle.


Technorati : , , ,

Related posts:

  1. Pimp my jQuery: Five plugins to replace the features Prototype and Scriptaculous users expect
  2. JRails: Scriptaculous on top of JQuery
  3. Pure GWT – Converting Scriptaculous to GWT
  4. Why Does Scriptaculous Need Prototype?
  5. Scriptaculous: Fixing Hover After Highlight

Comments: 2 so far

  1. ..or, you can just start coding in jQuery, Dietrich! :o )

    C’mon, you know you want to, LOL! ;o)

    Comment by Rey Bango, Tuesday, January 16, 2007 @ 2:38 pm

  2. jquery definitely!

    Comment by Dave, Wednesday, June 11, 2008 @ 10:01 pm

Leave a comment

Powered by WP Hashcash

Launch: Pathfinder Newsletter

    Get a monthly update on best practices for delivering successful software.

    Subscribe via email


    Subscribe via RSS      RSS icon

Topics

Search

WordPress

Comments about this site: info@pathf.com