4 ms·
The sooner JavaScript haters assume there is no way around it, the better we'll all be. I do like a lot Livewire, Hotwire, Unpoly, HTMX, etc... but using these
by midrus 5y ago
The sooner JavaScript haters assume there is no way around it, the better we'll all be.
I do like a lot Livewire, Hotwire, Unpoly, HTMX, etc... but using these tools (or any backend language compiled to wasm, etc,etc) as a way to try to avoid JavaScript is never going to work and will only cause pain and terrible applications.
Even with those HTML first technologies (which I like a lot) you need to learn to accept JavaScript is just another tool and one that you will definitely need to learn and use to make anything decent.
It is great to have a framework such as livewire that when you click a button to "load more" will render the new items in the backend and just swap out a placeholder and done. No JavaScript, no API, etc. Amazing.
It is just *terrible*, flaky, unresponsive, overkill and absurd to reach for the backend to re render a bunch of html because you needed to toggle a class or hide a box.
Use the right tool for the job.
I'm really tired of backend developers hating on JavaScript the same I'm tired of JavaScript developers hating on PHP, etc, etc.
Different tools. Different tasks. Let's not try to be purists and "JavaScript all the things" or "I'm not touching JavaScript because it sucks".
- pull_my_finger 5y ago> Use the right tool for the job. This is a strawman. I never claimed one should use Liveview for all web work. I'm just saying people _want_ to do web stuff with languages other than javaScript. javaScript is only "the right tool" in the sense that it's the only one that's native to the browser. If they substituted javaScript with any of the other popular general purpose languages no one would be any worse off for it (not factoring in the ecosystem built around it). javaScript doesn't have any features that make it better suited for the web than other general purpose languages. It's _only_ real advantage is that years ago a decision was made to create and use JS (edit: ..in the browser) and we've all been stuck with it since.
- midrus 5y ago> If they substituted javaScript with any of the other popular general purpose languages no one would be any worse off for it This is what I'm talking about. This is not going to happen any time soon. And all attempts to do this only lead to more confusion. It is easier to just learn it and help making it better. The language improved a lot over the last few years so I don't see why replacing an entire ecosystem, browser implementation, libraries, writing transpilers, etc, etc, etc can be any better than just learning to love it as the tool it is. And let's say in some parallel universe it could be replaced. What is it going to be replaced with? Go? Python? Rust? Everyone has a different opinion so there is no agreement possible. And having any and every language available in the browser is just a wild dream. So, yes, JavaScript is not perfect. And probably there are a ton of better languages but trying to avoid it and write everything in Go/Clojure/Python/Whatever is ridiculous. That won't happen any time soon. Not using JavaScript is just self inflicting limitations oneself.
- pull_my_finger 5y agoPlease note, my original comment was simply correcting the notion that JS is popular because it was especially well suited for working on the web. I see projects like Fengari[1] and would _love_ to use something like that but I recognize I can't impose an extra 300kb on end users just because I want to write in a more pleasant language to develop. I accept that JS is what we have, but I won't pretend like JS was the cream that rose to the top. [1]: https://fengari.io/ https://fengari.io/