← Back to context

Comment by jpc0

6 days ago

I’ve been thinking about this myself and really UI development is mostly about design up front, many times with a well built design system UI changes can be trivial.

But as you alluded to, data binding can be difficult. For some things, and even most web pages fall into this, you effectively load the data up front render something and then don’t touch it again, on change you can absolutely just rerender everything because it is truly trivial to render.

But for other things you need extremely complex data binding with constraint systems and things are extremely complex to render (CAD, Games, etc). For that you need cacheing and partial updates etc

These is a spectrum between that and I just don’t see the ability to abstract over it.

And taking a11y into consideration no matter how you choose to render you also need to construct a tree or graph for screen readers, this also needs data binding. You will probably also be tying keyboard navigation to that graph (other than for a game but even then maybe)

I feel like though a lot of performance problems on web is 1) people not understanding fundamentally how expensive certain operations are 2) lack of hardware acceleration for some vector operations in CEF / browsers

For 1 just think about some UI element, a rounded button or something. A mesh had to be dynamically generated for that UI element and then drawn, if you for some reason are causing that mesh to be regenerated every frame that becomes expensive very quickly.

Text is generally generated on the fly and cached as well, if its not software rendered.

Once you get down to the nuts and bolts modern UI is a complex problem, and to build a framework for that, you need to get into the nuts and bolts.

We’re not even discussing rendering APIs yet…

This is part of why I believe that smart hybridization is the key. In a complex application, you need qualities from all major schools of UI framework design, but broadly speaking we’ve been obsessed with trying to find a “silver bullet” one true paradigm that fits every use case, when no such thing exists.

I also think that UI frameworks try to hard too be “magic” and unopinionated where they should instead be highly communicative and naturally guide developers into the happy path. So following your example of the excessively re-rendered button, the framework should really be detecting the unneeded redraws and complaining to the dev about them and potentially even presenting as compiler errors in production builds until they’re fixed (which the compiler offers hints on how to do).