top | item 44324461

(no title)

default-kramer | 8 months ago

I strongly prefer FP over OOP, but... Is there any desktop GUI library that isn't built on subclassing? Winforms, WPF, Swing, Qt, Godot all do. This doesn't prove that subclassing is necessary, but it sure seems like the best approach we've found so far.

discuss

order

tpmoney|8 months ago

I think the closest I’ve encountered is the Objective C frameworks Apple used to use. Customizing the behaviors of default library components was almost exclusively done with delegates and protocol implementation rather than subclassing.

dragonwriter|8 months ago

> Is there any desktop GUI library that isn't built on subclassing?

There are desktop GUI libraries implemented in C, Go, and other languages that do not have subclassing, so, the answer kind of has to be yes.

throwaway2037|8 months ago

Gtk+ is pure C, but the library essentially implements subclassing manually. It is so painful to use, and so much worse that the C++ equivalent in gtkmm. Again, Win32 API does similar to allow subclassing of widgets. Again, painful.

SideQuark|8 months ago

Every GUI toolkit I've used, which is many, implement subclassing for UI elements whether or not the language supports it. Remember, C++ was originally written in C, so it's clear lack of a native language feature doesn't mean things written in that language also lack that feature.