Questions about app design - OOP with python classes

adriancico at adriancico at
Thu Mar 1 22:24:17 CET 2007

On Mar 1, 9:45 pm, Bruno Desthuilliers
<bdesth.quelquech... at> wrote:

> As a side note : hungarian notation is usually considered bad form here.
> Look here for usual naming conventions:

Thanks for the tip. It's been too many years of VB6, and its difficult
to leave old habits
behind :-)

> >     With this design, pretty much everything is encapsulated in it
> > respective
> > class. However, that means that the main program logic is in the Frame
> > class.
> What do you call "main program logic" exactly ?

What I mean is that in the frame code is where all decisions are
taken. The frame handles the
other controls events, decides what needs to be done, calls the
necesary methods of the other controls, etc. The other widgets just
"do the work" when called from the Frame. But this is not
necesarily bad, as you point out below.

> Using the main frame as a mediator between the different widgets is a
> well-known design pattern, named - suprisingly - mediator. The
> motivation is that it avoid each and every widget to know about the
> existence of every other widget. You may want to read about this pattern
> - but note that most litterature about design patterns is expressed in
> terms of statically typed languages (Java, C++ etc), and that dynamic
> languages like Python usually don't need that much boilerplate and
> complication (IOW : try to understand the pattern itself, not to blindly
> apply it).
> What's your looking for IMHO is the "controller" part - the one that
> glue together the "view" (main frame and all it's widgets) and the
> "model" (mostly, your document). Here again, googling for
> "model/view/controller" (MVC) may be a good idea.

I understand (I've been in wikipedia :-) ). Right now the Frame is the
controller as well
as the view. Moving out the "controller" code to another module seems
to me the
path to follow. I'll start to look out for MVC related material.

My problem was that, altough I knew OOP basics, I didn't know how to
apply them exactly. Thanks
for your answer, it has cleared many things.

> Note that there's nothing Python-specific in your question. But since
> comp.object is one of the worst places on earth to ask questions about OO...

I am developing in Python, so it made sense to me to post here. But
you are right, the question
is off-topic. Sorry for that.

Thanks again and regards
Adrián Garrido

More information about the Python-list mailing list