Organization of GUIs

Benjamin Kaplan benjamin.kaplan at
Fri Dec 4 03:16:26 CET 2009

On Thu, Dec 3, 2009 at 9:59 AM, Michael Mossey <michaelmossey at> wrote:
> On Dec 3, 6:38 am, Lie Ryan <lie.1... at> wrote:
>> On 12/4/2009 12:44 AM, Michael Mossey wrote:
>> > I have a question about typical organization of GUIs. I will be using
>> > PyQt.
>> Model-View-Controller (MVC) pattern.
>> Model - all the business logic lives in the model.
>> View - your GUI
>> Controller - Takes input
>> Controller notifies Model if there is user input; Model notifies View if
>> there is an update in the model; View "notifies" user if there is an
>> update in the model; User "notifies" controller of the changes wanted.
> I'm aware of Model-View-Controller, but my question is broader than
> that for a couple reasons:
> View can be fine-grained. Often the View consists of a number of GUI
> objects. Some people write this in a democratic arrangement---they all
> talk to each other. This can make analyzing system behavior
> complicated. Hence my proposal for a hierarchy.

Ideally, the controller should be the top of that hierarchy.

> Also, often different parts of the Model talk to different parts of
> the View. The question, then, is whether both the Model and View
> should be structured hierarchically so that all messages pass through
> a "master" or "root" object before going to the other Model/View, and
> messages within a Model or View should only move along the hierarchy.

The model should never ever talk directly to the view. The whole point
in using MVC is that the model parses the data, but doesn't care what
you do with it. The controller takes the data from the model and
processes it but doesn't care how the data is obtained, stored, or
displayed. The controller then sends data to the view, which doesn't
care how you got it or what you did with it. All it knows is that it's
given data and it knows how to display it. Then, when the user
interacts with the view, it sends the new data back to the controller
which either passes it along to the model or tells the view (or
another part of the view) to do something else.

> In other words, you can easily make a complete mess of MVC.
> --

More information about the Python-list mailing list