[Edu-sig] Bionic Snaketalk (proposed metaphorics)

kirby urner kirby.urner at gmail.com
Thu Jul 19 17:33:22 CEST 2007


On 7/19/07, kirby urner <kirby.urner at gmail.com> wrote:
> So I'm thinking of using this analogy today:
>
> MOLECULES
>
> Data structures, starting from primitive number types, are like
> the molecules and macromolecules of life, the beginnings of
> organic chemistry.

Probably that should be:

data structures + control structures

... considering exceptions a kind of control structure.

These, then, are the primitive amino acid type proteins
necessary for defining low level eat-and-return biota of
the next level (i.e. functions, generators and, higher still,
methods within classes).

What's cool about IDLE is you're free to interact with the
low level components without going to all the work of
writing a structured program.

The immediacy of the shell is what throws students for
a loop sometimes -- they're not used to prodding and
poking at this low a level, still think you "have to write
programs" in order to explore string.Templates for example,
whereas yesterday in class we just went like:

>>> from string import Template

>>> boilerplate = Template("There once was a $person from $city...")

>>> boilerplate  # trigger internal __repr__
<string.Template object at 0x00D50FD0>

>>> formfiller = {"person":"guy", "city":"a strange faraway country"}

>>> boilerplate.substitute(formfiller)
'There once was a guy from a strange faraway country...'

The idea here is to see "boilerplate" as setting up a View, with
our "formfiller" a transport layer  to/from a MySQL data base
on a server somewhere.

We can storytell around these common LAMP-like design
patterns, while messing about in the shell, thereby

(a) cluing students about how things work
(b) giving them practice interacting with objects

all without

(c) needing to write too much code, at least at first
(recall is hard, recog is easier).

Kirby


More information about the Edu-sig mailing list