The concept of immediate mode GUIs like egui is very compelling: no duplicate data structures whatsoever, your application data is immediately translated into the user interface rendering. Makes for dead simple application code.
And then you start thinking: how does it know when to update? Oh, it doesn’t, it simply re-renders the user interface 60 times per second. That’s rather wasteful for anything but the most simple user interfaces, maybe it needs some kind of change tracking after all…
Next thought: accessibility. How does the framework know what happens when you press Tab? Actually, how can it have a concept of “input focus” at all if it doesn’t have a persistent representation of the user interface? Is the application supposed to implement input focus changes manually? And how is that supposed to work with screen readers then?
That’s the point for me where I think: well, maybe immediate mode GUIs should be better left to games. While everything else would be better off actually maintaining that duplicate widget data structure, as annoying as it might be.
@WPalant
Accessibility is a special case of a more general pattern: being able to abstract over the structure of the UI so that you can present two different views of the same model. This turns out to be a fairly common requirement for non-trivial GUIs. Immediate mode GUIs require you to duplicate a load of logic to do this.
The system we built in EtoileUI was designed to support this from the start but the ideas we used in it were not particularly novel, they came from Taligent. Much as I like OpenStep, it’s a shame Apple spun out and abandoned Taligent with the NeXT acquisition. Their model also made it easy to abstract over different input methods, so you could create interfaces that worked with mice or touchscreens fairly easily, something that Apple has subsequently done very badly.
The other problem with immediate-mode UIs is that complex UIs rapidly discover that they need caching. And now you’ve turned a synchronisation problem into a cache-invalidation problem. And remember the two difficult problems in computer science?