4 ms·
> The fact that you have 100 classes implementing this is a good sign you should turn the design on its head. Why not just have a single tree structure built us
by flukus 9y ago
> The fact that you have 100 classes implementing this is a good sign you should turn the design on its head. Why not just have a single tree structure built using generics?
Does anyone know why gui toolkits never do this? Every one seems to follow an OO model where each widget owns it's own children. Even in GTK they hacked in an OO system to do it instead of having a separate tree.
- Sophistifunk 9y agoBecause almost every GUI component is responsible for sizing and positioning its own children. A separate tree might be useful for some other optimisations I can't think of, but it would definitely be a pain for components, even those with a fixed number of children (as opposed to "container" components).
- eecc 9y agoBecause GUIs handle data providers and you have to provide your own adapters to those (so it's even MORE boilerplate)