Flippant Pixel

jQuery makes life worth living. By comparison, YUI's AJAX tools are frustratingly neolithic. Here's how you write an AJAX call with jQuery:

$.ajax({
 type: "GET",
 url: "gimme.php",
 data: "gift=some_sugar&giver=baby"
 dataType: "script"
})

In this example, the results of gimme.php are evaluated as javascript. jQuery's ajax method is much more sophisticated than this example demonstrates, but it only gets as complicated as it absolutely has to be.

Overall, jQuery is not as thorough as Prototype, but it's much much lighter. jQuery weighs in at 20kb to Prototype's 93kb. That doesn't affect download speed much, but it does affect browser performance. And while jQuery has no indexOf function, it's clever enough to come with an iterator for both arrays and objects. Awesome!

JavaScript doesn't have an array search function, so I write my own:

function arraySearch(needle, haystack)
{
 for( var i = 0; i < haystack.length; i++ )
 {
  if( haystack[i] == needle )
  {
   return i;
  }
 }
 return -1;
}

I don't like to write the same function twice. No coder should. I would use Prototype's indexOf function, but the project I'm working on is built on YUI. I am not happy.

March 2, 2007

I’m writing this blog with Mephisto. I discovered it when I was reading up on JavaScript libraries and frameworks. You can’t research JavaScript these days without stumbling on Prototype and script.aculo.us, and you can’t do that without stumbling on developers like Tobie Langel and Thomas Fuchs, both of whom use Mephisto. These are smart people, but I think they're taking a step in the wrong direction. Let me explain why.

Mephisto will assume your entire domain. It uses CGI, mod_rewrite and absolute paths in such a way as to make it nearly impossible to run the thing from a subdirectory. It also expects you to give it three databases. Apps of this scale typically use table prefixes, allowing them to share one database with the site’s other components.

Mephisto is built on Rails, which isn’t ready for shared hosting environments. Even as I write this I’m getting intermittent Rails application failed to start properly errors. My neighbor’s blog on the same host has similar problems. When this host isn't swatting indiscriminately at our processes, it suffers from significant latency problems.

Mephisto ignores the Rails philosophy of convention over configuration. In my case, I had to make changes to .htaccess, .rb, .cgi and .fcgi files scattered over three directories to get it to work right. Even with proper documentation (which it doesn’t have) deployment requires an experienced *nix-head armed with a lot of patience.

My point is not to malign Mephisto’s developers. They made a remarkable, sophisticated and original piece of software that deserves its praise. Most of the shortcomings I mentioned are a natural part of the project’s adolescence. In the long run, I think Mephisto will be the winner over its peers WordPress and Typo. I’m not criticizing Ruby on Rails, either. Anyone who still thinks this is just a 37Signals fad is wrong.

My point is, why bother? Freeware or not, the market is losing interest in another generation of software that requires installation, configuration, and upgrade, only to be replaced by something completely different. If the market isn’t interested, the whole exercise becomes academic. Competitive software resides on its developers’ servers. Why bother with an email client when you can use Gmail or Yahoo? Why bother with iPhoto when you can use Flickr? Do you see where I’m going with this? Why bother with Mephisto when you can use Blogger? That’s what the software-as-a-service revolution is about: let the developer worry about the upgrade path. Yes, there’s a serious proliferation of internet-based accounts, but that’s a far more manageable problem than the existing paradigm of overripe software.

I stopped writing this article in Mephisto and threw it in the trash. I moved it to Blogger and went back to my old PHP host. I’m using SimplePie to pipe it through an Atom feed, which plays nicely with all the other widgets I’m making here. I don’t have to worry about upgrades. I don’t even have to worry about the host. Laziness truly is the mother of invention.