02Jul

The jQuery source code: Lessons all around

Posted by Elf Sternberg as Uncategorized

Have you ever checked out jQuery from GitHub?

I recommend that you do so.  Most of us, when exposed to jQuery, find ourselves with a 130KB mass of text or, worse, a minified, unreadable blob of text.  We have no idea what’s going on within jQuery itself.  So today, in a fit of pique (I was annoyed at an article entitled “Don’t Use Backbone Yet,” which argued that most of what you can do in Backbone you can do already in jQuery, so why bother?), I downloaded jQuery’s code to make the point that everything you did with jQuery you could by hand in Javascript– but jQuery does things right, and that’s why we use it.

While I was reading the jQuery source code as it’s broken out in the github repository, I discovered that it is really readable.  Most of it makes a lot of sense, and you can derive much knowledge and pleasure from the way the different jQuery contributors have created a unified whole out of the various component parts.

Other important learning tools: jQuery’s github repository uses node.js for assembly, git for code control, and both jshint and jqunit for catching some bugs.  Reading the package.json files, the various git control files, even the editorconfig dot-file are real eye-openers: they make for a consistent experience for all developers, and they work brilliantly.  My only complaint, now that I’ve experimented with editorconfig, is that it marks all files as having changed, even if you don’t actually change anything at all.

Comment Form

Subscribe to Feed

Categories

Calendar

July 2012
M T W T F S S
« Jun   Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
3031