Thursday, April 03, 2014

Why Node is the Future of the Web Tier

Everyone I know hates Javascript. Including people who do it professionally.

I hate Javascript. I long for the day where it's been completely destroyed in favor of something else, I don't even care what. Typescript and Dart both look really promising, though I question whether either will ultimately make a dent in the dominance of Javascript.

Node is a gigantic hack. A browser Javascript engine pulled into the server layer? Single threaded?

Node is slower than most alternatives. Even the most rudimentary JVM-based framework will blow it away.

And Node is the future? Yeah, it is. I told my coworkers this the other day in our internal IRC and they couldn't believe it. I thought I should explain my position a little bit more clearly in a blog post.

The reason is a people reason

The server-side web tier is quickly becoming the place where no one specializes. At our company, we have "Front End" and "Back End" positions to hire for. What does that mean?

  • Front End: Javascripty, CSSy and HTMLly stuff.
  • Back End: Servery, Databasey stuff
As the front end becomes more sophisticated and contains more logic, the Back End folks are no longer interested in writing a simple DAL/CRUD web-tier for Front End people to call into. That kind of work is a solved problem, and if the real interesting application logic lives in Javascript, it's no fun. Rather, they're more interested in working on scalable internal services and systems that the lightweight web tier can call back into and work on.

This was our problem when I was back at Groupon. No back-end systems people wanted to take on new work in our Rails stack. The API layer, and related search and database services, sure. But not the web tier. So when it came to do a rewrite, who would own this and what tech would thye use?

The answer is, the front end people need to own this web tier. It cuts down on iteration time and makes for clear ownership. Then back-end people will focus their efforts on scalable systems in Java that the web tier calls out to.

Small companies have been cutting this loop for a long time with Node, but now you see major companies making this transition. Wal-mart. Groupon. Front end tooling relies on Node: Twitter relies on Node for Bower. Microsoft is supporting Node for Windows and has several projects that use it. Everyone everywhere uses it for unit testing their JS.

And it's trivial to get started -- something that seems to lead to adoption in the modern age. NPM is really easy to use and getting a basic Node site set up is easy. There's a lot of hosting as well.

Anyway, I hope this shows why Node and Javascript will continue to eat the future, even though everyone hates it and it's a gigantic hack. Don't ever forget the wisdom of Stroustrup: "There are only two kinds of languages: the ones people complain about and the ones nobody uses".

No comments: