by echelon · 6y ago · 0 comments
The author isn't just a React apologist, but also seems to want javascript everywhere.
So much of this debate - sever side rendering, etc. - has to do with the inefficiency of DOM. Mobile and desktop UI toolkits aren't DOM for a reason. They do application UI and have application concerns, meanwhile JS is sitting in this weird Frankenstein ducktaped documents-and-apps markup world. An ecosystem that has to support a million (often competing) things, but all slowly, and with decades of legacy we can't break.
It's going to be interesting change of landscape when we have isomorphic Rust/Wasm delivering truly native web apps that don't render on top of the 30 years of DOM kludge.
The Rust community is just getting started and hasn't had a long time at this, but there's already some really impressive UI work being done in the browser with Rust/Wasm [1]. Once Rust frontend frameworks begin to arrive, it'll be a whole new ballgame. It's so damned fast.
God forbid. I happen to like adblockers, inspecting app DOM, and applying custom styles and features with browser extensions. I can customize even poorly-built web apps like Youtube and Facebook with enough poking around and custom selectors. It's great.
Don't bring native UX sensibilities to the web, or we'll retaliate by pushing Electron even harder for cross-platform native development. And yes, that is a threat. ;)
Every time this conversation comes up, I make the same point: the DOM is not a layout tool, the DOM is a user interface. The DOM forces you to give your users a pure-text representation of your current state -- it forces you to think of your current state as an XML-like data object before it allows you to think in visual terms. That's the point: your user interface is XML, not pixels.
Imagine if every native GTK app forced you to come up with a universal text interface that worked in terminals before it would let you add any of the weird keyboard handlers and unresponsive layouts and HDPI-unfriendly menus on top of it. That is how the web do.
This is weirdly lost on HNers every time this "debate" comes up.
Native apps are the wet dream of any website they complain about for having too many trackers and ads and data exfiltration.
The web browser is a fluke of history that gives users power that we don't have with native apps. Let's not be so quick to give it up just because you've never mitmproxy'd your phone to see what it's doing.
That is why I stopped consuming Reddit, Twitter, and Facebook - they aggressively push their shitty battery consuming apps that I don't want to use.
Apart from "apologist" not really being a term conducive to constructive discussion, I think, the author is also the author of one of the main competitors to React (Svelte), and has often and strongly criticised it. (Which is not to say that he hates it, but just to point out that "apologist" isn't really correct, and thus that it could be that the article is triggering some defensive reflexes that might not be entirely justified.)
Maybe reinventing the whole damn car on canvas isn’t a great idea either. I bet that the keyboard isn’t the only part that doesn’t work.
Flash was hated for this reason too: Breaking affordances. Imagine everyone reinventing their own UI framework on each app.
I don't like this argument. It's like saying that because C++ can do everything, we don't need to build a new language to fix problems inherent with the existing paradigm.
Rust is just getting started, so give it time.
DOM is overloaded, messy, and slow. We need an application UI toolkit similar to what Android and iOS provide.
The problem is that by the time you've finished building a WebGL layer that has the same accessibility features and component-level controls and custom shortcut support and extension APIs as the DOM, it will no longer be a snappy, fun, fast experience. What you'll end up with is a second implementation of a web browser that runs on top of a web browser, and that has to be downloaded fresh every time you visit a new website.
WebGL and Canvas frameworks are fast because they allow you to build an interface that does fewer things -- that only worries about pushing pixels to the screen. They allow you to avoid adding the overhead of app-agnostic universal UI components with predictable behaviors, or accessibility layers, or custom font support, or universal shortcuts for scaling, or responsive layout support.
And sometimes you don't need that stuff. Sometimes you do only care about pushing pixels to the screen, or you're doing something very specific that allows you to avoid thinking about edge cases. But if you're going to universally replace the DOM, then you do need to care about edge cases.
Keep in mind, Firefox is also running in C/Rust and rendering webpages using OpenGL. It's operating on the same bare-metal layer. The DOM is already written in low-level languages and rendered out with OpenGL. It's not slower than Canvas because they used the wrong tech stack, it's slower than Canvas because it does more stuff.
I'm very excited about WASM as a replacement for Javascript. And to their credit, that's what the Rust team is doing. For the most part, the direction that Rust is actually going isn't towards WebGL, it's towards getting good DOM access in WASM.
The future of Rust/WASM mostly looks like people writing code in the language of their choice, with speed improvements based on the fact that the language isn't high-level or garbage collected, and then using that faster, more comfortable language to manipulate the DOM, just like we always have.
Quite the contrary.
The author has criticized React openly _many_ times.
He is also the creator of Svelte which mainly aims to reduce the amount of JavaScript web apps are using compared to React, jQuery, etc.
Nothing about TFA indicates that its author is a React apologist. Do those even exist anymore?
Google Sheets has used canvas for rendering for years.
The DOM seems slow, I think mostly because it requires translating between rendering systems - the representation of the html has to be updated, the styling has to be applied, and the change has to be painted on screen. This explains why updating a documentFragment as a batch operation is much faster than changing the dom directly in a loop.