Why I switched to Node.js

Matthew Nuzum —  — 11 Comments

In 1999 Perl/Mason was the king, but soon after PHP 3 started to take over. As Y2K approached, these where the tools I used to build websites. In 2000 and 2001 I decided to invest significant time building strong Javascript skills.

I went on to add some additional tools to my belt, such as C#, Java and, starting in 2007 I switched my primary platform from PHP to Python/Django. Since then I’ve also used Python/Flask and Ruby on Rails. Throughout all of these platform changes one thing has been constant: Javascript has been a key skill that I’ve used in nearly every project.

in late 2011 I started experimenting with Node.js, and after signficant contemplation I’ve decided to make the leap and use it as my new primary platform. I thought I’d write this blog post to explain how and why I’m doing that.

*note: due to length, I’m splitting this article into three pieces, part one about how is available, stay tuned for the final note!

First, let’s discuss the why.

The obvious reason is that I love Javascript. I understand it, I can make it do what I want, and it’s a skill I need to be constantly improving for my work. Using JS on the server let’s me reuse my experience. Also, Node.js enforces some good practices such as the module pattern/separation of concerns, namespacing (avoiding global pollution) and using event based development processes.

Then there’s the features. The event model commonly used in the Node community and the speedy V8 engine make for fast apps. Socket.io is a killer feature that enables real-time communication between the server and the client without requiring the browser to request anything. The server can push out new data on demand. And the Connect framework enables every project to have a built-in web server so that you don’t have to install tools like MAMP or XAMP on your workstation.

And the final, and probably least obvious reason, is the trend curve of new technology. When a new technology arrives on the scene people start to talk about it. A few brave souls will try it out. If it has merit, it will gain buzz. Then it progresses into mainstream, when adoption becomes easy and many people begin to use it. After some time it enters a mature phase where it isn’t really cool anymore, but it pays the bills and it becomes “enterprise” (or maybe just dies a quiet death).

Ruby on Rails has ridden the trend curve for an exceptionally long time, but it is well into the “mature” part of the curve. I like Rails a lot but jumping into it now feels like becoming a fan of the sports team that won the last three championships.

Node.js is still at the early buzz stage. I think, and I’m willing to bet on it, that it has a long run left ahead of it. And considering the first two points above, I think it’s a great fit for me. Already, with frameworks like npm and Express, the barrier to adoption is shrinking.

This would be an awesome segue into the “how” I transitioned, but first I have to answer the two obvious questions you have.

Why not continue to use Django? I feel that Django is stuck, becoming a niche product targeted at CMS solutions and old-school websites where you click a link and the page refreshes. The developers have handily avoided incorporating features that will help modern web developers create cutting edge apps. For example, unless you have an add-on module there is no RESTful API support in Django. It is a great product but it really isn’t any different now, feature wise, than it was in 2007.

What are the short-comings of Node.js? One of the biggest is the relative immaturity of key modules. There are many examples where multiple do the same thing. Fortunately, the ecosystem is starting to settle and a few key projects are emerging and amassing strong communities. Another is that there are still some deployment challenges. For example, how do you deploy an Express + Socket.io server in a load-balanced configuration? It is possible, but it’s not documented well (though the Nginx 1.3 release in February does pave the way for improvements). Basically, it boils down to the fact that it’s new, but that’s also what makes it so fun.

This post is long enough, stay tuned for two follow up articles where I discuss how I made the switch and some comparisons between Node.js and other tools I’ve used. * Note: Here is the next one: How I switched to Node.js

If it helped, please share!Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

Matthew Nuzum

Posts Twitter Facebook

Web guy, big thinker, loves to talk and write. Front end web, mobile and UX developer for John Deere ISG. My projects: @dsmwebgeeks @tekrs @squaretap ✝
  • jchencha

    I can’t seem to see the benefit of being an early adopter. Seems to me you can get more done on more mature languages. Perhaps you can explain more?

    • newz2000

      @jchencha – by being an early adopter you trade short-term productivity for long-term gain, at least in theory. 🙂 My original thinking was that Rails is so mainstream that by getting serious about it, I’m coming late to the game. By adopting Node.js then I’m getting in on the ground floor. I won’t kid, though. There are a lot of pain points. The language and modules are in such a state of flux that the documentation is quickly out of date.

  • Sam

    I agree on the reusing experience part. It’s time we admit JS is where the web is strongly moving to. Node allowed me to drop the backend title and to be a firm frontend developer.

  • Anonymous

    >I like Rails a lot but jumping into it now feels like becoming a fan of the sports team that won the last three championships.

    Are you serious? Who cares about how popular it is, if it works well then it’s good. This is a bullshit reasoning.

    • newz2000

      Java works well, it is good. PHP works well, it is good. C# works well, it is good. We all have to make a choice. Some people prefer to choose that which is tested and proven. My statement about the adoption curve tried to made it clear that I wanted to choose a technology that was emerging, not proven.

      You have different values, and that is fine. Choosing Rails is not a wrong choice.

      • Steve

        Software is, in a nutshell: doing work in less time. Google’s software combs through billions of documents so that I don’t have to.

        The longer that code takes you to write, the worse the trade-off is. If it takes me 3 months to write a piece of software that saves me 1 month of work, I have wasted 2 months.

        Therefore, the time it takes you to write (and update) software is critically important when choosing a platform or language. So your philosophy about something being appealing because it is new and unproven is, objectively, wrong. Old technology is more stable, has more support, and is well-known to more people, who may want to work with you or take over your project in the future.

        “Late to the game” is GOOD, not bad. The only reason to use a new and unproven technology is if it does something better than the old technology. You don’t seem to be making an assertion about that here.

        • newz2000

          Ah, you are right, but you are also wrong. If I spend 2,000 hours over the course of a year learning a new tool at a low hourly rate but then spend 10,000 hours over the course of the next five years at a high rate, then you would call that first block of time an investment, very possibly a good investment! The same is true if I work at a lower level of productivity for a short time in order to gain a higher level of productivity in the future.

          My point in the article above is that I am investing in a technology that will differentiate myself and prepare for what comes ahead. In my opinion* Javascript is becoming increasingly important for software development. Investing in Javascript is a good investment.

          * I’m not the only one who thinks this, check out what languages are used most at Github (hint: Javascript is blowing everything else away)

  • m0l0k0

    funny because I used node.js and meteorjs and other javascript frameworks and it was all hype. ive picked up python and django and never going back. javascript should stay on the client side, it doesn’t belong in server side.

    • atxtroybetz

      They serve different use cases and aren’t exactly at odds with each other…

  • I’ve played with Node.JS. I still plan to spend more time with it, but I see no reason why I would NOT go with Django for a database driven application. No reason at all.

    • newz2000

      Django is awesome for that, no argument here. One of my biggest complaints about Django is that it has stayed focused on the CMS / server-side RDBMS based web app model. It’s essentially the same way we’ve written apps since the late 90’s. The development world is changing and Django isn’t.