Organization of GUIs

Michael Mossey michaelmossey at gmail.com
Thu Dec 3 08:44:37 EST 2009


I have a question about typical organization of GUIs. I will be using
PyQt.

I have mostly used Python and C++ in my professional life, but I just
took an 8 month detour into using a functional programming language
called Haskell. Haskell is "pure" meaning that for the most part data
is not mutable, or if it is mutable, access to it is controlled very
carefully. This got me thinking about how mutable data can make
program behavior complicated and difficult to understood/prove-
correct.  I am returning to Python and PyQt for my next project, but I
come away inspired to do things a little differently.

For example, in GUIs I've written in the past, typically there are a
lot of GUI objects (windows, data repositories, etc.) that "talk" to
each other. One object might send messages about a change in its state
to other objects that are watching it.

I am now wondering if I should write a GUI so that everything is in a
true hierarchy, rather than a tangle of objects with democratic
relationships---and more specifically, that messages (which may cause
state to be changed in the receiver of the message) should first go up
the hierarchy until they reach the right level, and then down to the
ultimate receiver of the message. This way a parent object in the
hierarchy has complete visibility and control of messages passing
between its children, leading to the possibility of consolidating the
code and documentation about the children's mutability in one place
(the parent).

But honestly, I have never really studied how good existing GUI
programs are organized. Always flew by the seat of my pants. So I'm
interested in someone has thoughts about this, maybe can point me to a
good book, etc.
Thanks,
Mike



More information about the Python-list mailing list