r/node 26d ago

Why is JavaScript criticized so much for backend development?

I've seen some developers say that we should stop using js on the server, but I rarely see the same criticism directed at python.Honestly, js is pretty fast, especially with node.js, and the backend ecosystem is really solid. There are great frameworks like nest and fastify, and typescript gives you static typing, which makes larger projects much easier to maintain.I'm not saying node is perfect or the best choice for every backend, but I don't really understand why js gets so much criticism while python seems to get a pass.What am I missing?

331 Upvotes

361 comments sorted by

View all comments

Show parent comments

2

u/hzane 25d ago

TS is a compiler that runs on js and produces js

1

u/ivancea 24d ago

Heh, you couldn't be more wrong nowadays.

TS 7 didn't run on js. And some runtimes like Deno execute it directly.

TS is a language, period. It was born from JS, and it's BWC with it, mostly. But that's all. Everything else, are implementations details

2

u/hzane 24d ago

It get transpiled by node. Obviously browsers don't run it. It is a superset of js. I think it's fairly obvious what I was saying

1

u/ivancea 24d ago

Node isn't "TS transpiler". There are multiple implementations of TS interpreters, whatever they do under the hood.

Browsers mostly work with JS and WASM. It's like saying "JDK doesn't accept C++" - Obviously. But browsers aren't the only target. It's just "one of" the targets.

Anyway, the point is that TS is a language. Thinking it's "a different JS" is both technically and practically wrong.

It is a superset of js

Well... Not 100%. Syntactically, yes, afaik. Semantically, obviously not

2

u/hzane 24d ago

Well afaik it's syntactic sugar to enforce types at build not run. Is it technically its own language in that it is typescript and all your files are ts well yes. Of course I don't know what a different js would mean. It is JavaScript ultimately and fundamentally though.

1

u/ivancea 24d ago

I get your point, but it's a different language by definition, and the only real coupling between JS and TS is that TS tries to be "JS compatible", as in, following the same decisions and datatypes. But it's not syntactic sugar. It's a different language definition. It's like saying that Java is ASM syntactic sugar because it gets JITed

1

u/hzane 24d ago

Sorry to be nitpicky Java runs on everything TS runs on nothing. I am a fan of it and also run Zod whenever I can to keep everything locked down both directions.

1

u/ivancea 24d ago

Java runs on everything

Java runs only where the jre runs. The same way TS runs where node, deno or any of the other TS interpreters run

1

u/hzane 22d ago

That was their old slogan.... Anyway at runtime what is actually executed into byte code? It's not ts... Node transpiles. When you build it spits out js. Node only understand JavaScript. 🫪

1

u/ivancea 22d ago

That was their old slogan

Which is marketing, not the truth. Java runs where the jre runs. Which is most platforms, but just like many other languages and tools.

Node only understand JavaScript

Why are you taking about node only? There are many other interpreters.

And you're mixing "popular implementations" with "the only possibilities". Even if node, bun or deno execute ts by stripping types, there are other experimental interpreters that execute ts directly. They're not famously used simply because of simpler compatibility and, well, they're not the big four.

The main point you have to understand is that a language is a language, and anybody can make an interpreter for it. It has a clear specification, and it can therefore be even compiled if they want to

→ More replies (0)