EBlog

How I came to understand Javascript

Warning, this is a technical post. If you don't know that document.getElementById is a javascript method, skip to the next blog post. No, really.

About a year ago, I took myself to task and decided it was time to dive in to using a javascript framework. I narrowed my choices down to Prototype and jQuery from an excellent group of like-minded frameworks. At the time, my javascript level was at a point where I understood document.getElementById and changing style attributes to show and hide elements. I used window.onload. Unobtrusive meant nothing to me. I knew simple things, enough to get by.

The goal was not only to be able to use the libraries, but understand how they worked under the hood.

Taking the time to understand the libraries led me down a long path of coding best-practices, browser differences, object-oriented techniques, design patterns, and a lot more. I came away with the conclusion that libraries like Prototype and jQuery are invalulable not only for the convienence they provide, but also are an indespensible learning tool for those who want to dive in and understand the code.

When your goal is to understand how a framework works, you find you are not bound to that particular framework. In the end, I wound up opening the sourĀ­ce code to almost every library (mootools / YUI / DED|Chain / Base2) to find how this library did that and why this one implemented this a different way. Not only do you learn differing proven approaches to solving the same basic problems, but I think this is the only way to gain a real understanding of how a particular framework does its thing.

These libraries use techniques that may be foreign to many programmers coming from other languages - I found that I had to grasp these main concepts to be able to feel my way around confidently: variable scope ("this" with .call and .apply), closures, functional javascript, the prototype chain, and JSON.

In addition to the libraries, these resources were invalulable to getting my head around the language (plain ol' js AND the libraries):

and, of course: O'Reilly's Javascript the Definitive Guide (the only book the comp.lang.javascript crowd will recommend)

I cannot stress enough that understanding how these libraries work is the key to being able to use these libraries effectively, and in turn, dramatically changes how you grasp javascript as a programming language.

Welp: after writing this post I came across a link from clientside which pointed me to this article on dbug: Mastering JavaScript — concept and resource guide It's awesome and encapsulates everything stated above.

Comments

You were so passionate about this, I decided to Google getElementById to see if I could better understand what this was all about. I couldn’t agree more. It is another language.

I’m gonna add a few more resources:

Kangax’s Perfection Kills

Justin Palmer

This Ajaxian post might be helpful to some folks who find themselves trying to pick a JS framework. Choosing a Javascript Framework.

Thanks for the libaries list. Great informations here and there.

Thanks for sharing it

Post a Comment

Commenting is not available in this section entry.

Get To Know Us

You need flash.

What we are reading:

Inspiration