By March 28, 2019

Pros & Cons Of Node.js (Nailing Your Coding Interview)

You're going for your next coding interview for a node.js job. Then, you should expect lots of different questions regarding node.js.

What do you do then? Why don't so many developers still don't prepare for questions about programming language and stuff?

Node.js framework is actually not a framework or a library, but a runtime environment, based on Chrome’s V8 JavaScript engine.

The technology was first introduced back in 2009 by Ryan Dahl at the annual European JSConf and was immediately recognized as “the most exciting single piece of software in the current JavaScript universe”. However, it wasn’t until recently that a wide adoption of server-side JavaScript with Node.js started. The interest in this technology peaked in 2014, as per Google Trends, and remains high.
(Source: https://www.altexsoft.com/blog/engineering/the-good-and-the-bad-of-node-js-web-app-development/)

In this case, you definitely should be prepared to answer questions like what are the pros & cons of node.js. What is node.js, and more?

Answers should look like this:
“Using Node.js for backend, you automatically get all the pros of full stack JavaScript development, such as:

better efficiency and overall developer productivity
code sharing and reuse
speed and performance
easy knowledge sharing within a team
huge number of free tools”

In today's video we'll go through some Q&A about node.js and how you can nail your next coding interview applying for a node.js position.

Transcript Of The Video

Jason Humphrey: Today we're going to be talking all about the pros and cons of Node and how to answer this question in the interview.

During the interview and the interviewer asks you, what are the pros and cons of Node? Instantly you start sweating bullets. Why is that, right? It seems like a pretty simple question, but if it's not one you've prepared for, well, it's about to be a really hard question and that's because you generally want to come with facts to this question, you want to sound knowledgeable, right? This is where your expertise lies. You talked about it on your resume so this is a great place to show it.

And this is often where people potentially have the expertise but don't show it always because they're not prepared to talk about the good and the bad of the language that they put on their resume. Any language you put on your resume is totally acceptable to be asked questions on about this. So if you give me Python, I'm gonna ask you the pros and cons of it potentially. If you give me Java, what are the pros and cons of Java. This goes for any language. We'll do other videos here in the future on different languages, but for now this one's all gonna be about Node.js.

Let's talk about some specifics first on how we want to answer this. First off we wanna come with related experiences 'cause anytime we're gonna give a point whether it's on the pro or con side, a related experience in life is gonna make it that much more impactful for you to talk about. So if it's something on a pro of how iterative Node is and you have a use case where you built out some application and you'll be able to show statistics on how you're answering users this much faster because you switched over to Node potentially, a real life experience will do wonders for the impact of your answer.

Second thing. We wanna come with facts and potential examples. Not examples like we were just talking about in the real world, but examples may be of code snippets you've seen or heard about or maybe talks you've seen. Maybe it's some type of Kyle Simpson talk or something of that nature. Facts about exactly what's going on whether it was an asynchronous or synchronous, and what does that mean, and how does the event loop work. You need to come with facts on how this stuff works.

Third thing. The don'ts. In our answer there's things we don't wanna do. We don't want to take the easy road first and foremost. Like no matter what you do, do not take a cop out. Now I know there are some answers that are easy that need to be said that are like duh, obvious answers, but don't take the cop out, for example something like this, don't just say because it's JavaScript. Node.js is fantastic because it's JavaScript. That is one of the worst things you can do. Yes you can talk about JavaScript later in your answer, but don't just leave it at 'cause it's JavaScript, it's great, you do stuff on the front and the back and everything's great. No. No, that's the first don't. Don't do that. Do not take the easy way out.

Also do not lie about things you are about to make up. Better yet, if you don't know anything about it, don't say it at all because it will be found out, it will be heard, and you will instantly lose credibility with your interviewer. Now maybe you get lucky and the interviewer is not technical and has no idea what they're asking, sure, maybe, but it's not worth the risk. Because far too often I have people come in and boast about things that aren't exactly true, and then when I hit them with a question, later on in the code interview 'cause I know they're boasting about it, and they can't answer, it's really obvious. So be to the point.

Fourth, if you don't know an answer, be honest and truthful, all right 'cause you don't have a good answer, you haven't studied, maybe you can't come up to mind, be honest with the interviewer, tell them what you're thinking, tell them where you're coming from, give them something to go on, but be honest and upfront of like I'm really stuck on this question, I haven't thought about this too much lately, I know I use it for X Y and Z and it benefits me this way, and I've run into these potential problems. But I don't have any good real life experiences, no hard facts, no examples to give you, this is what I know. So if you do get in trouble, pull the ripcord and use number four.

Now I wanna make sure I give you some pros and cons in this video because this one is all about Node.js. So let's give you these pros and cons. First pro, it's an asynchronous event driven IO which helps with concurrent requests.

Another pro, it's all about JavaScript, right? And you see that I'm saying this in the second one. In the second one because it's now not the easy way out. Yes it's still a true thing to say, and it's a duh answer, like ah yeah duh it's JavaScript, but I put it specifically behind the second. Don't put it as the first one, it just doesn't look good. But yes, everything's in JavaScript. So everything you can do on a client you can also reuse potentially in the server if need be, or vice versa.

Third thing, NPM is a huge pro for Node.js because it is actually overtaken other packaged management systems as the most popular in the world because of all the free open-source code out there. It's absolutely fantastic, there's a ton of great libraries out there for everyone to use, and a lot of people are giving back and it's a way for people to share and collaborate and it makes the Node community that much stronger and more vibrant so that when you're using it, well you have a lot of support and a lot of documentation out there.

Another one of my favorite answers here for a pro is talking about how Node is really good with short iterative requests to handle things on smaller applications. Especially if it's like a single database call back and forth or it's a simple calculation, a log in log out. Short iterative requests, Node handles really fantastically and can scale that really easily.

Let's talk to the other end of the spectrum. Cons. First con. Node does not scale well by default. Now there is clustering and you can do some things to scale and get them to work together, and if you build your app in certain ways, it will scale. But by default, Node is not easily scalable. It's one CPU and that's it. Second, gone. It stinks at CPU intensive tasks. Do not ever try it to make it create large scale files, go through huge files, deal with big data, it just won't do well. It's not what it's there for. It will run out of memory quicker than you can blink. It's not good with these CPU type of intensive tasks.

Third. Asynchronous versus synchronous. What do I mean, right, 'cause that could also be a pro because you kind of have the choice if you wanna be asynchronous or synchronous. But the reason why I say it's a con is more often than not developers don't do well with knowing the difference of when they run into an asynchronous versus synchronous error issue where they've written some type of code and it's actually asynchronous but they really think it's synchronous and it's not and they can't debug their code very well. And it just becomes a con because also it's not readable like oh, it says asynch right there and synch right there. It doesn't just work like that. So it's a bit harder to work with and people often or not screw it up so I'm gonna put it as a con.

Fourth. Unhandled exceptions. Now every language has their ability to do unhandled exception, unhandled rejections, things of that nature, but particularly Node, a majority of people do not know how to use the unhandled exception errors. And so if you build an API, more than likely if I toss some crazy stuff at it, and I can cause an error, the server will crash and just stop. And if you haven't put a process manager in place, you haven't put redundancies in place, you haven't done the things proper, more often than not people run into issues and it becomes a big con because not everyone does great with unhandled error exceptions. Because they don't know how to handle them properly and they don't know how to get the machine to restart, and there's a lot of things that go into that, but I see it as a con because it's not easily well known to the audience how to properly handle them to keep your machine up and running. ‘Cause Node, by default, it will crash and just stay crashed which makes life tough.

If you start talking and bringing all of these things together and all this information, it's absolutely key if you can relate to any of these I've talked about and have a real world example of how you saw the security and quality control for yourself, go bad. If you saw how asynchronous concurrent calls made your app go that must faster compared to whatever you were on before, that's huge. If then you take this information and you have some facts behind it, you have more examples of how to use it, or how it's been used, or things in the community, absolutely key.

Now with these things I've said, don't ever lie about any of them. If you can't remember them, don't make them up and just say oh yeah, no … I'll just leave it at that. Don't make any of them up. And if none of these come to mind in an interview, be upfront with what you know, be honest, don't BS, because it will be found out.

This is the pros and cons of Node.js. If you have any questions, leave a comment down below or reach out. We'll see you guys in the next video.

About the author

    Jason Humphrey

    Jason Humphrey is an full stack development, entrepreneur and investor. He is a professional programmer and engineer working in Node js, Angularjs, HTML5, CSS, JavaScript/jQuery, Mongodb, and Jive. He is a full stack developer, with a special emphasis on and passion for MEAN stack. You can find more about him on his website.