@ Kirby: 8th-graders are 14 year-olds, right? (That is: do you count
classes from primary school grade 1 (like we do here)? How many lesson
hours do you have?

Yes, about 14.  I have 'em for about an hour, once a week, for about 9 weeks.

When starting with total newbies, you have to decide very carefully,
what to explain in what order. Python being so "easy" (for someone who
already knows what programming is about), it is also easy to go too
fast. And you will always want to introduce quite a lot of ideas pretty
soon, in order do to something interesting. On the other hand: Learners
will probably appreciate a common solution (say: loops) better, if they
have noticed the tediousness of programming without such a means _first_.

Given this is 8th grade, I look at it as first exposure or a first pass.  Some stuff will go over their heads, some will stick.  It's not necessary that they be complete masters of everything they see.  I think a lot of education is previewing.  What I dislike about most math curricula is how it's taboo to look ahead and see where we're going.

I have looked at two books which address these items in  a similar way:
Gregor Lingls German Book "Python für Kids" and the new book from
Stephane Ducasse: Squeak - Learn programming with Robots (doing it the
smalltalk way). Both take a Logo-like approach with turtle graphics as a
first start. Something which always seems to work with children of all
ages in my experience (besides producing nice graphics as a visual
feedback and reward).

I think this robots approach is valid, works, is likely to remain popular.  That being said, I'm not using it these days (I leave the door open to using it in future -- I expect my daughter will like it (she owns 2 robot dogs). Other approaches work too.

I understand the Sony robot dog has Python bindings but have no details.  Sony should send me a sample.  :-D

Differences (in the mentioned books) of course concern the syntax and
the environment. For Python you have to explain the difference between
interacting with Python via the Idle Shell-Window and using a
File-Window (for saving the work properly) soon. These are "first
things" you can't leave out.

Yes, I tend to agree.  We use the shell for awhile, interacting.  Then , after we've developed some function worth saving, using repeated edits in the shell (debugging as we go), I show 'em how to cut and paste to a file window, to save as a .py in site-packages.


So the standard interaction is (translated back to English):
>>> from turtlegraphics import Turtle
>>> joe=Turtle()       # I don't really explain this much
>>> joe.forward(80)
>>> joe.color('red')

So right from the start, we have dot-notation calling methods on
instances we first have to create by calling a "factory" Turtle.

This looks good to me.  Last week, we programmed a simple Dog class.  Maybe we'll use the turtle before the 8 weeks is done.

Another good thing is also that
>>> dir(joe)
will only deliver the known methods, wheras the module turtle.py (where
all the real programming was done for me) contains all sorts of things,
and no class Turtle, but a Pen.


Yes, I make use of dir() as well, including on primitive types e.g. dir(2).

I started out talking about types e.g. type(2), type(2.0) and type('hello').  Thinking in terms of types makes plenty of sense, because what Python provides is "an extensible type system" i.e. you get the primitive types out of the box, then you build your own, adding to the types ( = classes) available.

Some first *big* ideas in my sequence are:

1. Code as a linear flow of statements as "commands"
2. Functions without parameters as abbreviation for longer parts of
reuseable code
3. Loops on a list

Looks good.   I use a projector, boost IDLE to like 20 point (Comic Sans these days) and have kids follow along at their own workstations as I "doodle" i.e. write simple functions and stuff.  Other times I hand out stuff on paper and walk around the room, helping where needed. 

We actually did some "Using Python as a Calculator" in the Idle-Shell in
the first lesson (Big Idea #1: Shell commands). Long Integers are a
motivating factor (which pocket calculator could really tell you the
result of 2**100?). I also introduced math.sqrt() because luckily they
have just learned sqrt in maths, and it gives a first impression of
"functions".

Yes, I very much agree with advertising Python's better-than-calculator powers (leaving aside that we're not using a computer algebra system, which high end calculators provide).
 

More than one of them stumbled over some "wrong" results (float
representation): To explain this properly, I would have needed another
lesson, but I guess at this stage it is not that they are _that_

I get into this pretty early, explaining quickly that floats go into base 2 behind the scenes, then back to base 10 for display, and this introduces some unexpected wrinkles.  Nothing to worry about.  They get there's an explanation.  I'm mainly reassuring, acknowledging that I see what they see.

interested in the question (just wanted a _short_ answer).
In a second lesson we defined some own mathematical functions in an
informal way: Just like a function in maths with an x between the
brackets and "return" something to deliver the result. No further
treatment of this at this stage - I want turtlegraphics now.

In the first lesson with turtlegraphics, pupils drew simple pictures
(and had to use pythagoras a**2+b**2=c**2 to compute the length of a
diagonal) using turtles they gave a funny name first.

Then we defined a function triangle() (deliberately without parameters
first time) to draw *many* triangles, reusing code by calling "subprograms".

I let them figure out how to draw a "color wheel" with six triangles,
using our triangle() function. This, they should do in a file, so they
know about saving modules:
-----start file-----
from turtlegrphics import Turtle
t=Turtle()
def triangle():
   <snip: its a regular (60-degrees) Wossname-triangle>

# main program:
t.color('red')
t.fill(1)
triangle()
t.fill(0)
t.left(60)
t.color('orange')
t.fill (1)
triangle()
t.fill(0)
<and so on 4 more triangles, purple last>
---------------
I hope this tedious repetition with only the color changing
is motivation enough to call for a loop on a list:

for colorname in ['red','orange','yellow','green','blue','purple']:
        t.color(colorname)
        t.fill(1)
        ... you get the impression

From there on I will develop the loop for drawing a square:
>>> for sidenumber in [1,2,3,4]:
... actually we don't need sidenumber here
>>> for sidenumber in [0,1,2,3]:
... because computer scientists start counting with a zero
>>> for sidenumber in range(4):
... made it to range() at last. Now we can do quite neat things looping
with one or more turtles, exercising for-loops (and without much talk,
lists on the way)

>>> for i in range(18):
        for i in range(4):
                joe.forward(50)
                jack.forward(50)
                joe.left(90)
                jack(right(90)
        joe.left(10)
        jack.right(10)

Sorry for the rather long post, but you didn't have to read it,
did you ;-)

Cheers, Christian

All good stuff.

I continue to think programming is a very motivating way to get into mathematics.  In the pre-college years, I wouldn't be unhappy to see programming move into the foreground.  To make it sound radical and provoke anxiety, I'd say my position is:  drop math completely as traditionally taught, and teach computer science instead -- but in a different way that preserves most of the old math content (plus adds a lot of new stuff).  A less radical position:  offer this as an alternative "track" running in parallel and let it compete with traditional math.  That's actually a crueler option (means slow death of traditional math vs. a quick transition to these better methods).

Kirby


_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to