Friday, February 22, 2013

Is JavaScript's ubiquity a bad thing for Node?

There's no doubt about it, JavaScript is as close to a universal language as one can get, at least in terms of developers with passing knowledge about it.  Regardless of server-side language preference, virtually all web developers know some level of JavaScript.  Unfortunately, most only have a very basic level of JS ability, instead using jQuery or the like.

The truth is, it's pretty easy to write bad code in JavaScript.  Consider the following:

          a = $("*").find("*").find("#myDiv")
              alert("U CLIKD")
Ouch.  Two document.ready, horrid abuse of jQuery's universal selector and not a semicolon in sight.  I don't know what's worse, the code itself or the fact that it'll work on every major browser.  The web's been incredibly forgiving to programming mistakes and it's showing.

This isn't a rant about terrible software.  Instead, let's talk about one of my favorite technologies: Node.js.  One of the biggest advantages that Node brings to the table is the ability to use one language across the board in your project, but Node is a lot less forgiving of poor code.  The big question is this: will the use of JS for node help or hinder the Node ecosystem?

As a part-time optimist, I see this adaptation of a universal language as a net benefit for Node.  Many great programmers attempt to be always learning new things.  Why not chose that cool new framework that's in a language that you already know?  That's how I got sucked into Node awesomeness.

Others think that bad programmers will give Node a reputation for being incredibly difficult (even though it's pretty simple) as they try to build a Node app and fail.  They'll spread the word that Node is a harsh language and "totally unradical" (or whatever dialect they use).

What do you think?  Post your opinion in the comments here or at Hacker News.

1 comment:

  1. I think, more than the ubiquity of JavaScript being a good or bad thing for Node, I think Node will be a good thing for JavaScript. With a popular, fast, interesting server-side/scripting environment, it's more likely that people will have a reason to take the language seriously. Node is, as you mention, less forgiving of mistakes, so it will force people to write cleaner, more standards-compliant, more efficient code. Since it's the same language they're using on the client, those benefits - hopefully - will bleed over into client-side code.