Rich Data Structures

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rich Data Structures

Kirby Urner

So I'm meditating on pedagogy again, having signed up for quite a few hours
of presentation time, regarding Python etc.  I've got a PSU class (high
schoolers my target audience), and a volunteer gig with PPS, teaching
math/CS to 8th graders (under a union member's supervision).

For a long time, I've felt some frustration with published CS teaching texts
because they don't put much textured information into their example data
structures, by which I mean, I've never seen the Roman emperors, in chrono
order, or the succession of rock bands played in by drummer X or guitarist
Y.  Not much about the history of trains, pre or post diesel.  Or lets
compile some data on Barbie's boy friends (just Ken?) -- or Buffy's (most of
them vampires).

Here's an opportunity to impart the humanities entirely tangentially to the
engineering curriculum.  As drivers of a new math/CS hybrid, I think we now
realize that such opportunities for orthogonality should be prized, not
sneezed at.  Retaining student attention and interest, a precious commodity,
is a worthy goal, and if a percentage of your student gain most from gazing
absently at your wall posters, then at least make sure you've got some
interesting wall posters (like, have you considered plasma?).  

Pile on opportunities for your lurker/auditors to jump to a higher
bandwidth, even at the risk of pointing to content beyond your own specific
scope (e.g. I'm no pro astronomer, but I'm happy and eager to share the
experience with my students).

So like here's what I mean (somewhat decayed fragment, imagine found in some
archeological dig):

moons = {
    'Jupiter': ['Metis','Adrastea','Amalthea','Thebe',
                'Leda','Ananke','Himalia','Carme',
                'Lysithea','Pasiphae','Elara','Sinope',
                'Io','Europa','Ganymede','Callisto'],
    'Saturn': ['Pan','Atlas','Prometheus','Pandora',
               'Epimetheus','Janus','Mimas','Enceladus',
               'Tethys','Telesto','Calypso','Dione',
               'Helene','Rhea','Titan','Hyperion',
               'Iapetus','Phoebe'],
    'Uranus': ['Cordelia','Ophelia','Bianca','Cressida',
               'Desdemonia','Juliet','Portia','Rosalind',
               'Belinda','Puck'
   
There're a few goals here, not just to impress ourselves with the number of
moons Jupiter's got, or Saturn.  And pretty cool how much Shakespeare got
mapped, at least in this particular namespace.

We also want to demonstrate nesting, and here in this example I've not yet
gone very deep:  string-indexed lists of strings, basically.  But of course
we could go with things like lists of tuples of dictionaries of tuples of
named functions (one could write some algorithm to randomly deepen nesting,
always/only per the grammar of the language, e.g. per Python in this case).

The push here is towards ultra-fluency when first learning the language, and
then it's OK when adult-minded rust sets in, and one's data structures
retreat to sane depths.  That comes later, in the workaday world, when we've
got weekend plans and want to get home and don't necessarily have time to
appreciate some geek's damnably clever code.  

We acknowledge extreme fluency as a phase in the training, yet we don't
insist these standards be met in the average workaday world.  On the
contrary, we insist on more a mellow programming style -- and that's both
reasonable and right. Overly clever code is simply overly taxing to decipher
and debug.  Yet sometimes we need it and use it.

We like our clowns to stay clever over time, true, however not every Python
programmer should come to work wearing big shoes and a red nose.  At least,
not all at the same time.  Vary your diet -- the usual middle way type
teaching, as relevant in CS as in everyday living.

Kirby


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Rich Data Structures

CyberWeb Consulting
i think this is a great idea.  parallel learning is useful, and there
should be no reason why it can't be done on a regular basis.  in fact,
it'll make it easier to come up with coding examples *and* help the
kids with their other subjects at the same time.

i did something similar a few years back (
http://www2.linuxjournal.com/article/5597 -- see Listing 1 ), but alas,
the intention, however, was wrong.  it wasn't as grand a scheme as you
describe.  rather, it was just a half-baked attempt to pay homage to my
favorite rock band.  :-)

cheers,
-wesley


> Date: Fri, 30 Sep 2005 15:54:13 -0700
> From: "Kirby Urner" <[hidden email]>
> Subject: [Edu-sig] Rich Data Structures
> To: [hidden email]
>
> Here's an opportunity to impart the humanities entirely tangentially
> to the
> engineering curriculum.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2001
    http://www.corepython.com

wesley.j.chun :: cyberweb at rocketmail.com
cyberweb.consulting :: silicon.valley, ca
http://www.cyberwebconsulting.com
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Rich Data Structures

Kirby Urner-3
In reply to this post by Kirby Urner

>     'Saturn': ['Pan','Atlas','Prometheus','Pandora',
>                'Epimetheus','Janus','Mimas','Enceladus',
>                'Tethys','Telesto','Calypso','Dione',
>                'Helene','Rhea','Titan','Hyperion',
>                'Iapetus','Phoebe'],
>     'Uranus': ['Cordelia','Ophelia','Bianca','Cressida',
>                'Desdemonia','Juliet','Portia','Rosalind',
>                'Belinda','Puck'
>

We might further enrich this module with additional lookup tables.  Now that
we know how to get the moons of Saturn i.e. solarsystem.moons['Saturn'] --
case sensitive -- we could consult a lookup table of URIs:

>>> solarsystem.getlookuptable('moonurls')['Mimas'] # function returns dict
'http://ksiezyce.republika.pl/saturn/mimas_en.html'

We might then invoke the Standard Library to pull down actual source HTML
and/or embedded images (if any).  We could use the pictures in later
exercises.

Or maybe not.  Lots of ways to go.  One module could be about solar system
data structures.  All these nested objects, maybe with numerical data
involving diameters, distances, periods of orbit and rotation, average
surface temperatures -- there's no upper limit on how detailed one might
want to get.  But for ordinary classroom use, there's no need to parse
through a whole gigabyte of solar system data structures, as we still have
mammals and species of phytoplankton to consider.

So I imagine CDs with tons of already defined rich data structures, in the
form of Python modules, plus other languages could do it too.  The CDs would
be a convenience for when you're not on the web, but would mirror content at
websites.  This way, tutorial writers, book authors, could reference these
standard in-common data sources, even while doing original writing for
compensation, i.e. here's a mix of for-profit and in-common code.  And
profiteers give back to the in-commons, having seen how useful it's been.

Kirby


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig