Re: [gtkmm] Design Question
- From: Vladislav Grinchenko <vgrinche integ com>
- To: gtkmm-list gnome org
- Cc: ouslush columbus rr com
- Subject: Re: [gtkmm] Design Question
- Date: 21 Apr 2003 16:18:23 -0400
I agree with Ole's approach to the design problem.
A while ago I put together class diagrams for one of gtkmm-based apps I
had written just to remember how to organize things with minimum amount
of pain.
http://gwavmerger.sourceforge.net/gwm-design/design.html
I don't use libglademm2 - no comments there.
hope this helps,
-Vlad
On Mon, 2003-04-21 at 13:05, Ole Laursen wrote:
> Craig Slusher <ouslush columbus rr com> writes:
>
> [...]
>
> > If someone could please explain a common way of connecting the GUI
> > pieces and the backend AddressBook class code together, I would
> > greatly appreciate it. I like the idea of keeping each part of the
> > GUI in separate headers so that I can easily edit each part of the
> > GUI code.
>
> I wrote a something about this on the gnomemm-list:
>
> http://mail.gnome.org/archives/gnomemm-list/2003-March/msg00024.html
>
> Although I do think that having a class is too much for simple message
> dialogs.
>
> As for connecting the backend to the frontend, that's a general OOP
> problem. On one hand, the frontend is supposed to sit on top of the
> backend so it is OK to have the frontend contain instances of the
> backend classes. On the other hand, you don't want to muddy the waters
> more than necessary.
>
> I've done it with the following pattern:
>
> main class contains:
>
> backend class 1
> backend class 2
> main window
>
>
> main window class contains:
>
> preferences window
> minor window 1
> minor window 2
>
> Then the rest of the classes are "flat". This does raise the issue of
> how the window classes contact the backend. Usually, I just make the
> main class a singleton so that I can get to it with
> Main::instance().some_method(), but this is just like a glorified
> global pointer, really. Alternatively, one can pass a reference to the
> main class to the constructor of the window classes, as you suggest.
> It is more flexible, but also more tedious.
>
> Similarly, preferences windows and minor windows needs to contact the
> main window. Either they can go through the main class, or the main
> window can pass them a reference when it constructs them.
>
>
> Also, for most of my projects, the main class is so thin that I've
> just merged it with the main window class.
>
> Does this help? Comments?
>
> --
> Ole Laursen
> http://www.cs.auc.dk/~olau/
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
--
_____________________________________________________________
Vladislav Grinchenko e-mail (w): vgrinche integ com
Software Engineer (h): vladg erols com
Integral Systems, Inc. http: www.integ.com
"Focus on quality, and productivity will follow." C. Jones
_____________________________________________________________
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]