Javascript, AJAX, Controls and Libraries, Oh My.

While looking around the net today for a specific control, it's amazing the number of javascript do-everything libraries that are out there. From mochikit and scriptaculous, to Yahoo.UI and Google's offering, to various ajax libraries like Microsoft's AJAX.NET, AJAX.NET Pro (the non-MS offering), and many many others, the number of choices is amazing. It seems they all have thier shortcomings, but that doesn't stop the devs on these projects to continue their broad scope.

What I came across that was a bit unusual was a framework that relies on a compiler that runs at serve time. Called Jitsu, it's yet another UI, animation, data binder, and AJAX library. The site looks pretty stale (circa 2006), but the approach was interesting because it was different.

Posted on 10/26/2008 4:26:00 PM by Jason Nadal

Permalink | Comments |

Categories: development | javaScript

Tags: , ,

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Javascript, Booleans, and Implicit/Explicit Casting Performance

Ahh the variant. It provides so much ease in writing code, and yet can cause so many headaches. In Javascript, I learned today what joys and pains of assumption of datatypes through boolean expressions can provide. Take the following simple statement:

var x=true;
var y=false;
if (x || y)
  alert('true');

In this case, x is ORed with y, resulting in an obvious true. But we're assuming boolean values. What happens when one has the possibility of not being boolean?

So the creators of javascript saw in their wisdom to add strong-ish typed declarations. You can declare a boolean explicitly, like so:

var isInAGoodState = new Boolean(true);

So all is happy and we can use good booleans. However, there's also an implicit declaration that's much better in terms of performance:

var isInAGoodState = !!(sourceValue);

Essentially saying not-not-sourceValue, using a double negative, results in a true statement. The amazing thing here is just the scale of the performance gain. From a source example, "Overall, the performance gain for using implicit conversion averaged out to 53% across browsers after 10 tests"

Posted on 10/23/2008 7:16:00 PM by Jason Nadal

Permalink | Comments |

Categories: development | javaScript

Tags: ,

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5