0
When not to choose Node JS for dummies

When not to choose Node JS for dummies

Well, I am primarily a JavaScript developer. In my Frontend, backend and even mobile, I stick with JavaScript and typescript, and I cannot over emphasis why Node JS is awesome. Throughout the lifetime of a project, I usually do not have to table in any other languages, but JavaScript, this reduces the overhead that comes with switching context. And with tools like Feathers.js, React Native Web, we seem to be even getting close to write once ship everywhere. But as a tech lead, CTO, or CEO starting your awesome startup, you will have to make a decision which technologies to go with, and if you are like me, your default might be Node, React, Mongo. Though this might not always fit the project, I think some myths why node JS might not be a good fit are worth debunking

Myth: Callback hell issue

Well anytime you read of the callback hell issue in an article try and check the date. It might be probably some ancient article. These days we have a lot of awesome ways to handle asynchronous code and callbacks in general in JavaScript. You can declare the functions separately and call them in each callback, that way the functions are nicely arranged. You can convert them to promises, if they are not already, and then then them (pun intended). You can use the famous async await, and everything will look normal in the code. If you are fancy, you can even use rsjx to handle all your async stuff. Javascript can be clean and awesome

Myth: Immaturity of Libraries

Well, again, each language has it young days, and when node started out some frameworks were cool, but they were just not production ready. Even till this date, not all packages are worth using from the npm repository, but now NPM has some very matured industry and production ready libraries and frameworks to jumpstart and hold on your product from start to finish. And if you want some type safety, typescript got you sorted. Here are a few you can check out if you don’t know them already.

Express JS
Hapi
Feathers
NextJS
NestJS
NuxtJS

¯\_(ツ)_/¯ why so many Next libraries? Well, The list goes on and on and on

Myth: doesn’t pair nicely with Relational Databases

Just because Node has a thing for no SQL doesn’t mean its not fit or good for SQL based databases. Node JS fits perfectly with most Relational databases out there. I have seen some pretty bad C# code with database queries littered everywhere. But usually in node things get passed around nicely with an ORM, and those tools interfaces nicely with the framework.

Heavy-Computational tasks.
We all admit C is faster than light, but my point is, the close you get to machine code, the faster the programming language get. And this is true for all languages, as a result, interpreted languages are usually slow. But when people talk about this myth, they are usually referring to how node js is single threaded and how you can’t do multiple things at once. Well maybe in the past. But the current version of nodejs exposes multi threading to the developer in multiple ways. Clusters, processes, workers. You can pass off heavy computations to other threads whiles freeing up the main thread to handle more requests. There are a lot of ways to design your node js backend to be robust for computation.

Why you may truly not want to consider Node JS

With that said, lets look at some cases where you may truly want to not go the node js route. Not because nodejs is not great, but because, it doesn’t fit your needs perfectly.

You have a team of backend developers who specialize in another Language

If you have an awesome team with expertise in another language, and from your performance benchmarks, you are not going to take a hit from designing your awesome backend in that, I would say, stick to it. Unless you too want to hang out with the cool node js guys. But seriously, If you have a great team good with python Django, and it performs well for your backend after your research. No need to force your team to use node js

You want lightening speed applications and You want drop low
Again, the lower you go the faster you get. Though node js has some c++ low level internal implementation of some of it modules, you may want to go lo yourself in your application. In such cases, there is no point using node. Find yourself a low level language developer, C++? C? Assembly language? Machine code? Well how low you want to go depends on you, but I guess you get my point.

Do have a lovely day, and lets deploy some great apps. If you want to learn about frontend optimization, check out my articles here.

Avoiding Unnecessary Renders in React
5 Ways to Lazy Load React Components

Posted on Medium

Leave a Reply

Your email address will not be published.