Simple board game GUI framework

Paul Moore p.f.moore at gmail.com
Mon Sep 11 08:59:01 EDT 2017


On 11 September 2017 at 13:13, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Paul Moore <p.f.moore at gmail.com> writes:
>>write a series of classes simulating objects
>
>   I'd say "write classes for objects".

Yeah, that's just me not being precise in my mail. Sorry.

>>objects moving round on a chess-style board of squares
>
>   This seems to follow the recommendation to model
>   objects after real-world entities.
>
>   I prefer another approach when I do not have experience with
>   a type of program: I start to write the program "procedurally".

We've been doing that - the issue is that we don't have sufficiently
large real-world examples to make transitioning to objects a natural
requirement. And yes, I know you're going to say "don't teach stuff
the student doesn't actually need yet", but in this particular context
I'm specifically being asked by the student (it's a one-to-one
environment) to explain classes and objects, because he's encountering
the ideas in other places. And I want to do so in a practical context,
even if that practical context is artificial.

>>                       but I would like it if the resulting program
>>was reasonably interesting.
>
>   »Interesting«, for me, is too vague and subjective.

OK. Replace that with "I think my student would find it motivating to
see a GUI style of behaviour, even if he had to take the
implementation of that part of the program on faith". He's used to the
idea of writing plugin code that fits into a framework, so this would
be a familiar idea to him.

>>I'd build the frontend, then my student could write the object classes
>>and drop them into the framework.
>
>   When the students are not yet able to write the whole
>   program themselves, it might make sense to write a part of
>   the program for them (the frontend) and have them supply the
>   rest.
>
>   But the frontend is a teacher-supplied library (TSL), and to
>   write the rest of the program, the students have to learn the
>   interface of the TSL and then write code for the TSL.

Agreed - but as I say, in my specific context I don't think this will
be a problem (and I'm confident in my ability to clearly explain the
difference between "you need to do this because that's what the
framework expects" and "you need to do this because this is how you
write a class").

>   In my teaching, I avoid providing TSLs for my course
>   participants and have them learn the TSLs because I believe
>   that the standard distribution of Python (or Tkinter or
>   Pygame if you use on of those) alreadu has more than enough
>   libraries in them, and students should learn the standard
>   libraries and not additional teacher-supplied libraries.

My student has told me that he would like to understand classes so
that he can better understand the logic behind the class-based
features in the stdlib. That's why I'm trying to find a useful,
understandable, example to work with.

>>My problem is that I've never written any sort of game code for
>>Python, which is basically what this is.
>
>   Get proficient first, then teach.

I'll assume you don't mean that to be as critical of me as it sounds.
I have no intention of trying to teach anyone "how to write a GUI
program" or "how to use pygame". Any more than I'm trying to teach how
the Python interpreter works. I'm simply trying to find (or build) an
environment that helps me explain the concepts that I *am* trying to
teach better than a command line REPL can do.

>   And as I said, I would prefer to teach the standard
>   frameworks and libraries that are distributed with the
>   standard distribution of Python before I teach additional
>   frameworks.

As I said, I've been doing that, but need to help the student
understand classes to give them a better understanding of why the
stdlib is designed the way it is.

>   Ok, if you teach at a gaming academy of when the title
>   of the class contains the word "game", then you might have
>   to teach game programming, but in this case you should
>   really become proficient in it first.

Well, obviously. I'm not sure why you think I'd consider it otherwise :-(

Thank you for your comments, but clearly you have a very different
environment and/or set of students than I have.

Paul



More information about the Python-list mailing list