The Trouble with JavaScript

Many hard-core developers have a bone to pick with JavaScript.  “You’re not strongly typed”, they’ll say.  “You clutter up the global namespace!”  “You’re not even compiled!”, they’ll rant.  They’re right, of course.  JavaScript lacks many of the qualities of more mature, more structured languages.  I’ll even throw in a few more.  JavaScript encourages poor coding styles.  In JavaScript there are few commonly accepted guidelines for writing quality code.  With JavaScript, the only way you can tell if your code is valid is to run it.

Those people are missing the point, of course.  JavaScript is the way it is, not because it was not well-designed, or because its creators were incompetent.  JavaScript’s perceived deficiencies are the result of decisions framed by its intended purpose.

All programming languages are designed to perform a certain function or set of functions.  These intended functions serve as guidelines for times when tradeoffs have to be made.  And every language incorporates these tradeoffs into its design.

Think about this: at this very moment, millions of JavaScript programs are being transmitted around the world, loading into client computers and executing code.  And this is happening in real time, on all sorts of architectures and operating systems.  Try doing that with a .NET application – it can be done, but in nowhere near real time.

So JavaScript is fast, easily transmitted, and lightweight.  It is also extremely flexible.  Developers can do all sorts of crazy things that would be impossible using a more traditional language.

JavaScript is also evolving, and gaining in power and applicability.  In Windows 8, developers can even write native Windows apps using it.  The growing power of the web, cloud-based solutions and connected systems makes the growing case for JavaScript hard to deny.

A couple of years ago, when I was just beginning to appreciate the flexibility and  capabilities of JavaScript, I composed a tweet that summed up my feelings at the time.  And I think it has held up pretty well:

cockroach of programming languages


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s