WHY I CHOSE NODEJS AS A BACK-END DEVELOPER.

Josephine Bosah
6 min readJun 2, 2019

In web development,there are three kinds of programmers. They are front-end developers,back-end developers, and full stacks.

First, we need to look at how websites work to explain the role of a back-end developer properly. There are two places where the code does work to make things happen: the client side and the server. Client-side coding is the site domain of front-end developers. They create the structure of the web page using HTML,CSS, and JavaScript, make transitions smooth as butter, and make buttons clickable and text field editable.

All of it is useless without back-end developers who make the whole thing work on the server side. However, one can be both, specializing in front-end and back-end, which makes you a full stack developer.

Personally, I’m interested in making things work, couldn’t care less about how they look and thrive with a puzzle to solve, so I figured I will perform better being a back-end developer.

My foray into the world of programming three years ago was mind-blowing and self-searching as well. I started out learning HTML,CSS, PHP and MYSQL to create a full functional website. Oh, I struggled with CSS, being a female I thought designing would come naturally but that myth faded faster than the thought itself. Amazingly, as each day grew by, I lose interest in perfecting my CSS skills and tilted more to learning and understanding PHP and MYSQL.

In September 2017, I attended a tech boot-camp held in Lagos. It was a huge eye opener for me. It was an opportunity to meet tech enthusiast like me and to also expand my knowledge in programming. We were tasked to build an app using HTML, CSS , NODEJS, EXPRESS and POSTGRESQL. Being a newbie in tech, I was only familiar with PHP and MYSQL aside other tools given. I took up the challenge to do the task using the tools instructed. It was quite challenging at first, but I later got a hang of it and completed the project. Like a child with a new toy, I got more fascinated with NODEJS and my love for it grew immensely.

Now, lets talk about NODEJS itself, shall we?

NODEJS is neither a library or a framework, but a run-time environment. If you are wondering what a run-time environment is, I would use an example from our not too distant relative Java. Before running your code in Java and compiling, you need a Java run-time environment(JRE) which comes most time packaged in a Java Development Kit(JDK), without this tools installed on your system, you might not be able to compile and run your well written sweet Java code. In essence, the (JRE) makes it possible for us to run Java programs on our system, the same applies to NODEJS, JavaScript as we knew then runs only on browsers, but NODEJS makes it possible for us to run JavaScript program on our PC’s in fact helps us run JavaScript outside the browser. To see what I mean, before you install NODEJS on your system, fire up your visual studio code, write a single console statement and try running it, yeah sure you would see error, now install NODEJS and reload your Vscode and try running the same program again, what happens, it builds.

Now believing I have established what NODEJS actually is, I won’t fail to mention that NODEJS run on Chrome V8 engine. V8 is the JavaScript execution engine which was initially built for Google Chrome. It was then open sourced by Google in 2008 written in C++, V8 complies JavaScript source code to native machine code instead of interpreting it in real time.

Okay, back to the business of the day, why I chose NODEJS.

There are three key reasons why I became a NODEJS staunch believer.

1. It is not I/O blocking.

By default, NODEJS can read a file, parse the content into the database, and write new content to the file, without even thinking about it. While there are libraries for Python and similar to add asynchronous abilities, by default Python is not asynchronous, one function must always execute before the next function can occur.

NODEJS doesn’t suffer from this problem, as it is designed to handle requests flowing constantly from web traffic, and also designed to handle everything in the background (file serving, mail etc).

This makes it perfect for my kind of tasks — I often extract the information I’m after, and store it in a database for later recall. I do this to both persist my data, and to free up memory by not having to hold the entire array. I can then be calling information back from the database, manipulating it and altering it, all the while it is running away in the background, storing more information in the database.

I/O requests are also handled on a separate thread in NODEJS from the main thread of execution. What this means, is that a particularly large or troublesome file being read in will not hinder the performance of the main program (providing the content of the file is not immediately necessary of course).

2. It takes care of itself.

When writing a throwaway script that I will only use a handful of times, optimizing that code isn’t necessarily high on my priority list. The priority is to get it written, and get it running. That’s where the V8 (C++) engine that NODEJS is compiled into throws you a bone.

When you have no choice but to call arrays into memory and manipulate them, sometimes very very large arrays, you can begin to worry about the state of your machine and the amount of memory that is being used. Luckily, V8 handles automatic garbage collection.

What this means is that whenever I have disregarded a block of information, say removed an index from an array, then that memory is automatically cleared and freed back up on the next sweep. While the process of collection and actually checking can be a bit intensive, it means when I am quickly iterating through code I don’t need to pay a tremendous amount of attention to my memory management, and I can entrust V8 to handle all the little nuances.

3. High interactive results.

One of the main reasons why NODEJS was built was to serve websites (to put it very simply). So when I have to show or share the results of my scripts, such as giving others the option to view the output and even change the parameters of a script, I can do so by invoking the true purpose of NODEJS.

The ease of serving my results directly on a server using a templating language in NODEJS is something I feel I take for granted. I tend to use EJS template more because, like the script itself, it’s straight to the point. It has a job, and it will do it well.

Now I know other scripting languages can serve web pages and I know it doesn’t take substantially more energy to do than it is does in say, Python, but there is a certain majesty in being able to write the (intensive) script and serve it all on the same execution, without ever having to leave the NODEJS ecosystem.

Basically, those are the key reasons I chose NODEJS. Whether I’m building a website, talking with a database or writing a script to automate a file process, I default to NODEJS. I urge you next time you’re writing a quick script, give NODEJS a try.

What are your thoughts? Agree or Disagree! Let’s chat below.

--

--

Josephine Bosah

Content Writer/Scrum Master Blogger IG @bosahjosephine