The past two years I’ve taught at a summer math camp for high school students. In 2010 I assisted with a class on chaos and fractals. This year I assisted with a computers class. I’m planning to do a couple of posts about the class. This is the first of those posts.
The computer class that I helped teach focused on hardware, but also included some software topics. My main role was teaching programming. I should point out that I am not really a programmer. I’m a mathematician who uses some programming in his work. I’ve never had a programming class. Nevertheless, I hope that I was able to get some of the basics across to the students.
I first introduced programming to the students by describing a simple language for manipulating a cube, the goal being to get the cube in a prescribed orientation. More on that in a later post.
We did our programming in two languages: Python (which you can try in your browser at: Try Python) and Alice. Both are freely available. In Python we did some simple procedural programming (I had them code up a function that computes the factorial of a number and another that runs the Collatz algorithm). One of the students was able to produce a factorial algorithm very quickly. Here is his python code:
def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)
It surprised me that he used recursion, though I think he has had some programming experience in the past. Most of the other students had had no prior programming experience and were having a hard time producing a factorial function. This also surprised me. This was my first time teaching programming, so I had little intuition for where the students might get hung up.
Alice is a drag-and-drop object-oriented language for manipulating characters in a 3-D virtual world. We mostly let the students explore Alice on their own as their interests dictated. One student wrote a very simple first-person shooter game.
In any case it was hard to get any of the kids very interested in programming. If I go back next year and assist with this same class, then I think I would like to have some compelling problems or mini-projects that would grab the kids attention and require them to do some programming. Suggestions anyone?