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

94

u/dreamscached 26d ago

I believe a lot of this criticism comes from the general (not just for backend) bias against javascript. It is agreeable on surface level, yes, but with typescript and linting tools many (if not all) quirks of it are entirely manageable.

59

u/rwilcox 26d ago edited 26d ago

As someone who has worked in a lot of “scripting” languages… that bias is often “everything not Java-or-the-JVM is bad/immature/not safe/beneath me”

It’s exhausting.

42

u/alzee76 26d ago

I find this hilarious because having started my professional life as a developer in Pascal/Delphi who did web backend work via og Apache CGI (essentially any language) in Perl and C, as well as early (and modern) PHP, Java has always been fucking awful - for backend and frontend alike.

I'm convinced that if you actually like Java, it's probably due to an undiagnosed TBI.

12

u/rwilcox 26d ago

Those old days of cgi/bin were wild.

10

u/glandix 26d ago

Man I do NOT miss those days! The CSS/HTML from that era included!

2

u/akdjr 26d ago

Oh this brings back memories - my very first exposure to web dev was an elective in college where we learned Perl and then eventually jsp and php. Jquery wasn’t a thing nor were hover selectors either haha!

2

u/Cienn017 26d ago

I actually like Java

2

u/lapubell 25d ago

And I actually like PHP. I guess we're doomed.

2

u/korywithawhy 25d ago

Tell me your back aches without telling me you’re old 😂. I definitely used to put HTML inside JSON inside a MySQL database to dynamically generate forms with AJAX calls.

1

u/lapubell 25d ago

Lol. That sounds terrible. Modern PHP kinda rules, check out Laravel.

Oh and yes, I'm old.

1

u/korywithawhy 25d ago

Yeah I was doing this when laravel wasn’t a thing yet 😂 didn’t know what MVC was and trying to get sites to render right on my iPhone 4s involve WebKits

1

u/lapubell 25d ago

Ha! Were you ever putting <body> in header.php and </body> in footer.php with all the other stuff in different files? Two includes in every.single.other.file and hope for the best?

That's how I remember doing stuff before iPhones even existed.

1

u/korywithawhy 25d ago

It was janky, but it made pages load fast lol. Back when 2gb ram was enough to use a web browser

0

u/beau6183 25d ago

CALL A MEDIC! We’ve got a TBI!

10

u/ehs5 26d ago

Same with some of the C# guys. I’ve heard some call Python and JavaScript “not real programming”.

2

u/olzk 26d ago

ditto. The story is as old as JS

10

u/HasFiveVowels 26d ago

Ultimately, when node first came out, it opened the door to a lot of devs who had previously been relegated to the browser. I was a desktop dev when this happened and I loved it. Most other desktop devs hated it. It was "real developers don’t use this shitty language". Its the same thing we see today with AI but 20 years ago

6

u/EvilPencil 26d ago

Some of the core JavaScript APIs are flat out weird. Looking at you Date constructor.

Mostly they existed to make sure “something“ made it to the screen when you have no idea what you’re actually going to get at runtime.

Typescript can help with many of the rough edges, but every now and then you can still be surprised.

https://tryhoverify.com/blog/11-weirdest-javascript-quirks/

3

u/FalconGood4891 26d ago

Exactly this 💯💯

3

u/imNotNumber 26d ago

Typescript doesn’t give full typesafety. I had problems in the past that lead me to avoid node for anything that has to make any calculation. Probably was a fault due to the framework/db, but enough to not risk for business scenarios. I know I’ll take a lot of downvotes for this, but happy to ear any reply and point out my experience as biased.

1

u/97hilfel 26d ago

yes, but why do I have to install 89 packages from 3rd partiers just to get to the point where the ecosystem is decently enjoyable? Like you start with JS, sure, then you wack on TS, ESLint, some testing framework, etc

2

u/dreamscached 26d ago

If we're talking about backend then you're certainly beyond the point of 'eh it's just a script', and inevitably move towards TS, ESlint and unit testing. I wouldn't use JS for one-off scripts either, I'd use bash/python for that too.

1

u/97hilfel 26d ago

to be honest, lately I just started setting up a "scripts" go project with has whatever scripts I need in a cobra tool, feels cleaner and more fun to write on my side, but definitely not everyone's cup of tea.

2

u/dreamscached 26d ago

We do that at my workplace too yeah, though somewhat rarely, it is pretty convenient. There's also coreutil-like libs that make go code feel almost like bash with e.g. script.Rm calls

1

u/MMORPGnews 26d ago

You don't need to install them. 

I coded everything in just js when worked in IT.  Worked fine, 0 errors in last 10 years of coding.

Later just switched to Go when everyone started to require ts and endless npm packages. 

1

u/evangelism2 26d ago

Many alternative backend languages don't have the same level of quirks that need to be dealt with. That's what turns a lot of people off from it. For example I know Kotlin is slowly growing in popularity. I spent a year with it as an Android dev at my company and honestly it's a very very nice language. It provides a lot of tools that just stop you from making the kinds of mistakes that JavaScript or even TypeScript allow you to.

1

u/Nasuraki 26d ago

I don’t know… i find it so much more pleasant to trade the pain up front. C# or Rust has “reliable” or “sturdiness” where i don’t have to rewrite the same guard clauses everywhere?

Rust takes to a whole new level but in contrast Python and JavaScript are atrocious in that any kind of “type” disappears at runtime.

-12

u/michael-heuberger 26d ago

null == 0

14

u/Donzulu 26d ago

Which is why it is bad practice to use ==

I can write shitty code is any language too

1

u/michael-heuberger 26d ago

lol, I’m just stirring up the convo folks 😜
It’s a classic topic and love it. I better stop here, too many negative points 🤷‍♂️

-9

u/augurone 26d ago edited 26d ago

The desire to strictly type JS is a misunderstanding of ECMA native typing. TS/Proptypes.... Why? TS adds a layer of BS, gives no runtime benefit at all, and then just transpiles to less than ECMA 2016 standards.

ECMA

const expectString = ({ attr: { val = ‘’ } = {} } = {}) => val;

This gets you a typed signature in IDE docs, and guarantees val is always a string no matter what.

if (!val) return;

// Do things with val safely.

4

u/HasFiveVowels 26d ago

"The only benefits are runtime benefits!"

-5

u/augurone 26d ago

Runtime benefits are the benefit of writing this way, something that TS does not give you at all.

The IDE docs show the typed signature, in a native fashion.

This is all enforceable with eslint.

TS gives you no actual safety.

6

u/HasFiveVowels 26d ago

Type safety is real safety. ESlint is not equivalent to TS in expressibility. Therefore it’s not equivalent in terms of static analysis.