20
AlgoRythm
10d

I'm not much a fan of JavaScript. In fact, I am not very fond of any dynamic language, but JavaScript is one of my least favorites.

But this isn't about that. I use NodeJS for all of my web serving. Why would I do that? Am I a masochist? Yes.

But this isn't about that. I use NodeJS because having the same language on client and server side is something that web has never really seen before, not in this scale. Something I really really love with NodeJS is socket connections. There's no JSON parsing, no annoying conversion of data types. You can get network data and use it AS IS. If you transmit over socket using JSON, as soon as that data arrives on the server, it is available to use. It gets me so hard.

JavaScript is built to be single-threaded, and this is rooted deep into the language. NodeJS knows this isn't gonna work. And while there's still no way to multi-thread, they still try their best and allow certain operations (Usually IO) to run async as if you were using ajax.

With modern versions of the language, the server and client side can share scripts! With the inclusion of the import keyword, for the first time I have ever seen, client and server can use the same fucking code. That is mindblowing.

Syntax is still fluffy and data types are still mushy but the ability to use the same language on both sides is respectable. Can't wait for WebASM to go mainstream and open this opportunity up to more languages!

Comments
  • 8
    If you like javascript but not dynamic types, you could try typescript
  • 1
    @zacg It's just JavaScript in disguise. I can't
  • 2
    Just wondering if you run multiple node.exes on a single PC, different CPUs and have them all communicate/share same code via socket, would that be considered multithreading?
  • 1
    Isn't every script you start its own thread?

    node s1.js
    node s2.js

    Wouldn't that be two threads?
  • 4
    @billgates ok satan calm down
  • 4
    @olback actually that would be two processes. The downside of that approach is that for s1.js and s2.js communicate between each other you'd have to build some inter process communication scheme.

    The single thread OP refers to is the mechanism by which Node operates - the event loop - which is indeed single threaded.
  • 2
    @billgates in the node jargon this is called clustering
  • 2
    Adding the seemingly mandatory 2018 trend to this thread. Bundle your nodejs app into a container and spin up a kubernetes cluster thats limits 1 cpu for each container and then wonder that you just wanted to write a hello world program so what the hell went wrong?
  • 0
    @AlgoRythm Javascript is just assembly in disguise
  • 0
    @snaz Assembly starts with the word ass and I think that's funny.
  • 1
    If you think tracking is a problem now, wait until WebASM. There will be no way to block it except via DNS, and the malicious trackers' response to that will be the services themselves proxying the tracking along with their own data. The only answer at that point is abstinence... or (possibly) WebASM anti-virus.

    Dark days of ubiquitous black boxes ahead.
Your Job Suck?
Get a Better Job
Add Comment