If You're Using Node.js, You're Doing Life Wrong
This morning, on a conference mailing list, I made some disparaging remarks about Node.js (the title of this post, in fact). A couple people asked me why I felt that way. Rather than respond individually, I’ll just list my reasons here:
V8 is not server-class
At my current place, we have a Web crawler where some portions are leveraging Chrome/V8. Take a guess which component absolutely dominates the bug count and issue list? Not to mention the fact that its balls-ass slower than some straight un-optimized Scala. We’re looking to get rid of it completely ASAFP.
On a larger note, using JavaScript on the server-side seems kind of ridiculous. If Linden Labs came out with a server-side framework in LindenScript, would you use that? How about if Apple came out with a framework based on AppleScript?
Callback spaghetti is about the last pattern with which you’d ever want to write anything
I’ve written servers in just about every kind of server framework pattern there is. Node’s is the absolute worst. It provides the least amount of aid and comfort to the programmer and its nigh-on-impossible to follow the code 6 months later. The idea that the broken-ass concurrency model forced on Javascript by old browser implementations is actually a *good thing* gives me a fucking aneurism.
Non-blocking != fast != scalable
This is probably the most annoying point for me. First of all, scalability has very little to do with raw speed. Just because you’re fast does not mean you’re scalable. You know what’s fast? MySQL. You know what’s not scalable by itself? MySQL. The hype around Node.js on this issue makes me want to punch faces. Furthermore, Node.js isn’t even that fast. You can do much better with Scala and its a much nicer language, to boot. Oh, and nevermind about those extra CPUs you bought: you won’t be needing those. Events and non-blocking are instantaneous, so you can do everything on a single core, right?
JavaScript
The Ruby and Python communities are just now, many years after the hype has faded, learning that stuff like dependency injection and proper modularization are actually good things that help you maintain code over time. JavaScript has very little support for any of those nice things: it doesn’t even have namespaces, for chrissakes. Why would I want to repeat these same mistakes over and over again in a new language? Knowing a language is not the same as being able to maintain services written in that language over the long haul.
It seems to me that people who are really crazy about Node.js are people who only knew JavaScript to begin with and to whom none of the above would ever even occur. Perhaps, this is a case of Worse Is Better and I’ll eventually have to eat my words on this one. But the kind of misunderstanding going on in this video clip seems to pervade the Node.js hype and gives me rageface.