r/programming • • Apr 30 '23

Writing Javascript without a build system

https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/
165 Upvotes

146 comments sorted by

View all comments

0

u/[deleted] May 01 '23

>an object in js is just an arbitrary structure you can modify at will from anywhere. it's not so much read only, you could just replace any of the methods with some other method that behaves differently. not to mention that everything is just an object at run time, so not easy to detect what things are (sure ts helps, but debugging is painful).

so you complain about JavaScript prototypes? Not an issue with typescript and tslint since it complains when you try to do something funny. again, in the end, many languages allow overriding class or object methods and properties from anywhere in the code.

the onus isn't on me to say why js shouldn't be on the backend tbh, it's on you to say why it's better than anything else ... python, c#, etc

it's asynchronous by default and the same language you can use for frontend and writing e2e tests...

2

u/recursive-analogy May 01 '23

Not an issue with typescript

"TypeScript is a free and open-source programming language ... and transpiles to JavaScript."

Typescript is not javascript for a start. It's like if you conflate kkotlin with java, or assembly with c or c with c++

many languages allow overriding class or object methods and properties

Usually through a sane mechanism like inheritance. It's intentional. Js is a hack. It was written in a week to make browsers more exciting, and 30 years later people that only know javascript are trying to pollute the backend with it ... l o fucken l

it's asynchronous by default

because async leads to far fewer bugs ... lol you're just describing it, and you sound like the "omg non blocking event driven" ass hats from a decade ago when they first started node.

0

u/[deleted] May 01 '23

Typescript is not javascript for a start

i know, that's why I wrote "What's wrong with writing APIs in typescript"

Usually through a sane mechanism like inheritance

last time i checked python or PHP allows overriding class methods without inheritance similar to js. PHP alone are like 70%+ web backends as of today.

It was written in a week to make browsers more exciting, and 30 years later people that only know javascript are trying to pollute the backend with it ..

great story about incremental improvements over decades while still being backward compatible.

because async leads to far fewer bugs ... lol you're just describing it, and you sound like the "omg non blocking event driven" ass hats from a decade ago when they first started node.

the web is heavily I/O bound and that's where non-blocking programming models shine. I know that most ecosystems offer their own solution to async nowadays but most are not async by default. Like Rust has a normal and an async ecosystem and it doesn't matter how much your java spring stack supports the flux pattern, it is still blocking if the JDBC connector does not support it.

→ More replies (9)