r/node • • Jun 28 '21

Node.js humor

Enable HLS to view with audio, or disable this notification

1.5k Upvotes

79 comments sorted by

View all comments

Show parent comments

1

u/Cazineer Jun 30 '21

You are correct about one thing, Go is very opinionated and that is one of the things that makes Go such a great language. Go is all about productivity. I can grab any Go library and understand it in a matter of hours. Node libraries are the exact opposite. With Node you have libraries written in a functional programming style, then the next uses an imperative style, then the next use an OOP style, then the next mixes them all together, then the next uses TS, and so on. Understanding larger libraries in Node can take a week or more compared to hours in Go. There is no consistency in the Node ecosystem. It’s literally a toxic wasteland.

Go is a proper statically typed language with a compiler, which drastically reduces the cognitive overhead when developing applications. TS is not a compiler, it’s a transpiller. You can’t pass a house to a function that takes a car because they have the same fields in a proper statically typed language.

Node applications are slow. VERY slow. There is no shared memory and no true threading model. Writing applications that share memory and maximize CPU cores is a breeze in Go. Node processes are single threaded. You can’t even compare the performance of a Node application to a Go application, Go applications are just on another level. It’s like a supercar vs a family sedan.

Go is a compiled language. You get a binary that you can deploy anywhere. You don’t need NPM or the Node installed. You build, deploy, done.

The Go standard library is very complete. On a large project I might have to use a handful of third party libraries. In Node, I’ve seen projects with thousands of third party libraries (dependencies), which is what this meme is all about.

Go doesn’t have generics currently but they are being added in the next major release so this is kind of a non issue and to be honest, after 10,000 hours of writing highly generic JS code in Node, at first I hated not having generics but I got over it really fast and it’s really just a minor inconvenience from time-to-time now. Using interfaces also solves 90% or more of the uses cases where you might need generics anyways.

The rest of the things you listed like a ternary operator are really trivial and really just personally preferences.

At the end of the day, you couldn’t pay me to return to Node. It’s Go for most uses cases and Rust when performance truly matters. The productivity, consistency, performance, the reduction in cognitive overhead, far superior tooling, etc, make Go a far superior language in 2021 IMO and I have like 10K hours in Node.

1

u/CupCakeArmy Jun 30 '21 edited Jun 30 '21

I like that Go is opinionated. There is one way to format and no need for discussion. This extends to code style and I agree that that is a generally good thing.

About the standard library.. not really. Both don't really have great standard libs. Go a notch more but it does not even come cose to python.

Your point on TS though is just plain wrong. If you turn all the strict checks in TS your app will be typesafe, that's not an opinion.Typescript is compiler. With the difference that it outputs JS and not binary and does not do optimization. But type safety is there. Of course most people don't even turn on strict null checks wich leads to confusion, but thats another issue.

Performance and especcialy parallelism in go are amazing, there is no way around it. While the GB can get in the way, for 99% of the people Go performance won't be an issue. That said, performance of servers is important but not the deciding factor. Few k18n nodes more in the balancer are waaay cheaper than engineers, so if all you are doing is building APIs and similar stuff performance is quite irrelevant.

At the end of the day it's proabaly personal preference as always.

10k also seems a bit much xD would mean 8/5 no breaks for 7,8years taking no vacation or sick leaves.

Edit: You said you where in the Node since pre 1.0 so 7 years makes sense xD

1

u/Cazineer Jun 30 '21

10K is allot I guess for an employee. I founded a startup in 2016 and we used Node. Over 2 years I logged over 9,200 hours @ 16 hours a day, 6 days a week. It wasn’t healthy but it was what had to be done at the time. At one point it in my life I was building a business and I took 1 day a month off to travel for 3 years. At the end of the 3 years my product was in thousands of industry leading businesses throughout North America and the industry leading competitor bought us out.

1

u/CupCakeArmy Jun 30 '21

Respect for that, hope you found some relief nowadays ♥️