About NodeJS

14/10/2018 13:35 BST

I’m really not looking forward to writing this, or am I, anyway but here goes the rant!

What the fanboys want you to know about NodeJS?

  • Its JavaScript, the ability to work with the same language on frontend and backend.
    • Like being a polyglot a bad thing, I beg to differ. I know Go, PHP, SQL and JavaScript, I had exposure to Python, Ruby, Java, C and C++ and I had thought about learning C# and Rust.
  • That its fast and highly scalable.
    • This is very debatable. If I read correctly, its good with IO but not with computation scalability. Why not pick a language that is good with both? Like Go for example.
  • That its very easy to write code with.
    • Maybe for a small to medium application, but what about a very big application?
  • That it’s highly accessible.
    • That is true, I can’t argue with that. JavaScript is practically in every web browser.
    • Keep in mind you can use any language with any VPS such as DigitalOcean and there is also Web Assembly, that currently in it’s infancy, but will get better with time.
  • That it’s hugely popular and has a good ecosystem.
    • But popularity does not make it a product of exceptional quality, a highly popular product can be badly thought out. This logic can be applied to other product such as MySQL and PHP 😁
    • Good ecosystem? I thought the ecosystem was a game of Jenga; I get to the package manager in the next section.
  • They like to point out that there are big companies using NodeJS, such as PayPal, Walmart, NASA and Uber.
    • Yet, there is barely any job opening for nodejs in those companies, there mainly job opening for Java Dev, even if there were opening for node, it’s mainly for frontend. 😂😂😂

What they don’t want you to know about NodeJS?

  • It’s JavaScript, arguably the worst language to use in the backend. Even Ryan the founder of NodeJS hates it and he even working on a replacement for NodeJS and support TypeScript out of the box, it’s called Deno.
    • Also JavaScript was written in 10 days!
  • That the documentation on error handling is well over 80 pages.
    • In my humble opinion, a well thought out language should explain how error handling works within one page. Think about cognitive load!! 😱
  • The node_modules folder can become a big mess.
    • The packages in NPM are like a game of Jenga, pull out one package and the entire ecosystem could go down, it’s has happened before, what make you think that it’s won’t happen again?
    • Some packages only contain a few line of code.
    • JavaScript is just a kitchen sink, there are no standard libraries until now, but the thing is it’s did not happen on day one. A few other languages had standard libraries from day one, take go for example come with a http server and a html template system.
    • Abuses symbolic links, Windows enforce admin privileges for a reason. (although you can get round that by setting windows to developer mode, but you can only do this in windows 10, MS did this to make the product compatible with solutions like NPM, crazy I know 😆 )
  • One really embarrassing bug with npm 5.7.0
    • That left me with no confident with npm or node (as npm is the most used package manager of the node ecosystem), I’m sorry but I just can’t really forget that, yes it’s been fixed, but I don’t care, that was too embarrassing, abusing ‘sudo’ command is a very bad idea. Honestly who on earth would run a package manager on a production server? Why couldn’t they do that on a deployment server?
  • That you being force into asynchronous programming.
    • Usually being force into something you’re not comfortable with is a bad thing.
    • Can be very unpredictable!
    • Can lead to callback hell!
    • Can lead to more difficult error handling!
    • Can cause confusion! Not good!!

Do you use NodeJS?

Yes but mainly for frontend, I use Go for the backend, I prefer good error handling and static typing.

Update Here a good read

| |