Ask HN:The Problem of JavaScript

6 points by sophoskiaskile ↗ HN
Why do we keep torturing ourselves by using Javascript? Don't get me wrong. I know most of the problems in this context are subjective, But my question is more of a fundamental question. And by this question I'm not seeking an idea for creating another Specific language. We already have so many great languages to revive. I think this is the time for programmers to think this through. Because our technological world which is build upon a code garbage garden is already at its worst. Please discuss this matter. I'm actively looking for discussion around this topic. Many Thanks.

8 comments

[ 3.1 ms ] story [ 32.3 ms ] thread
This is a bad in spirit ask.

My own tentative belief is that languages are just not that important, as it turns out. Most of them do mostly the same things, and JavaScript is not really exceptionally better or worse than most languages.

There's, alas, a tribalism about what language folks pick, and that can lead to bias & ardency & dogmatist modes, where folks want to feel different, want to have identities. And JavaScript is by far the biggest player today, so being anti-JavaScript is the most obvious shared second mode, is a target painted on the back.

> Because our technological world which is build upon a code garbage garden is already at its worst

There are definitely things not great about JavaScript, but overall it's quite competent & can be used well. I think the main issue is that whatever is most popular is also going to be poorly used & wild, amid tons of getting it right & doing well. JavaScript's other main flaw is just that it has a long history, that there's such a long arch of tools technologies & styles, and there's not a clearly defined modernized culture that has yet emerged to provide clear shape forward: esm is slowly happening, typescript is highly adopted, but we're still rapidly redeveloping the tool chains, which alas, are all too necessary at the time. (But also, JavaScript is one of the few languages one can use with zero tool chain too, which is a great & brilliant aspect of it).

Seemingly the only way we get nice neat well structured languages+libraries is if there is a Benevolent Dictator situation writing the whole platform. It's kind of a Conway's Law notion, that only a highly heirarchical power relationship with centralized authority can produce such a well structured work (but perhaps there might be other ways to evolve Big + Well Structured platforms, exceptions to Conways Law). Apple is kind of this now. The realest example comes from history, where there were Microsoft's with expansive .NET platforms that were everything-and-the-kitchen-sink top down approaches, where folks almost never brought in 3rd party libraries at all. But these are evolutionary dead ends, lack diversity & a marketplace of ideas: they may have some great parts, but over time the not-so-great parts grow, or other forms of exceptionalness in development come along & the platform is not well positioned to assimilate the new. Trying to be highly refined & opinionated & having strongly kept good paths feels rugged & enduring & well-crafted, but that assurity of strength often belies a fragility & stuckness.

I think a lot of people dislike the Bazaar (of "The Cathedral & the Bazaar") mode, want something more obviously refined, but it's been the iterative & open & exploratory nature of JavaScript that's let it lead, that's allowed it to keep expanding & serving new styles, new architectures, to do new things. The language (& it's infinite pick of options) has not hindered expansion & use, where-as many languages have more fixed constraints/restrictions (& much less platform). I tend to align towards Wall's Perl, the first postmodern computer language, as it highlights how borrowing & using & stealing techniques opportunistically enables us, and see what we have with JavaScript as a great example of what a broadly flexible competent language can do, especially as a vast library of easy-to-make modules spreads out around it.

I think there's a lot of ways to debate what's good & bad, what we're looking for. There's also a lot of historical context specifically around why JavaScript has taken over, chief among them being the technical constraints of JS being the only technical option for the only important online platform on the planet. Wasm is coming to enable new choices. Just my take, but I'm mixed on that: I welcome the exploration & am excited to see (and post-m...

It reads a bit like a loaded question. IMHO Javascript is fine and so are dozens, if not hundreds, of others. Maybe you can join the discussion with your background and context. I see the HN account is 8 months old without a comment yet.
Tyranny of the adequate. JS won in the browser, despite HTML being designed with the intent of supporting multiple languages, because it was adequate to the task (scripting the DOM.) JS won everywhere else because the web was (and thus JS developers were) ubiquitous, easy to hire, and low cost. HTML and CSS are adequate replacements for native UIs. A web app wrapped in a Chromium instance is an adequate replacement for a native application. The SV startup mentality at its finest - the least amount of effort to ship something as fast as possible, quality be damned.
Why do we? Assuming a need for interactive web content, what are our alternatives in pragmatic terms?

0)No scripts, each interaction is a round trip to the server

1)Minimally scripted pages with classic SSR

2)Full blown apps compiled to WASM and rendered on canvas

Even if we goto 2, we still have some minimal wrapper JS. I'm not sure we can escape it at this point. The best we can do is minimize our exposure.

I truly appreciate your time. But under today's world circumstances If we wanted to stick to the options we had. We would be still punching card for basic tasks. I'm seeking goal-oriented progression. If I want to be honest My question is a little bit more of a root-seeking question. I can not understand The urge for only using javascript in modern day web browsers. (BTW it was cool one starting your lists from 0 :))
Perhaps the way forward is using the language of your choice as a WASM blob. If it becomes popular more tooling to expose the DOM directly to WASM will emerge. We still have the backend as a JS free zone.
I'm primarily a mobile dev, so I generally don't have much choice in the matter of what languages I use (Swift, Java, Kotlin).

Occasionally, for a side project, I'll need some sort of back-end. This usually means I need to get some data from somewhere, process it a bit, store it and then ask for it at a later date. JS (Typescript in my case) is more than adequate for this, and if I add Redis and Nginx I can get away with paying very little for a VPS to run it on quite reliably.

The JS landscape has lots of problems, but I don't wade too deep into it so I'm mostly content.