Warning! JavaScript libraries are bad for you

Warning SignIf you’re a budding JavaScript coder and want to be an expert at it some day, medications heed my words and steer clear of JavaScript libraries. There are scores, if not hundreds of them out there and you’d do well to avoid them all. It isn’t because they’re ill conceived or badly coded. Rather, their use promotes laziness and subsequent stagnation (dare I say regression?) in the growth of a programmer who gives into the temptation to use them.

Granted, libraries are beneficial and some of the functionality they offer is down right invaluable (see: YUI Event Utility). But I’m of the opinion that any programmer that’s serious about their work should at one point or another have at least attempted to write the very same code found in those libraries themselves.

Think about it, what benefit is it to you as a programmer, to download a library, plug it in, and watch it do magical things for you? It might make your site look cool, but you’d benefit very little if anything at all as a programmer. You’d get much more out of the painful experience of knocking your head against the wall and trying to figure out how to do things for yourself. It’s a foregone conclusion that the best way to learn something is to get involved. Thus, to learn to be a programmer, you need to program!

Realistically though, time and budget constraints don’t always allow for the writing of programs from scratch. But that isn’t the point. The key is to take the time (your own time if need be) and learn the language for yourself. Otherwise, all you’re doing is glorified copy and pasting.

In as far as learning is concerned, I’ve come to the realization recently that learning JavaScript unguided on the internet is a very, very bad thing. It is after all, the world’s most misunderstood language. So if you’re eager to learn, I have a very important piece of advice for you. Don’t try and learn by using “view source”. The JavaScript you’ll find there was written by one or two people in 1994 and subsequently copied and pasted by everyone else on the internet, having mutated in the process. It’s bad, bad code. Don’t touch it. The best resource I can point you to is “Douglas Crockford’s JavaScript” (do yourself a huge favour and start by watching the videos listed on that page). As of this writing, Douglas Crockford is a JavaScript Architect at Yahoo!, and from what I can tell, knows about as much as any human being can possibly know about JavaScript. I can honestly say that I’ve learned more from him in a few days’ time than I have in the past two years on my own.