[Tutor] designing POOP

bhaaluu bhaaluu at gmail.com
Wed Feb 6 19:01:33 CET 2008


Thank you Alan.

This helps tremendously! I had gone to your OOP tutorial and read it
over (again) and the closest thing I could find on that page was
the Bank Account example that had a list of things a bank account
might be expected to do. So away I went, making a list.

The problems with that approach surfaced as soon as I started
trying to identify the nouns (potential classes and instances),
adjectives (potential attributes) and verbs (potential methods).

I'm making mistakes, but at least that shows that I'm trying. If nothing
else, I now know what doesn't work. 8^D Actually, I'm not expecting
to get this done today. It may take awhile. From my past experience,
that is how the design process goes. But if I can learn how to do this,
I'm pretty sure it will save a lot of time when I work on future projects.

Back to the drawing board!
-- 
b h a a l u u at g m a i l dot c o m
"You assist an evil system most effectively by obeying its
orders and decrees. An evil system never deserves such
allegiance.  Allegiance to it means partaking of the evil.
A good person will resist an evil system with his or her
whole soul." [Mahatma Gandhi]

On Feb 6, 2008 12:06 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "bhaaluu" <bhaaluu at gmail.com> wrote
>
> > Here is my description, in plain English.
> >
> > Text Adventure Game Requirements:
> > 1. The Explorer enters her name at a prompt.
> > 2. Other things are initialized at this point.
> > 3. The layout of the Castle is defined.
> > 4. Treasure is placed in rooms in the Castle.
>
> Actually thats not really plain English its a very structured
> English. In fact it approaches procedural pseudo code!
>
> Its possibly a little too detailed too.
>
> I'd go for a more free-form paragraph or two(at most) something
> like:
> ------------------
> I want to build a text adventure game based around
> an explorer moving around a castle with multiple rooms,. In
> each rooms there could be various items of treasure or monsters.
> To win the game the explorer has to collect as much treasure
> as possible and defeat as many monsters as possible. Treasure
> is worth points and the expolorer starts off with a given amount
> of strength and points. ......
>
> Because its a text game the interface will consist of a series
> of input prompts with responses and printed status messages.
> The game is over when.....
> -----------------------
>
> That should be shorter and less likely to predispose your thinking
> to a particular approach - such as when the initialisation takes
> place, or how many rooms or premature consideration of the
> command structures etc. These things should emerge as you
> create the object definitions and interactions. The initial aim is
> only to find the half dozen to a dozen key classes top get started.
> Other classes will emerge as you progress, and some of the
> original candidates may merge into others or be discarded.
>
> And don't forget that there could well be a game class/object to
> control the overall flow of the game and coordinate the actions
> of the other objects. For example the prompt/response/display
> mechanism might be part of the game class (and they might
> be classes too!). This would maximise reuse of the compnent
> objects within a different game framework ( a GUI fort instance)
> later.
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list