Re: Python - Learning Object Orientation

  • From: Veli-Pekka Tätilä <vtatila@xxxxxxxxxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 12 Dec 2007 17:02:04 +0200

Hi James,
Sounds oK to me. If possible, try separating three different things in
the design:

1. The classes that do all the hard, internal work but don't interact
with the user, typically called the application engine or the model.

2. What-ever UI you are using for the user. This should use the engine
itself and the engine should not have to know anything about the UI. The
idea is that once you write the GUI version, you can substitute the UI
component without changing the engine at all, This is typically called
the view, I think. You might want to have a design where the engine is
notified of UI changes and can react accordingly, or the UI is updated
in response to the engine. Observer might be a good design pattern to
look into.

3. A third component that does determine how exactly your UI interacts
with the engine. for instance, given the option to save after having
read a file name, this component would determine what to do in the UI
and engine if the user pressed cancel, opened a file, doesn't have
appropriate rights and so on. This is the glue that puts all the rest of
the components together without still hardcoding any UI specific logic
or doing any of the engine choares. I think this is called the
controller or the proxy, but might be missing some of the terms here. I
still have a feeling of never truely having mastered the model, view,
controller paradigm MVC, even though I do understand bits of it.

So this remains a relatively vague explanation.
Sorry about that. I hope someone else is able to explain this better to
both of us, <smile>.

-- 
With kind regards Veli-Pekka Tätilä (vtatila@xxxxxxxxxxxxxxxxxxxx)
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila

james.homme@xxxxxxxxxxxx wrote:
> 
> Hi,
> I was thinking of making either a Freecell game, which is a card game, or a
> Monopoly game, so that I can have an object orientation project I am
> interested in. Would either of these be a good thing to try? For the
> approach, I was thinking of writing the first version with a console
> interface. Then I was going to try to use the code for the objects and
> learn WXPython to put a different interface onto the project. Is this a
> good approach? What other advice do you have?
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: