[Edu-sig] Introducing classes

Andre Roberge andre.roberge at gmail.com
Sat Mar 4 15:35:06 CET 2006


On 3/4/06, kirby urner <kirby.urner at gmail.com> wrote:
>
> I really like this kind of thing André.

:-)

> One thing I like is the visual imagination is engaged (avenues,
> obstacles) and yet the code and evaluation loop are entirely lexical.
> This is more like reading a book (without pictures even), which is
> what children are learning to appreciate (we hope):  scanning
> typography while using their imaginations at the same time.  Those of
> us heavily into TV as a medium don't want to lose or undermine that
> skill.
>
> The fact that you actually *do* move to visual animations later, using
> the facilities of wx, is very good as well.  Switching between modes
> is valid, and we're dealing with TV generations who hunger for more
> visual stimuli.  I often think education is a travesty because we
> build visual literacy through television and then set up our
> classrooms to fight or ignore that literacy, going only for chalk
> boards and slow talking.

Actually, it's the other way around.  I start *within rur-ple* with
the simplest program.

move()
turn_off()

The student gets the visual feedback right way.  Then, within rur-ple,
I introduce Python's syntax, building more and more complex programs. 
Then I introduce OOP notation:
Reeborg = UsedRobot()
Reeborg.move()

It is after this step that I was planning to introduce the class
example I gave, to show students how they could design their own
robot.

[snip]

> More to the details of your code: a technique I use sometimes is to
> start with a simple Monkey (or let's say Robot in this case) and
> evolve it through subclassing.  In other words, as I add new
> capabilities, I don't show a more and more complicated Robot.  Rather,
> I show more and more descendents, in an inheritance chain, each
> generation adding to and/or modifying the behavior of ancestor robots.

Since I want the students to design their own robot, I thought of emulating the
inheritance that they had seen.  The UsedRobot() objects can only turn left.
RefurbishedRobot() can turn right, and inherits from UsedRobot.  So, I thought
of building Robot() until it had the same abilities as rur-ple's
UsedRobot().  Then,
introduce subclassing to build a BetterRobot() that would have the same
abilities as rur-ple's RefurbishedRobot().

André


More information about the Edu-sig mailing list