I’ve become a Facebook user. Caused by many of my dancing friends and lots of collegues from university being there: Facebook is a convenient and easy way to keep some contact with all those people that aren’t like your core friends, but still friends, and that are all around the world.

I’ve also toyed around with the Facebook API, and actually written two small applications for it. From a technical point of view, I’m actually quite impressed by Facebook.

Yes, Facebook seems to have quite some load trouble these days. Sometimes it’s very slow. Sometimes it just malfunctions (with being kicked out and having to re-login being just the least). These days, messages were distorted every now and then, some app messages were always missing the last few words.

What seriously does impress me is the architecture they use with third party applications. It’s designed around cachability (so profile pages aren’t slowed down by slow or broken third party applications) and they do jump some hoops to allow application writers do a lot of things while preventing them to disturb other applications or the core functionality.

For all I know, Facebook is the first major thing to do CSS and JavaScript rewriting. Data produced by third party applications is fed through a very smart parser and rewriter that allows an impressively large subset of CSS and JavaScript to be used without the developers having to pay attention to not producing conflicts. In CSS, rules are prefixed with a selector to restrict them to their applications scope. In JavaScript, object references are uniquified, and the convenience functions you have for interacting and accessing nodes (including functions to do common things such as modify CSS class assignments) take care of all that. Access to the raw JavaScript methods is filtered, so you can’t e.g. use parentNode to get access to objects outside of your scope. At least in theory.

Much of this is for the benefit of users: applications are not allowed to do annoying animations unless the user has just interacted with them; apps also can’t modify or disturb others, or read data from other applications via DOM.

Well, of course there might be one or another security issue still there; some of these things might also be related to the performance issues of Facebook recently. And of course there are bugs. Lots. A couple of things still need to be thought through properly (e.g. aggregation of feed messages with multiple targets, localization functionality for applications, finer grained control of data access). But their CSS and JavaScript rewriting is really cool.