[Tutor] Teaching computer programming

Christian Tismer tismer@appliedbiometrics.com
Wed, 07 Apr 1999 15:49:29 +0200


Some minor points, without wanting to spoil your good work...

Martijn Faassen wrote:
> 
> John Kleinjans wrote:

[skipping the "script" definiton - agreed all]

[boxes:]

> > >Boxes are ok so far. Boxes take the values.
> > >But variables are better seen as lables, sticked to the
> > >boxes. They just hold a reference, not the value.
> > >This is hard to recognise with simle number or string
> > >variables, but as soon as you are dealing with structures
> > >like lists an tuples, the difference will be very visible.
> 
> Not with tuples, as they're immutable, but with lists and objects made
> from classes, yes.

Well, you can put a mutable object into a tuple
multiple times and then see that the elements are
changing alltogether. You are right in the sense of
it, I just meant examples for any objects with some
structure and took these. It is exactly the time
when they touch these, that they need to understand.

[all fine, although I had avoided "class" in this early stage]

> > "arguments"
> 
> Labels (variables) you pass to the code of a function. The function code
> can then read or modify the content of the boxes these labels point to.

This is wrong. Arguments are values which are passed to a function.
Arguments are the sight of the caller. The callee receives them
by local variables which are the lables sticked to the actual
arguments. Right?

...

> > "take a dir()"  ...
> 
> Look this up in the Python Library reference, built in functions. :)

This is one idiom which I usually address with "inspect".
Meaning "apply a dir, print __doc__, or print the object, or pick
an attribute and look at that" where dir() is most valuable to
learn about imported modules, find its functions, and then
look at them. Most valuable for beginners. I would always tell
them and not wait until they read the docs :-)

> One way is to use labels and boxes; concepts they already know about.
> Another option could be to use little men (variables) instead of labels,
> which point to boxes (which may in fact be complicated contraptions such
> as more Python code). The advantage of little men that point is that
> little men can easily point to something else; a label tends to be put
> on something. Each little man has a name (the variable name, of course).
> Feel free to include women, dragons, and other critters. :) Callable
> guys are guys whom you give the names of some other individuals
> (arguments), and that go off and activate the contraption they're
> pointing to:
> 
> Hank, please do your thing (what you're pointing at) with whatever Carl,
> Diane and Martijn are pointing to.

Hmm. Grading people down to be just a label? Changing their
content with any assignment? I think, I would save people
for something different, like class instances which can be
like individuals. But an individual is not just a nobody
who takes some identity by pointing. Are you successful with
this model?

> *Hank walks over to the machine he's pointing at, fills in (on some
> display) the secret internal id codes of the things Carl Diane and
> Martijn point to, and pushes the 'start' button. The machine starts
> humming and steaming, and perhaps tells Foo the dragon to do the stuff
> he is pointing at, too, in the process. Etc. This can get very
> complicated, which shows once again organizing your code in a good way
> is probably the most important aspect of programming.

I think htis is ok if you are talking of objects as 
individuals. That they refer to each other by attributes
is ok. But how to explain their own existence in the module
namespace? Maybe they can play a role there. The module
is a room with chairs. Or with marionette threads, tied to
the people.

Hmm, still easier for me with labels and boxes, but thinking...

Anyway, this was great input - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home