Live data from Hacker News

What dif­fer­enti­ates front-end frame­works

themer.dev

91–100 of 256 posts

Re: What dif­fer­enti­ates front-end frame­works

#91
The way we do SPA is kinda nonsensical because we're fighting the browser. It would be great if we could simply change a value then see the result on the screen at the next tick. DOM is great but not ideal for truly dynamic stuff with lots of things going on, which is pretty much the worst case for the tech.

Really dynamic apps can be really fast with canvas but I am not we have the tools to replace DOM websites just yet. Maybe in a decade.

Re: What dif­fer­enti­ates front-end frame­works

#92
post #16

React is not reactive at all, the "state" management is you calling a function "setState" to re-render the component. And I find manual render very usefull and once you do it, you can have a global state as simple as a global object, no need to use useState anymore. https://github.com/dezmou/useRender

This is extremely inadvisable for numerous reasons and goes against the entire design philosophy of React. In short, injecting a naive render function over the react virtual dom calculation is wildly inefficient.

This piece of code only rerender the component as if you do a setState, in fact it does a setState under the hood, maybe the word "render" is missleading.

Re: What dif­fer­enti­ates front-end frame­works

#93
post #51

Totally disagree with this. Change detection is nothing but a hack to get around the fact that interacting directly with the browser DOM is very slow and blinky. Imagine a world where interacting directly with the browser DOM didn't suck, then none of these libraries would exist. The crux of the problem is that the browser immediately reflects changes to the DOM to the screen. And when you make a bunch of changes to…

That's not nearly all there is to it. If the DOM was fast and you could control redraws, it would still be horrible. A performant big pile of mud is still a big ball of mud.

[deleted]

Re: What dif­fer­enti­ates front-end frame­works

#94
post #51

Earlier quoted context omitted.

That's not nearly all there is to it. If the DOM was fast and you could control redraws, it would still be horrible. A performant big pile of mud is still a big ball of mud.

For example, there's the way it's still impossible to pass data between native Web Components without stringifying it first.

Not via html attributes. But it's never been a problem to pass data via JS properties:

   someWebComponent.data = { foo: "bar" }

Re: What dif­fer­enti­ates front-end frame­works

#95
post #61

Totally disagree with this. Change detection is nothing but a hack to get around the fact that interacting directly with the browser DOM is very slow and blinky. Imagine a world where interacting directly with the browser DOM didn't suck, then none of these libraries would exist. The crux of the problem is that the browser immediately reflects changes to the DOM to the screen. And when you make a bunch of changes to…

I don't see it that way. The main need for change detection in my opinion is to remove the need to update parts of the DOM in an imperative manner. It is fine to do that for smaller projects but when a project gets large, it becomes difficult to reason about the myriad of changes happening without a system to handle that. I find any one of the examples in the linked post way more easy to reason about than manual DOM…

I agree with you that going back to the JQuery days of unmaintainable imperative code would not be a good thing.

But with JQuery I was able to create adaptive UIs by applying 'transforms' to the DOM, I really miss that. Think of the way that 'tag helpers' can apply cross-cutting transforms to Razor Page applications, I used to do things like that with JQuery.

React et al cuts me off from both the browser DOM and it's own virtual DOM, so this I can no longer do this. I have to do everything the React way. Developing with React is far less powerful than JQuery. I still find modern frameworks to be a kind of straight-jacket. I hope to have my transforms back in a rational way someday.

Re: What dif­fer­enti­ates front-end frame­works

#96

Totally disagree with this. Change detection is nothing but a hack to get around the fact that interacting directly with the browser DOM is very slow and blinky. Imagine a world where interacting directly with the browser DOM didn't suck, then none of these libraries would exist. The crux of the problem is that the browser immediately reflects changes to the DOM to the screen. And when you make a bunch of changes to…

DOM wasn't meant for real GUI's and trying to trick it into being one seems a fool's errand. It was meant for static documents. DOM is the wrong tool for the job.

Time for a new state-ful GUI markup standard so we don't have to rely on the whacky DOM to get expected and common GUI idioms.

Maybe build the "engine" on top of the Tk or Qt kits to avoid starting from scratch.

Re: What dif­fer­enti­ates front-end frame­works

#97

Earlier quoted context omitted.

Impressive? This is the default. You have to actively do stuff to make it slower.

You have to actively do stuff to make a house messy, but it can still be impressive when it’s clean.

I find it the opposite. You have to actively clean a house, but do nothing and it won't be clean

Re: What dif­fer­enti­ates front-end frame­works

#98

Totally disagree with this. Change detection is nothing but a hack to get around the fact that interacting directly with the browser DOM is very slow and blinky. Imagine a world where interacting directly with the browser DOM didn't suck, then none of these libraries would exist. The crux of the problem is that the browser immediately reflects changes to the DOM to the screen. And when you make a bunch of changes to…

> I've used a technique called 'double buffering' to rerender complete pages off-screen, fast.

I'm absolutely not a web dev (as this comment will make clear), but I'm very surprised that browsers haven't been doing this all along. I just assumed that they did.

Re: What dif­fer­enti­ates front-end frame­works

#100

Earlier quoted context omitted.

> maybe someone can shed some light into the downsides of Svelte Svelte trades off runtime size for component size. It was created in the context of infographics for the New York Times online and for projects that roughly line up with that it's pretty much the technically best option. I like the Svelte authoring experience and introduced it for a few components in a React based low-code platform. The reason I phased…

Why do you care about compilation output? Also, your component sounds cumbersome.

I’m mainly a C++ developer, not a frontend developer (though I dabble), and when I have a choice of multiple approaches the first thing I do is go to godbolt.org, implement MWEs and compare the assembly.

I also do a lot of code generation, and my absolute goal is to have it write code that I’d write if I were doing it by hand. That’s pretty key for me. If the output is better, then good. If the output is doing a bunch of stuff it doesn’t need to be doing because it’s taking my specific use case and making it conform with its own model for doing generic things, I don’t like it.

I was a web developer back when tables for layout, HTML attribute soup for styling, and applets for interactivity were going out of fashion. Semantic HTML and CSS for layout and styling and JS for interactivity were coming into fashion. Divs for layout, class soup for styling, and JS frameworks for interactivity hadn’t yet become mainstream when I stopped.

So my default is lean HTML, lean CSS, raw JS. Maybe JQuery if needs be. It’s an outdated default, but it’s mine. The thing is, I get great load times and performance for what I need. What I need is normal dashboard stuff - though because of the nature of the field I work in, it condenses a lot of information onto a page and that information is updating many times per second.

I don’t seem to get enough performance from the frontend frameworks I’ve tried. I don’t know if it comes from code bloat, or deep call stacks through god knows how many levels of indirection, the way DOM updates are issued, or something else - but it has just never seemed worth the learning curve to end up with something I can’t do myself with admittedly a lot of work.

As such, I find this review helpful. Svelte has caught my attention and I want to give it a go, but if the output is bloaty then that’s a red flag for me. If it’s bloaty because it isn’t doing backflips through the call stack, but is inlining code - that’s familiar territory and certainly something I can deal with.

Post reply on HN