4 ms·
> No, but only because I used other backend languages and frameworks for that, because there are much better languages suited to those tasks than JS. Good luck
by curtisblaine 2y ago
> No, but only because I used other backend languages and frameworks for that, because there are much better languages suited to those tasks than JS.
Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there.
> Or just use JQuery and some modules
This is incredibly ignorant :)
jQuery solves maybe 10% of the problems I listed, and does that imperatively, so you get in the exact same issues, but with a marginally better interface to the DOM. Which is not even true nowadays, as the js DOM interface got a lot better.
> The fact that "vanilla js" even exists as a term demonstrates how pernicious this fear has become - there is no "vanilla x" any other language.
Wait, do you normally write Java with no frameworks? Handle request / responses / queues / threads from scratch?
- krapp 2y ago>Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there. That's exactly the point. 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs. The modern JS pipeline and ecosystem exists for those applications, as it was developed by Facebook, Google and the like, but it's far more complex than most people actually need. The baseline for web development shouldn't be "install NPM and node and n frameworks, learn test suits a,b,c and this completely different language." >jQuery solves maybe 10% of the problems I listed, and does that imperatively, so you get in the exact same issues, but with a marginally better interface to the DOM. Which is not even true nowadays, as the js DOM interface got a lot better. I was specifically making a comparison between using JQuery and script tags versus NPM dependencies, but JQuery still solves far more than 10% of the problems most people actually have. Because again, most websites aren't startups trying to optimize to compete against FAANG. >Wait, do you normally write Java with no frameworks? Handle request / responses / queues / threads from scratch? I think you're being purposely obtuse here. People write Java frameworks in Java. It's still programming in Java. You're still expected to understand the Java language to use Java frameworks. Javascript is primarily compiled from other languages which use their own idioms, often imitating far more strictly typed languages. JS devs are primarily people who hate javascript and wish they were using another language, and much of the unnecessary complexity of the modern JS ecosystem exists to capture the labor market by catering to that desire. Which is why "vanilla js" is a phenomenon unique to Javascript. Other ecosystems don't have the same culture of alienation and aversion to actually using their language.
- curtisblaine 2y ago> That's exactly the point. 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs. That's what I said n comments ago. If you don't need a highly interactive app, you can do with HTML and CSS only. > People write Java frameworks in Java. It's still programming in Java. You're still expected to understand the Java language to use Java frameworks. I hate to break it to you, but React is 100% written in javascript and you interact with it writing javascript. It's a library, not even a framework.
- curtisblaine 2y ago> Javascript is primarily compiled from other languages which use their own idioms, often imitating far more strictly typed languages. I'm not sure which languages are you referring to. Typescript? It's Javascript with types (minus enums, which are discouraged). Elm, Purescript, Clojurescript, Gleam? Great languages, but they represent a tiny fraction of the real world fronted applications > JS devs are primarily people who hate javascript Modern javascript? Are you sure you're not projecting the fact that you hate it?
- krapp 2y agoBy "modern javascript" I refer to both the language and the ecosystem of Node, NPM, Typescript, and related technologies that have become so ubiquitous as to be inseparable from the language to most people. I don't hate javascript, I'm not one of those "javascript delenda est[0]" people who go off on rants about the language whenever it comes up. However, I don't like what the language and ecosystem have turned into, and I don't like many of the incentives that brought those changes about. What used to be a community driven ecosystem has been captured by VC and corporate interests. Admittedly, I also don't like a lot of the more recent features added to the language like classes and templates, because I'd prefer javascript remain simple and avoid feature creep. [0]https://hn.algolia.com/?dateRange=all&page=0&prefix=false&query=javascript%20delenda%20est&sort=byDate&type=comment https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...
- lelanthran 2y ago> 99% of websites don't need to be "highly interactive apps" like Figma or Google Docs. That's highly conservative; of all the react apps I have come across professionally exactly zero needed React.
- AlchemistCamp 2y ago> ”Good luck writing highly interactive apps backend-only! (Like Figma or Google Docs). Even with frameworks like Phoenix and runtimes like WebAssembly, you still need a lot of Javascript to get there.” You really don’t need to write JS directly to make a UI like Google Docs with Phoenix LiveView. You can write the whole thing in Elixir. Thanks LiveView.JS, there hasn’t been a need to write custom JS or hooks to avoid a round trip to the server for UI-only interactions for quite a while, either.
- curtisblaine 2y agoIsn't it a small subset of commands to interact with the DOM though? What if you need to write on canvas, spawn a thread or set up an observer?
- AlchemistCamp 2y agoFor a canvas-based app, which to be fair none of my professional work has been, you’d need to write some JS or hooks to interface with external JS libraries. Can you give me an example of when you would need a LiveView app to spawn a thread or set up an observer via JS? Spawning a thread sounds particularly odd given that JS isn’t running on the server. Are you speaking of web workers? Or do you mean doing something from JS code to send a message to the Phoenix server to get it to spawn a process (i.e., a green thread) on the server?
- curtisblaine 2y agoYeah, I meant web workers. It's easy to find canvas and web workers in any sufficiently complex highly interactive web app. I'm not saying you always find them, but if you're doing some form of graphics you most probably use canvas at some point, if you do non-trivial computation you spawn workers, if you need sound you use the Web Audio API, if you have a complex layout you're better off with DOM Observers, and so on...