Blog

Random thoughts from my head.

Node.js Sucks! Here’s Why

Posted almost 10 years ago on 15th of October, 2014.
Node.js Sucks! Here’s Why

If you are a web developer, or any developer that has been catching up with latest technologies for that matter, I am sure you know about Node.js. It is a relatively new programming language built on top of Google’s V8 Javascript parsing engine that allows you to build cross platform applications. Node.js is widely used as a backend language in a lot of web applications and a lot of big name companies like Paypal have adapted it as well. It is definitely one of the fastest growing programming languages out there right now. Now you might be wondering how it can suck if a lot of big companies are using it. I recently had to use Node.js for few of my projects, and here are some reasons why I think it sucks:

Disclaimer: All the things I am going to mention are my personal opinions and I may have used some strong language to express my views. You can argue all day about how the things I have mentioned are invalid or are based on personal opinion, but the fact is they are my personal opinions and everyone has rights to think their own way.

1) Callback hell is real: If you are familiar with Node.js, I am pretty sure you are familiar with callback hell or have at least heard about it. Node.js is built to work asynchronously which means unlike traditional programming languages where you have to wait for one task to finish to start the next one, you pass callbacks (which are basically just functions) that will be executed when the required task is done. If you are new and have never used Node.js this might be confusing to you, but if you have used Node.js then you most likely know how difficult it can be to manage callbacks. Most of the time, you end up with a tree of callbacks. This makes it extremely easy to get lost in the code and makes code reviewing difficult. There are ways to fight callback hell, and http://callbackhell.com/ does a good job of explaining them.

2) Debugging is a bitch: This is mostly a personal opinion, but I found Node.js hard to debug than other languages I have used. It is really easy to get lost in the code and even debugging simple things take long time.

3) Javascript was not made for server side: Javascript is a popular widely used language that has been around for 20 years. When it was first created in 1995, it only took 10 hours for the creator to create it. This doesn’t mean the Javascript that was around in 1995 is the same as Javascript now, it has come a long way since then, but there are still things about Javascript that annoy the hell out of developers. It is a weak typed language which means debugging things is going to be a bit more difficult compared to strong typed languages. Javascript is only popular because it became the language of the web and almost every browser supports it. Using Javascript to program on server side feels like using a coffee cup to drink water, something about it doesn’t feel right. With Javascript replacements like Google’s Dart gaining popularity for the client side, I can see Javascript slowly fading from he development scene.

4) Same code on both server and client side doesn’t really work: One of the reasons I see developers switching to Node.js is because of “Javascript Everywhere” theory. I have built numerous apps using Node.js and I almost never had a place where I was able to share code between the server side and client side. If this was going to be your reason to start using Node.js, don’t.

5) The packages aren’t that good: I love npm. That is probably the thing that i love the most about Node.js.Npm makes it extremely easy to install third party packages that you can use from/with the app you are building. But its not all rainbows and cookies with npm, what I found is almost half of the packages I find are either abandoned by their maintainers or are not well documented (heck, the biggest websocket library socket.io has a horrible documentation) or are coded poorly. There are some really good packages that are frequently updated and maintained, but having to search through packages to find the right thing gets frustrating.

So what now? Well I said all I had to say about Node.js. It is not a bad concept at all, but using Javascript on both server side and client side, companies could save money / time on development projects. But even though the concept is great, the implementation could have been better. Even developers that have maintained popular Node.js packages like TJ, the maintainer of Express.js have left the Node.js ecosystem because of the issues. Personally, I would say stay away from Node.js for now, at least till it gets a little more mature. If you are thinking about learning a new language, try GoLang by Google. I have been experimenting with it lately and it’s fantastic so far.

 View Other Posts