Looking at GUI / widget libraries (GTK+, Qt, FLTK, wxWidgets, etc). The libraries I listed are mostly C++ and GTK+ is written in C, but they built an OO system (GObject) within C. I wonder, is this like the ultimate use-case for OOP? Does the hierarchy of functionality for UI elements, representing on-screen instances as objects, and communication patterns in traditional desktop software just lead, inevitably to object orientation?

(FWIW, I think the answer is no)

#OO #OOP #GUI #Programming

@thezerobit Kinda tho.
@mrcopilot
It feels like these libraries came into existence at a time of great hype in OO. The reason I ask is that, in my opinion, it leads to code that is difficult to reason about, when a project gets big. These are the libraries that are used to build most open source desktop apps, and those codebases are, frankly, inheritance nightmares with state scattered everywhere which makes contributing very difficult and bugs, rampant.

@thezerobit I do recall the before times.

UI, beyond the desktop norm anyway has to adapt to display anything and inheritance is a great shortcut in this regard but, like everything else, can be abused, never rebased, and ignored adhoc.

Starting from a blank page it is possible and even desirable, some might say enjoyable to write in a properrly ruled oop manner.

But as always whatever is/was best for the project wins, Hell I've shipped the ui in procedural pascal before.

#YMMV

@mrcopilot
I do think there are aspects that map well, and, yes, inheritance is like a drug, you get quick results and shared behavior/code, but as your dependence grows, the benefits decrease under the weight of code organization and state management issues. Maybe the solution is heavy refactoring and collapsing of hierarchies and moving towards composition and ordered state management. I really don't like C++, it's not a good OO language at all, IMO.

@thezerobit Same.

Maybe QT's latest would appeal better, but the modeling takes a bit of study to wrap your head around. Language bindings abound, but even the C++ is a shim for the QML

Many of the newest KDE apps are almost entirely in QML

https://academy.qt.io/saml/init?redirect_uri=/catalog/courses/4944534

Qt Account Login

@thezerobit i think "no," given UI libraries that do not use OO patterns exist and are nice to use: IMGui, monomer, the half-baked hand-rolled system I made for my current game, etc.
@agentultra
Completely agree. Also, Tcl/Tk and HTML/CSS.
@thezerobit I think the answer is "no". However, to me there is nothing wrong with object-oriented way of doing things.
@alexanderniki
I'm not opposed to OO at all, but there are traps and C++, in particular, has some problems. My main concern is that a lot of open source desktop applications are written in C++ and are kind of nightmares to contribute to, for those reasons.