Months ago I stumbled across this and though, meh, it’s just another one of those dumb programming shenanigans. Over the last few weeks, I got to try to program with it. But before we go there, let’s stop and define what node.js is really.
I have crafted this mini table for a quick comparison. NB: These are all purely my opinion.
|Program (compiler or interpreter)||nodejs.exe||I don’t know, MSBuild?||Freaking javac!|
|Framework||I don’t know, did they give it a name?||The glorious .NET Framework||Freaking JRE?!|
|Your friendly neighborhood IDE||PhpStorm, Freaking NetBeans?!??!?!, Visual Studio (!)||Visual Studio||Freaking NetBeans?!??!?! Or Eclipse?|
|Community resource pool (?) Plugins?||npm||Nuget||????|
Now that’s done, let’s have my answers: why like node.js?
- It’s your freaking own server program! Yes, unlike Apache and PHP, which are separate web server and interpreter, node.js allows you to be free and write your own! Although this creates an issue for hosting providers that might not want to give their customers that much freedom. Although there are some who are willing to give developers a chance. Note that node.js doesn’t have a built-in web server of its own, but it has an HTTP library which can get you started. And there are always libraries that can simplify your intended task.
- Yes, and with npm, installing third-party tools are a breeze. Just like apt, it takes care of all the dependencies your third-party library might require.
- It’s already in the intro, but it’s based on a freaking asynchronous API! What this means is that when some code reads a file, that code can wait for that I/O operation to complete while other code consumes the precious CPU cycles! This can be really useful especially in the website hosting context where many users can connect simultaneously to your website.
- Write a small script and it should just work, whether it’s a simple
- CREATE YOUR OWN GAME SERVER! THIS IS NOT POSSIBLE USING FREAKING APACHE+PHP!!!!! NO DATABASES REQUIRED!
As node has many good things, it also has some bad shortcomings. Let’s take a short look at that:
- This really is for JS and not node: I am really lamenting the lack of an “await” keyword for JS. It would be really useful since node has an asynchronous API. Right now the closest we have for that is
And that’s it! This concludes my fanboyish post about the freakishingly awesome node.js.