1. Dec 29th, 2010

    2011 is year of the Server-Side JavaScript

    Uphill, Both Ways

    I got interested in JavaScript when it arrived to the world as Netscape LiveScript. It came in two distinct flavors: client-side JavaScript running in the browser, and not many people remember, Server-Side JavaScript for writing the back-end logic. I believe back then it was called LiveWire.

    Next to client-side Java, client-side JavaScript didn’t look like much. DHTML was nice, but nothing compared to the promise of mobile agents roaming around the Interwebs doing all sort of fancy tasks on your behalf. If you knew how to develop — back then JavaScript was marketed for the more casual programmer — you ought to be looking at Java Applets.

    Then we let a big company full of engineers perched atop their X Server workstations to manage the UX for Java. We know how that turned out.

    On the server-side, JavaScript was limited by a crappy standard library, a sluggish implementation, and the cost of a Netscape Enterprise license.[1] Contrast with Java, which came with a rich standard library, adequate performance, and you could either get an open-source server or were busy developing one.[2]

    It’s been longer than a decade since I stopped caring about server-side JavaScript. Now I’m rebooting that passion. So what changed since?

    Stuff Got Better

    JavaScript is still the same ill-designed language, best known for its high density of “surely this was designed to confuse” language elements. Then again, nothing interesting happens around pure and perfect languages, at best, they evolve into text editors. Fortunately, we’ve got CoffeeScript, a dialect that mixes the better part of Python with the better part of Ruby, and compiles into straightforward JavaScript. It’s incredibly fun to use.

    The library situation has improved tremendously. I remember searching for JavaScript code, only to find snippets of badly written DHTML code. Today? Take a look at this incredible list of Node.js modules. Need a Web server framework? Dropbox API? More uptime? Real-time monitoring? Asynchronous BDD? Web scraping?

    I went looking for database drivers and found one for MySQL, one for MongoDB and three for Redis. Oh, and a JavaScript implementation of Redis called Awesome.[3]

    We’ve got three runtime platforms for choose from: the insanely fast Node.js, the JVM-based Rhino and it’s C-based sibling SpiderMonkey. Competition is healthy. Then again, I’m betting on Node.js. It’s brilliantly fast, fun to use, got a story to tell (everything is asynchronous), but mostly, you can choose from a variety of hosting solutions.[4]

    Yeah, we also got push-button hosting for JavaScript.

    Looking for a chance to exercise your JavaScript-fu and prove you understand why 0 == []? You can start by writing a Web application using one of many cool frameworks. Or you can package your HTML-based UI into a standalone or mobile application (thanks, Webkit). You could be writing server-side code, or scripting your database: CouchDB and MongoDB both use JavaScript for user code. You can run cronjobs in JavaScript, replace make or managed your EC2 instances.

    Better libraries, better performance, and more places to run your code.

    It’s A Start

    It’s not all peaches and roses though.[5] Most of the libraries out there are young, buggy and incomplete. I got Node.js to segfault a few times. There’s no killer framework on the same caliber as Rails, nor anything that comes close to ActiveSupport and a decent standard runtime library (hmm … that gives me an idea). But then, it’s not much different than what Ruby was five years ago, or Java back in the late 90′s. We’ve all got to start somewhere.

    I know I’m going to be doing a lot more JavaScript in 2011. And much of it will come at the expense of what I currently use Ruby for. I already shifted the balance towards applications that use more client-side JavaScript and less server-side Rails. How did it work out? better performance and just as easy to maintain. Next, I’m moving the test suite over to JavaScript thanks to Zombie.js.

    So that’s my plan for 2011, and you should follow me on Github and Twitter to find out what happens.

    [1] Netscape actually compiled server-side JavaScript into bytecode, so it wasn’t all slow. Back on ’95 hardware it felt slow for what little it did. Java Servlets weren’t speed demons either, but on ’97 hardware and with much more promise, they felt fast enough.

    [2] Remember when Java was 10x slower than C, but the language of choice for productive developers? Good times.

    [3] I didn’t mention jQuery since this post is about server-side JavaScript. But jQuery did show the world JavaScript code can be clean, simple and productive. I think it deserves credit in changing people’s opinion, including of JavaScript as a server-side language.

    [4] Node.js is not the first platform to have a good asynchronous story, it’s just the first platform that many people care to use that has a good asynchronous story. And it’s not so much about the asynchronous part as it is about a good, compelling story. Rhino’s story is “we’re JavaScript only in Java” and SpiderMonkey’s story is “we’re not Rhino”.

    [5] Bet you didn’t know JavaScript™ is now trademark of Oracle Corp.

    1. Dec 29th, 2010

      Christian

      This is a fantastic article about the future of Javascript.
      Bravo.

      Hopefully

    2. Dec 29th, 2010

      Ken Downs

      I hope you’re right. I would be delighted to code Javascript on the server. Or perhaps I should say I would love to do it and be part of a mainstream instead of a downtrodden minority.

    3. Dec 29th, 2010

      Rob

      Don’t forget Vows for BDD testing Node.

      This movement has far from crossed the chasm though there is much momentum, which I suppose is precisely the point of this post ;)

      I would say 2012 or “never” though time will tell. Node.js is still v0.3.x. Github just tweeted that they had to abort an upgrade and roll back to 0.1.100. I wouldn’t bet my business on server side javascript though it’s certainly far beyond the time to start playing around with on side projects.

      A litmus test is whenever the people at Jetbrains announce an IDE for it :)

    4. Dec 29th, 2010

      2011? ??? IT?? ??? -Javascript- « iphone blar blar

      [...] ?? : http://labnotes.org/2010/12/29/2011-is-year-of-the-server-side-javascript/ [...]

    5. Dec 30th, 2010

      Dan Brickley

      Also check out what Oni Labs are doing with stratified Javascript, i.e. a flavour of Javascript that hides some of the pain of async coding. They have a client-side engine that runs wherever js runs, but also custom server-side implementation. Eg. see recent blog post http://onilabs.com/blog/stratified-node-io-performance for node.js integration, -> “the whole point of having StratifiedJS on the server-side is to program in a callback-less blocking style”. All of which I find appealing since async coding style gives me a headache as soon as things get complex…

    6. Dec 30th, 2010

      Martin English

      So did Oracle buy the javascript name or just assume it (based on their legitemite rights to Java) ?

    7. Dec 30th, 2010

      Victor Cortes

      I’ve been using Sever Side Javascript in Windows IIS ever
      since reading about it in Windows 2000 Web Applications Developer’s
      Guide by Thomas Yager.

    8. Dec 30th, 2010

      links for 2010-12-30 – The 5th incarnation of Elmer’s blog

      [...] Labnotes » 2011 is year of the Server-Side JavaScript
      (tags: javascript server resources) [...]

    9. Dec 31st, 2010

      Pomeh

      Javascript is as least as awesome as this article ! Thanks
      for all those links about library/framework. There’s a lot of nice
      stuff for whoever wants to learn/do/write/improve
      Javascript.

    10. Dec 31st, 2010

      Edwin Martin

      Martin English: as everybody knows, Oracle bought Sun
      :-P

    11. Dec 31st, 2010

      JavaScript Magazine Blog for JSMag » Blog Archive » News roundup: Zombie.js, evil.js, and even more JavaScript game engines

      [...] in immediately-invoked functions jQuery Blog: Hotlinking To Be Disabled January 31, 2011 2011 is year of the Server-Side JavaScript – Assaf Arkin writes about why server-side JavaScript is getting bigger, despite being around [...]

    12. Jan 8th, 2011

      SitePoint Podcast #94: Appy New Year! | Food Science and Technology

      [...] his blog post, an excellent blog post by Assaf Arkin over at his labnotes.org site. And he says 2011 is the year of server side JavaScript, and he’s talking about how he expects in 2011 a lot of the stuff that he started using Ruby for [...]

    13. Jan 9th, 2011

      SitePoint Podcast #94: Appy New Year! | PHP Podcasts

      [...] his blog post, an excellent blog post by Assaf Arkin over at his labnotes.org site. And he says 2011 is the year of server side JavaScript, and he’s talking about how he expects in 2011 a lot of the stuff that he started using Ruby for [...]

    14. Jan 13th, 2011

      Getting up to speed with JavaScript | Tom de Koning

      [...] if you are still with me, have a look at this post by Assaf: 2011 is year of the Server-Side JavaScript. It contains a valuable overview of JS server side and contains a ton of useful [...]

    Your comment, here ⇓