| > People repeat this a lot, that OO goes with UI, but I don't think it's actually true It is evidentially true. Thousands of successful applications and a billions of lines of UI code have been written in object oriented languages. It does work and it can't be that bad if that's continuing to happen even after the emergence of other alternatives. Whether there are better ways is a good question, but I think it's pretty clear that you can ship good apps using OOP for your UI. > React Hooks and immediate mode GUI in general demonstrate that it's not true. I'm far enough into my career now — I've been doing UI programming of one form or another since the 90s — to have seen that pendulum swing several times. If there is a silver bullet, we haven't found it. It's probably not immediate mode GUIs because if it was, I wouldn't have seen game teams tear them out to replace them with something more retained several times in the 2000s. What I think actually happens is that we forget the problems lurking in the solution we are not currently using. The grass over there gets greener and greener until we hop the fence and the cycle starts over. Incremental progress does happen. (I am not keen to revisit MFC any time soon.) But if a given concept (1) has been around a long time (2) has not already supplanted the alternatives, it's pretty unlikely that it is now an amazing solution today. The only time when that isn't true is when the surrounding technology context has changed since then. For example, neural nets weren't a good solution for AI problems in the 80s because compute was too expensive and we didn't have a lot of data. Now that CPUs are cheap and everyone puts their entire life on the Internet, machine learning is here. I haven't seen anything around UIs that to me looks like a significantly changed context, so I think we're still orbiting around retained-mode and immediate-mode as both having their own trade-offs and neither being a slam dunk. > I think that "zen koan" you mentioned earlier is being very generous to subclassing. You want ADTs most of the time! I really don't think that's true. Just look out there in the world. More code is written in languages doing subclassing every day than in languages with sum types. Despite the fact that sum types have been around since the 70s. You have to have a very uncharitable opinion of all of your fellow programmers to believe they've all been getting this wrong for decades. Heck, the software you are using right now to read this comment is sitting on a stack of several layers of subclass-based architectures! You've got JS running on top of the DOM inside a browser written in C++. Sum types are really nice. But open-ended subclassing is too. |
For one imgui gains traction again, especially among game developers, simply as it gives a lot for the ease of compile, understanding, compactness of code, etc. You can really build complex tools out of it.
But there is one nasty elephnant - the state, and imgui's approach is to hide it somehow - it used be behind your __LINE__ (or __COUNTER__, stack.line in some langs), or maybe part of your label points to your data, and if you've had the bad luck of having same labeled names, then there is yet another workaround, something special hidden in there.
All in all, it seems like it's missing a language feature, and we are suddenly grasping on all kinds of tweaks to achieve that.
That, .. and layout.. Layout is damn hard in immediate language. It works by magic, and then your app might crash, and lock. No I'm not kiddin...
Then again I'm but a simple user of UI toolkits, never fully written one.