Autor: Edward Bartolo Fecha: A: dng Asunto: [DNG] The Gtk+ Hodgepodge 'Object Model'
Hi,
I am using 'Object Model' in this sense:
The way object's data and functions are accessed which tghitly depends
on how objects are designed, i.e. their architecture. By the latter I
am NOT referring to object hierarchy.
Having used in the past for several years other object models in
Delphi (TM) and Lazarus (free/open), is making me realise that the
object model employed in Delphi and Lazarus are far more logical and
productive.
I have been struggling to embrace Gtk+ and Qt object models in vain
due to their counter-intuitive object models. Instead of using real
tangible objects as a model they adopted to use an unnatural broken
model for their widget architecture. So, to start my car, I need to
create a starter object, plug it in into my car's engine, initialise
its circuitry, and finally, if my car should start! This is also like
having a detacheable digestive system, which one would plug in when
one needs to digest food!
Why not integrate all objects required by a widget in the first place?
I can see an answer to this: to save memory space and processing
resources so object can be trimmed to what is necessary. That is a
good reason, but shouldn't a good widget designer create
not-often-used objects when an attempt to use them is made. You may
say that causes an access violation/segmentation fault. However, that
can be avoided easily.
Why shouldn't a Gtk+ coder be able to use something like this:
gtkobjectinstance->helper-object->method()