Re: [gtk-list] Re: MVC (was: Widgets Vs Gadgets, and before: map/unmap optimization)



> julian.gosnell@nomura.co.uk wrote:
> >MVC, is a paradigm for decoupling data models from parties interested in
> > altering their values, or alterations to their values, or both, which you would
> > use to e.g. avoid clumsy relationships between your data and GUI.
> >In conclusion I would want both - and although my experience of Swing is limited
> > it seems to be pretty well designed (I could could wrap this thread around to
> > swallow its own tail here by asking why Swing now uses lightweight/windowless
> > components, but I shall resist that temptation).

"Daniel Solaz" <dsolaz@sistelcom.com> writes:
> Why? It's a bit off topic, and definitely it's too late to discuss how
> GTK should have been designed, but...
> I've always wondered what reasons moved Java to abandon the AWT
> approach (which gave Java apps a very welcome native interface) and take
> the Swing way.

> MVC is a very interesting concept, but has not become widely known and
> possibly too few people really understand it to the point they can take
> advantage.  If GTK ever gets to do things the MVC way it will be fun to
> learn.

Gtk is a widget library - its your choice if you use MVC or not.
Gtk currently only implements the view part - you write model and
controller parts. With gtk-- I would implement mvc thingys like this:

class myview : public Gtk_Window { ... };
class mycontroller : private myview { mymodel *model; ... };
class mymodel { controller_interface *controller; .... };

In C this can be also done but its a little more work...

> Swing components are split into Model and View/Controller parts; IIRC it
> makes heavy use of Java's sort-of multiple inheritance (interfaces, that
> is).  The GTK guys designed a single inheritance class mechanism in C,
> but I doubt they'd like to try support multiple inheritance.  Some
> people say MVC is too heavy in most cases.  I just don't know.
> Do you think GTK 'should' go MVC?

No, gtk is a widget library and thus conserned only in the view part..

(the mvc support could be supported more explicitely in development tools..)

Anyway, MI support would be real easy to add to gtk object model. (hell
it already have it... - the conversion routines just dont use it)

I mean, current model is to have:
struct GtkFoobar{
  struct GtkObject parent; /* inheritance */

  struct GtkObject parent2, /* mi */
};

this way the only thing needed for mi is to have pointer conversions
from GtkFoobar object to parent2 object... Another problem is
telling parent2 about the virtual function table of FooBar...
But anyway, mi can be used in classes part of gtk's object model
quite easily. (gtk-- does it - as C++ has mi support.)

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]