Die Beste Aller Zeiten

Going direct to heaven, going direct the other way

A Problem with Javascript libraries

A couple of days ago thelist – the mailing list of the evolt web developer community – had a short discussion about javascript libs (like e.g. jquery). Do they help with coding or not – i.e. do they help you to become an actual programmer or are they a simple way to do nifty stuff that you don’t actually understand?

I couldn’t contribute to the discussion, but still I’d like to mention here one of my problems with libraries. I often take over maintenance for sites that have been deserted by their original programmers, and usually when one of these web geniuses spontaneously combusts he burns with him all documentation. One of the sure signs of a web prodigy is that comments in the frontend code usually fail to tell anything useful. Instead I find little essays on why “Javascript sucks”, which is why they have used this amazing library (usually nebulous 0.1 or the promiscuous 0.0.5 pre-alpha) that allows for otherwise unsurmountable tasks like adding a rollover to an image or toggle display of a named element (and even if they used one of the better known scripting frameworks there are still at least a ten or twelve to choose from). So instead of programming in the one language javascript, which I by and by get the hang of (mostly due to Christian Heilmanns excellent book and web site) I suddenly have to look up documentation for a dozen or so libraries. And sometimes I wonder why my predecessors bothered at all to include a couple of hundred kb worth of Javascript when they then decided to rather use some method they’d concocted themself.

This is of course not an argument against libraries – I think by now it would be somewhat insane to built a Rich Interface Application without a javascript framework – but I still have to say that the purpose of libraries is often defeated at my end, when simple Javascript would be much easier to understand and maintain.

My suggestion would be not to use libs for the more mundane tasks but rather small, well documented scripts, never to include a library (or worse, multiple libraries) just because it has one effect that you particularly like and, if you can’t help to use a library then to actually use it and not replace parts of it with your own functions.

And if you are interested in Javascript your really should visit Chris Heilmanns web page wait-till-i.com (it feels a bit strange to advertise for him, since he’s some kind of web guru and I’m a goofball from Berlin, but still). While many people still look at JS as something that is slapped on top of a web page he sees it as a regular programming task, which means that the task at hand gets analyzed step by step before he starts writing code. I tried it and was amazed how much time you can save by taking the long way round.

    Previous

    Need a bit of feedback for the 1.5 module

    Next

    Dawn of the pronounced dead

    1 Comment

    1. zwetan

      completely true 🙂

      in fact those problem of so dozen libraries could be solved if instead of having a nebulous cloud of different groups writing differents libs, all people decided to unify under one standard javascript library, but well old problem die hard.

    Comments are closed.

    Powered by WordPress & Theme by Anders Norén