36 points · by thunderbong · 2y ago · 84 comments
TC39 has done a great job shaping the language over the years. New capabilities are usually well thought out & integrate well. Async await has been amazing.
The one major miss that makes me so sad and frustrated is modules; js has gotten better everywhere except it's near requirement for build tooling. Being able to throw some scripts on a page and go is still an unparalleled experience in the world, is so direct & tactile an experience. EcmaScript Modules was supposed to improve things, help get us back, but imports using url specifiers made the whole thing non-modular, was a miss. We're still tangled & torn. Import-maps has finally fixed but it's no where near as straightforward, and it still doesn't work in workers, which leaves us infuriatingly shirt of where the past was. https://github.com/WICG/import-maps/issues/2
I've been working with CSS since its invention, I get by OK, I can use it a hundred different ways, but I would never consider it straightforward.
It's powerful, it's evolving, it's useful, but simple it is not.
WYSIWYG is terrible for the web not because of the languages used. It just does not make sense.
And responsive design not only means mobile, it means all screen sizes and includes other factors.
Flexbox is a good example for this.
The real issue with CSS is the eternal question of, do I fill my parent or expand to fit children? You have to trace multiple levels and rules, and even then it might be a guessing game. This is because the rules that govern this can change at each level, and that changes how you answer the question.
I have been using CSS for 20 years. It’s too difficult for what it primarily does.
I wouldn't mind a GUI where I put constraints to the elements visually and then check the different ratios/sizes I want to support and bam, done.
As a field we're under a general assumption that it makes sense to do visual work textually. Just because WYSIWYG tended to be overly verbose and used by "noobs" that it's not how it should be.
Imagine most people making music by just writing notes and then only playing it back afterwards.
But not having easy drag and drop at the component level, and having instead to cut and paste chunks of code, makes it slower and more error prone in my experience.
I think the problem is not so much about JS as a language, but about the amount of low quality libraries and frameworks that make it more productive.
A lot of what could be static sites use JavaScript.
CSS may be tricky to some (I'm still lost with flexbox), but what I've found particularly helpful is using some already finished CSS stylesheets, then just modify them to my needs. Like PicoCSS, MVP.css and more.
Like the post says:
Sometimes, people get angry at React or other FrontEnd frameworks just because they look scary or too complex. But the reality is, FrontEnd is complex.
I have been avoiding React and similar frameworks with a belief that they introduce complexity, but also that they make the site perform slower, produces less traffic either due to hardware restrictions or download speeds. These are valid concerns to consider. Vanilla JavaScript and so on is already pretty simple, I wouldn't be too opposed to the use of jQuery as it can make some things simpler. But in the same way a few of us avoid front-end frameworks like the plague, a lot of front-end developers choose frameworks due to a lack of familiarity with standard / vanilla technologies.
I think what's even more interesting to note is the support for modals with regular HTML and other such features, so that one can depend less and less on JavaScript. (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/di...)
Did like the write-up on HTMJS though.
From that link: "JavaScript should be used to display the <dialog> element."
Thank you for correcting me.
I've written JS/TS that has run across so many different runtimes over the years, and it has endured. Dozens of browsers, NodeJS, iojs, Deno, Johnny Five, Rhino, Nashorn, LLRT, React Native (JS Core & Hermes), Electron, and more.
If you still think JavaScript is not "a proper language" today in 2024 you're giving off serious junior engineer energy.
I would not be surprised if JavaScript gets the reputation of 2012 PHP in a decade.
I think it's the result of a mix of clunky tooling (started with transpiling), OSS maintainers who stopped caring and left a broken mess everywhere and lack of static typing (+ dissatisfaction with TS, despite it being the only sensible option for types), the diffusion of JS in uncool corporate workplaces.
I still think both PHP (which I've used extensively between 2006-2011) and JS are fine languages with a few defects.
In 10 years, who is going to want to open up that unmaintained enterprise NodeJS project running on now-ancient Angular or React? Heck, what if it used Vue 2?
It’s probably going to be worse than what editing a decade-old PHP project feels like now. That’s if it even builds with just one year of no maintenance. At least the PHP project didn’t rely on packages as simple as leftpad or is-odd.
I expect JS/TS's reputation to only grow more favorable over time. The pragmatic path of its evolution and the resources invested into improving it over the years have really made it shine.
What the hell are you even talking about?
> I would not be surprised if JavaScript gets the reputation of 2012 PHP in a decade.
What year are you from? JavaScript already passed that stage with ES6.
I think you should always use JavaScript, unless you are NOT IN A WEB BROWSER. In that case virtually anything is a better programming language. JavaScript is a 1,5GB of RAM consuming to-do application that would take 100MB if built with native frameworks. JavaScript wastes so much energy on this planet that it's the second most energy wasting technology after crypto.
I wish I never bitched about PHP in the 00's if I knew it would be replaced with this 5000+ dependencies for "Hello World" JavaScript hell.
JS is a proper language. Modern JS is beautiful - and I say that as someone who is Kotlin developer on a day to day job. Sure it has its warts, but you need to take into account its age and how widespread it is.
Now only a couple companies can make a safe web browser (apparently, so they claim).
I'm betting on a Rust framework (leptos is pretty nice!) being the next shot at the problem, but nothing with wasm as bundle size actually matters.
This also means… we aren’t necessarily stuck forever with HTML, CSS, and JavaScript. We could make a new scripting language. We could make a new markup language - or, better, explore different paradigms that might be more suitable. Maybe there’s a better way than having a DOM in the first place. We’ll never have that discussion though if people are forever convinced of JavaScript being the pinnacle.
I say this as a person who is more willing to question whether ridiculous levels of abstractions means the underlying technology perhaps needs changes.
Web browsers that don't use HTML, JS, and CSS simply wouldn't be web browsers, that would be something else entirely. And anyone is free to try to make that application using any tech they want, but it won't be widely adopted or supported the way HTML, JS and CSS are.
I can’t believe how far modern web jumped. Development process, modern ES features, reliable CSS, amount of learning resources.
I will never understand why would you sacrifice all of this for something like Compose/Flutter, with their janky web performance, clunky, baroque toolchains and nonexistent (compared to pool of JS developers) mindshare.
To start with Compose you need to:
Install Java
Install Intellij
Somehow generate working project
Wrestle for half a day with Gradle
Search for ever changing APIs or updates
Find a way to reference html and CSS
Somehow connect all of this together and finally launch in the browser
After that - good luck debugging black box generated by Kotlin compiler
And now compare this to JS/CSS/HTML:
Most likely you already have modern enough browser
Create file wherever
python3 -m http.server
Done.
I was just creating a UI with IMGUI library and found it immediately more pleasant to work with. No DOM, no CSS, no HTML. Just C code with a small number of low level abstractions provided by the library.
Also, “just learn JS” is a lazy and off-the-mark response to complaints about having to use JS. Do I prefer Python? Yes. However, I’ve pretty extensively learned and used JS, and I teach a full-stack JS bootcamp. I still think insisting that everyone has to write lots of JS __just_because__ it’s the language that got integrated into browsers is a bit tyrannical.
You call that tyrannical?
It's easy to find the code that does something, easy to understand what it does and easy to modify it to do something else.
Sure, I wouldn't want to maintain an app with thousands of lines of HTML and JavaScript that works like that, but for a single simple feature on a page that isn't doing anything else I don't see the problem.
all the HTML is generated with python and transferred with ajax calls. it's inefficient, but it works well and it's easy to maintain.
there is as little js as possible
I pulled my hair figuring out those pesky async js things, but I'm happy, it works well.
I would gladly use Typescript if I could use it without nodejs, I guess there might be a typescript compiler for python?
Anyways I am glad I was able to take advantage of js while writing as little of it as possible, it feels like a big achievement.
I think there is never really an excuse to be “too aggressive,” the most strenuous opinions can be expressed without threats of violence or slurs for example.
However, people who develop websites that require JavaScript are contributing to this absolutely terrible ecosystem where people just download programs from the internet as a side effect of browsing and run them without even knowing it. That’s wildly insecure as a ground state.
To try to push things out of that wildly insecure ground state, the convention has been to create these very advanced sandboxes. Putting aside the fact that they fail fairly somewhat regularly, only three companies have had success in this endless battle. Apple and Google, by dint of having infinite money to throw at it, and somehow Mozilla using magic.
As a result of the fact that making a web browser now requires constant security fixes, no small organic community projects can create a web browser. We’re living in the failure-state of the idea that the web should be this open standards-based platform.
So, yes. I get that people have to write JavaScript to put food on the table. But it is a choice that has been made at the expense of the rest of us.
This is why that comment is getting downvotes. Javascript running in a web browser is probably one of the least insecure ways to run code that exists. It's been developed for almost 30 years to be secure, an attacker can't just do whatever they want on a system, there are many safeguards, and many smart people concerned with keeping JavaScript safe to run in a web browser. It isn't the same Javascript that it was 20 years ago so the "insecure" argument sounds like you really haven't kept up with the evolution of JS and web browsers.
It is possible that that is why my comment is getting downvotes, but if that is the case, I think it is not a great defense; I think I handled it pretty well in the next paragraph.
Many smart people shouldn’t be wasted on such an impossible task, and it shouldn’t require many smart people to start a little web browser.