Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Supercharge your skills with expert-authored tech & creative training. Unlimited. Online. Get it now →
December 6, 2009

The expert Javascript programmer


I spent the weekend reading Douglas Crockford’s essays on Javascript. He was an independent advocate for Javascript back when most programmers hated it. He was responsible for making JSON a standard for data interchange, even between completely different languages.

There are some classic essays in there and it only took a few hours to read all the articles on the front page. You can forgo the 90’s web design style by using the Readability bookmarklet either on the desktop or mobile1.

I use style: novel, size: large, margin: narrow.

Readability bookmarklet example

If you don’t use Javascript, you’ll learn some valuable lessons from a skilled programmer and tech visionary. If you do use Javascript, you’ll learn a lot about how an enthusiast uses the features and shortcomings of the language to their best effect.

His opinionated decisiveness and surly delivery produce some real chestnuts.

Avoid conventions that demonstrate a lack of competence.

It helps to periodically remind oneself of these clear truths.

At least one other clear truth emerged while reading. It surprised me that many of his style recommendations were precautions against elementary programming mistakes. For example, he recommends that Javascript programmers always use brackets with an if statement even if the body consists of only a single statement.

// Possible error
if (a === b)
  c = d;
  e = f;

// Recommended
if (a === b) {
  c = d;
e = f;

I don’t think I’ve ever accidentally misused a one-line if statement. A grizzled verteran like Crockford would certainly never make that mistake either.

Even a perfect program has bugs.

My epiphany was recognizing the contrast between two ways of approaching a programming session. One says “I’m experienced and I can trust myself to write flawless code.” The other says “I’m likely to make a mistake at some point and will take precautions against errors.”

Novices in many fields look at experts and rightly observe that experts don’t use the same training wheels that novices do. The (erroneous) conclusion is that experts don’t need any.

But in reality, experts often use more aids than novices. The skilled craftsman doesn’t see these as insults to one’s intelligence but as a tool for achieving perfection.

Skilled woodworkers build a jig before cutting a piece of wood.

Graphic designers start a layout by drawing a grid to contain the contents.

Professional vert skateboarders wear helmets.

And experienced programmers adopt habits that guard against elementary errors.

1 Unfortunately, the Readability bookmarklet also changes the spacing on some code samples in the essays.

About the Author

is VP of Open Source at Pluralsight. He previously founded PeepCode and is an all around entrepreneur, developer, designer, teacher and athlete. Follow him on Twitter at @topfunky.