A notch above a monkey

Sense and sensibility of javascript libraries

As mentioned in previous post, I think @media javascript panel deserves its own post and this large blob of text that follows is my take on it. You can also read PPK’s view or Paul Hammond’s transcription . I’ll be relying on them to augment my memory.

I started my programming career pretty far from web stack and it took me a while to accept that this is what I’m mostly doing. As I listened to the panelists, I was wondering if this may be the reason why I perceive things a bit differently, although I doubt it. Still, @media javascript panel raised some good questions.

Are Javascript libraries unnecessary?

It seems obvious that panelists would be disinclined to say yes, since they are the people who need them the least. I don’t use them yet either, but on the other hand I’m certain that they are needed and that I eventually will. Their proliferation is one of more obvious confirmations for this and even if some of them are pretty daft (especially those who try to twist Javascript to look and behave like some other language), it doesn’t follow that all of them are.

I don’t buy the argument that they obscure too much. I don’t see what would distinguish them from programming libraries used in other environments. You don’t use them if you don’t need to, but it also doesn’t make sense to develop a complex piece of code, if there’s an existing version out there, which was tested and debugged by many and is actively maintained.

If you hit a bug in a library, you are left with same situation as otherwise. You can report a bug and wait for the fix or dive into code yourself and try to solve it. As with open source software you’re actually better off than you’d be if you worked with closed source.

Nothing actually stops you from learning how the library works, if that’s what you want or need. It would be great if we all knew intrinsically what is happening on the computer and how the whole process of displaying a page works, but let’s face it, we don’t and there’s for all intents and purposes a huge black box underneath that sort of does what we want and we sort of understand why and how it does it. Using a well developed and documented library doesn’t change much.

I also don’t buy Simon Willison’s argument that libraries should be obsolete and that browser should be enough. Libraries happened because browsers take too much time to develop and spread and I don’t see this changing any time soon. It would be nice, if parts of todays libraries were standardized in tomorrow’s browsers, but I’m sure innovative people out there will always find stuff they’d like to do which their current environment doesn’t let them. And when that stuff can be generalized, it should be put in a library.

So what’s really wrong with libraries?

One problem is that many of them are quite large and it may take a while before they get downloaded. Even worse, downloaded versions don’t get shared when used by different websites, since they don’t come from the same network resource. However, as already said, I think circumventing this problem by simply using an installed version on some other servers (you can use Dojo installed on AOL’s server) is daft too.

Computer networks are fairly fragile and in some parts of the world even more so. It’s not a rare event when at least parts of the world are inaccessible. Do you really want to bet your success on your visitors accessibility of some resource completely away from your control?

I think caching is not a bad idea, but it needs support from browsers. The same problem could be solved by giving each library plus its version a unique fingerprint, which browsers could use to identify possible hits in their cache. The most nonhackish way of calling a script that I could come up with was:

<script type="text/javascript" src="http://some.server.on.the.net/coollib.js?jslibPrint=sdrt32svg"></script>

A different approach would be to simply include most popular Javascript libraries as a part of a browser installation. But this approach has at least two downsides. First, it would be limited to chosen few and second, which is one of my real objections to current crop of libraries out there, you’d need a fairly mature libraries.

One problem with current libraries which was pointed out is namespace collision. It is not a new problem and although some languages (Python, Java…) provide a mechanism to avoid it, others like C don’t. For me even more annoying is lack of stable APIs. It’s simply hard to rely on a library that changes interfaces too often.

But none of these problems is either new or insurmountable. I think libraries are here to stay and that’s a good thing. I prefer a web with plenty of well-done web sites than one with a handful of masterpieces swimming in a sea of crap.

And Stuart Langridge is right. Alex Russell certainly is (too?) clever.

@media 2006 is over

Q: How can you tell that you’re at tech conference?

A: The line in front of men’s toilets is longer.

@media 2006 has finished. It was great and I specially enjoyed presentations given by Nate Koechley and Andy Clarke . Those two alone made going worthwhile and if you have a chance to see any of them, don’t miss the opportunity.

The conference was much bigger this year, which is one thing I didn’t like. It was harder to find people you were looking for and even if you did find them, they were usually already occupied by somebody else. If you’re an introverted guy like me and not a natural orator, then it can be a bit difficult to make the most of the time you have. I didn’t, but I’m glad I finally met Richard , who’s an even nicer guy in real life.

A quick summary of sessions I attended:

  • Eric Meyer talked about last 10 years of CSS. An interesting talk, but for me even more important, he explained to me why margin collapsing wasn’t a daft idea.
  • I went to a design panel with Jon Hicks , Veerle Pieters and Cameron Moll , since I know a thing or two about Javascript, but I’m completely design illiterate, which this blog can only attest to. I can’t say how designers liked it, but it was certainly very educational for me. I knew I choose my colors as if I was colorblind, but I also discovered I need to learn more about grids.
  • Dave Shea gave a nice rundown of the state of web typography and pros and cons of different methods and Andy Budd entertainingly as always presented tricks and approaches to tackling browser bugs.
  • Jeffrey Veen talked about Web 2.0 and new applications and although he made quite a lot of good points, I’m not sure openness wins every time. My counter example would be instant messaging, where GTalk hasn’t changed the field much. I hope I’m wrong and this will change in the future.
  • Day two started with Dan Cederholm’s interesting presentation, where I again learned a trick or two. I especially enjoyed the way to build scalable arrows using CSS.
  • Dan’s talk was followed with Javascript panel. Personally, I think the idea of centralized hosting of Javascript libraries to improve caching doesn’t make much sense. If nothing else you bet that your visitors will also be able to access your caching sites which might not always be true. It certainly isn’t in this part of the world, where partial break-downs are not all that uncommon. Still, the panel probably deserves its own post.
  • Cameron Moll also gave a presentation on the state of mobile web design. It wasn’t bad, but I hoped for more.
  • Nate Koechley’s talk was a revelation. An incredible amount of good information and it’s been eye opening for me to learn about Yahoo’s experience. Scary that they build an internet explorer emulating layer for Yahoo Mail though (why didn’t they just drop the original code and start over?).
  • I enjoyed last year’s session with Andy Clarke, so I decided to attend this years as well and I wasn’t disappointed. I’ve been a fan of Andy’s work for quite some time now and I’m definitely buying his book when it comes out. So should you.

So, this is it. I hope to be there again next year.

First anniversary

Today is this blog’s first anniversary. I posted my first post after I came back from last year’s @media conference, which is where I’m going tomorrow. I’m sure it will be even better than last year, but I somehow don’t look forward to it. I got used to traveling with my wife and lost the lust for going solo.

In this year I wrote 176 posts (not including this one) or almost one every two days. A lot and certainly too many for them all to be worth reading. I hope at least some of them have been.

Reliable statistics are a bitch. I installed different packages at various times, each using their own approach to tracking, which produced lots of numbers of dubious quality. Still, for the interested few, this blog has been accessed by more than 12 thousand individuals at least 23 thousand times. Counting all visits including feed update checks, 116 thousand visits resulted in more than 264 thousand generated pages.

Majority of visitors didn’t come from Slovenia (only 25.8%), so it was probably not a stupid idea to write this blog in English even if my countrymen read above average number of pages per visit.

I’m completely humbled by the amount of time that was spent reading or scanning this blog, even if each visitor spent only a second on it. I hope it was worth it and that most of them don’t miss that second. I’m even more amazed that some of you liked it enough to subscribe to it.

Since summaries like this are far more fun to write than to read, I’ll end this one and make it the last. Thanks for stopping by and I hope to see you again.