Douglas Crockford on coding standards

Author: Dave Cassel  |  Category: Software Development

The team I’m working recently put together a set of coding standards for our XQuery work. This team was generally happy to do so and we came to agreement on a set of standards pretty quickly. The exercise brought to mind a time at a previous company where two of us started discussing aloud whether some coding standards would be helpful for that group. One member of the team overheard us and chimed in with an emphatic: NO! It was pretty funny in a way, because in the 2+ years I worked with him, I think that was the only time I saw him get excited about something. He was a very calm kind of guy.

Anyway, as we set up our XQuery standards, we chose to rely on Douglas Crockford’s JSLint to set the standards for our JavaScript code. I found the quote below in a README file as part of JSLint and I thought it was worth sharing.

The place to express yourself in programming is in the quality of your ideas,and the efficiency of execution. The role of style is the same as in literature. A great writer doesn’t express himself by putting the spaces before his commas instead of after, or by putting extra spaces inside his parentheses. A great writer will slavishly conform to some rules of style, and that in no way constrains his power to express himself creatively. See for example William Strunk’s The Elements of Style [].

This applies to programming as well. Conforming to a consistent style improves readability, and frees you to express yourself in ways that matter. JSLint here plays the part of a stern but benevolent editor, helping you to get the style right so that you can focus your creative energy where it is most needed.

As someone who writes both code and prose, I could relate well to both aspects of what he was saying. I keep my copy of Strunk pretty close at handy.

Tags: ,

Leave a Reply