Javascript Makes Me Giddy

I must be a simple man, ‘cuz things like this in Javascript make me slap my sides, and go Hot damn!



		function Context(base) {
			if (base) {
				var c = function(base) {
					this.base = base;
				}
				c.prototype = base;
				return new c(base);
			}
			return new function() {
				// standard context functions
				this.get = function() {};
				// ...
			}
		}

		// then
		var a = Context();
		// do things with "a"
		var b = Context(a);
		// "b" inherits "a" as context:
		// * changes to "a" make it to "b"
		// * changes to "b" don't make it to "a"
		var c = Context(b);
		// you get the picture ...

I don’t know what’s more exciting here, the “no-much-to-it-ness” or the “bang-for-buck-ness”, but every time I get to work with Javascript, I am excited about the actual process of crafting code.

ECMAScript 4 on the Server

Let’s imagine there is a viable, publicly available ECMAScript4 (that’s Javascript 2.0, y’all) implementation that runs on the server (is there, by the way?), that can be used instead of Ruby, Python, PHP, C# etc. Wouldn’t it be great?

My first reaction is yes!. Actually more like you betcha, my goatee-chinned, mojito-drinking, flip-flop-wearing blog-buddy (that’s how I imagine you, anyway), as there would be one less language to learn for the developer.

But then, I am wondering if the developers would be more prone to get their wires crossed, switching from client to server context inside of the same language?

What do you think? Is less more in this particular case? Is having a separate language for the server side the right thing to do?

Send your answers with a self-addressed and stamped envelope. Or you can just use comments. Or your blog. Or Twitter. Or Facebook. Or Pownce. Whatever. Sheesh, this social networking thing is a full-time job.

Client-side Performance Tip

I wanted to mention this for a while, but only now found a bit of time. This is very important.

When a page loads, it first processes all child elements in the head element of the page. Until all child elements are processed, no rendering of the page will occur. So, first important bit of information is: the page won’t start showing anything until all script and link elements in its head are requested and loaded.

Conforming to RFC2616, all user agents (including Firefox, IE, Opera, and Safari) will only make 2 HTTP requests at a time to load all external assets for the page. Which means that this is not a parallel operation, and regardless of how fast the server is, the visible performance of the page will suffer if there are lots of scripts and links declared in the head element of the page. So, the performance tip is: at all costs, minimize the number of items in the head element of the page.

Goodbye, Subtext

They say: all good things must come to an end. What a load of crap! It’s like saying: only bad things last forever. Perhaps a more accurate statement would be: some good things occasionally come to an end. But that’s a heckuva lot less dramatic and you know us, humans — we love drama. But I digress…

One of these “some good things” is my membership in the Subtext, the open-source project masterminded by hacker extraordinaire Phil back in 2005. The little grey submarine that could grew nicely since then into a complete blogging platform with a rowdy gang of devout followers.

I was one of the original members of the project and even somewhat contributed to it early in the game. For the last year or so, I’ve been a bit more of a wall flower, kind of like one of ’em famous folks in on a board of directors who never show up and when they do, they desperately try to evade death of boredom by picking on their teeth or playing wastebasketball. Except, y’all know I am not famous. Especially not for the stuff that would get me a seat on a board of directors. That’s because Phil was too kind to strike me out of the roster. You are too kind, Phil. You are too kind.

Luckily, over this weekend I had made the final step that gives Phil and the Subtext team a superb reason for giving me the eviction notice: I am no longer running this site on Subtext. Not even a pre-beta 1.0 Nautilus. Yessiree-bob, this site is now powered by the Estrada Engine, the latest and greatest product offering of the company at which yours truly works. I was talking about converting three years ago (that’s before Subtext!), but only now got a chance to catch up and do the move.

Don’t take me wrong. I love Subtext. I think this blogging engine, rooted in Scott Watermasysk’s creation is a great choice for individual or small-group blogging on a great platform. But the boy’s gotta eat his own dogfood. If you write the code, you have to enjoy (or suffer) using it. So here I am, sitting on unpacked boxes in a new empty virtual house, walls unpainted and all. It’ll be good. Just needs a little lovin’.

BarCampAustin

I am sitting here at BarCampAustin, the precursor to the SXSW 2007 conference. This one is really a bar camp. It’s at Bourbon Rocks bar, and the atmosphere follows suit. There is actually a bartender behind us, and even a bouncer at the door.

At around 7:00pm, I will be talking about UAB in Antartica, the project I mentioned here before. This is the next generation (can I say Antarctica 2.0?). If any of you remember my little schpiel about not building your own networking site at the NetSquared conference last year? Well, here it is, in action.

Antarctica.uab.edu is an educational outreach project by the University of Alabama at Birmingham (UAB): a blog by a group of university scientists who are currently on the ice in Antarctica. Technology allows to tightly intertwine the blog with Flickr via 3 groups: public, crew, and classroom. The tagspace is shared between these Flickr groups and the blog (try clicking on the crew members names and tags in the right column), providing an impression that both Flickr pics and posts are in the same information stream. Also, bloggers can associate specific pics with posts with a simple tagging technique. When a picture is posted on Flickr, it’s linked back to the site, to provide to and fro traffic connection.

There is quite a bit of interesting technical stuff in this site, from nifty fixed-flexible window sizing to HTML text trimmer, from improved AHAH technique to using semantic markup to query Flickr API. I am going to go ahead and commit to talking about each aspect in a separate post, but at BarCamp I will concentrate on the XHTML Flickr API queries.

So if you have 30 minutes of free time this evening (that’s March 10, 2007), please stop by Bourbon Rocks on the 6th street and say hi.

Clairvoyant Software Engineering

While ripping out old code and refactoring late last night, I muttered out something that I just had to write down: one of the most profound skills of a software engineer is the ability to foresee the moment when the negative consequences of implementing a feature outweigh its benefits. Quickly. Perhaps, that’s why the 37signals folks came up with their “It just doesn’t matter” mantra. Obviously, the other important skill is the ability to communicate and argue the point. Perhaps, that’s why all too often, software engineering fails massively on a larger scale.

Attention Google: License ActiveSync!

If any of the Googlers-in-charge are listening, here’s my pure-gold tip of the day:

Buy a license of Microsoft Exchange ActiveSync Protocol.

With the rapid adoption of this protocol as de-facto standard for mobile email client synchronization and proliferation of Windows Mobile devices, it’s a no-brainer.

I bet it will take a couple of nights for 2 of your over-caffeinated server gurus to hack together GMail and Google Calendar support for this, making it possible to sync any ActiveSync-enabled client with your server data.

And then you will offer an ever-too-tempting alternative to the business users who have to stick with the Microsoft Exchange at this time, giving sad, longing looks to your cool email and calendaring suite.

Tags: , , , .