JavaScript Programming Style and Your Brain
Written by Ian Elliot   
Sunday, 30 October 2011

With JavaScript under heavy attack by Google, among others, this video, of a talk given by Douglas Crockford at HTML5 Dev Conference 2011, is timely and important.

 

With JavaScript under heavy attack by Google, among others, this particular video is timely and important - but perhaps not for the reasons you might expect.

It is a video from the HTML5 Dev Conference 2011 of a talk by Douglas Crockford titled "JavaScript Programming Style and Your Brain". 

After some vague philosophical musings the real core of the talk starts at about 5 minutes in with a discussion of why JavaScript has bad parts and how JSLint will help you only use the good parts. There then follows a discussion of what constitutes good style in JavaScript. In this case style isn't about aesthetics and self expression but about how to write code that isn't error prone.

The main thesis is:

"If there is a feature of a language that is sometimes problematic, and if it can be replaced by another feature that is more reliable, then always use the more reliable feature."

 If you accept this idea then the next is obvious - use JSLint to enforce those replacements.

None of the ideas are new, especially if you have read his book JavaScript the Good Parts.

Even if you don't view the whole video, watch the question and answer session at the end (about 31 mins in) for a put down of languages that compile to JavaScript, why JavaScript is great and what Crockford thinks of JSHint, the forked code quality tool.

 

          

Quite a lot of the talk is about ideas that apply to any language and you can't really argue with many of the general points. You can, however, take issue with some of the recommendations but if you do try to think about the general objectives before you make a final decision.

I have to admit that the arguments are put so persuasively I have changed my mind on using a particular construct that I had long ago decided was safe as long as you understood it.

So, at the end of the day, is JavaScript a bad language?

Its crimes appear to be a few sloppy and potentially error-prone constructs which are very easy to avoid.

 

dcrockford

 

Is this really all that is wrong with JavaScript?

The bottom line is that the problem with JavaScript is minor as long as you accept it on its own terms. On the other hand, if you really want it to be a class-based, object-oriented language with all the dangers that entails then - yes JavaScript has a real big problem. But another way of saying this is that JavaScript is not Java.

More information

JSHint - the (gentler) JavaScript code quality tool

JSLint,The JavaScript Code Quality Tool

 

To be informed about new articles on I Programmer, subscribe to the RSS feed, follow us on Twitter or Facebook or sign up for our weekly newsletter.

 

Banner


Fear And Loathing In The App Store 3 - Banned For Life
28/03/2014

Google Play is often regarded as one of the most unwalled of the walled gardens, but after reading this tale of woe you might want to think again. 



PredictionIO - The Easy Recommendation Engine
14/04/2014

One of the most common applications of AI or advanced stats, depending on how you look at it, is the recommendation engine. All too often the first impulse is to build your own - but it's tough and th [ ... ]


More News

<ASIN:0596517742>

Last Updated ( Sunday, 30 October 2011 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.