Here is the first programming assignment of the year for my Programming II/III kids. We are going to walk to the nearest traffic signal and discuss what it would take to write a program to simulate a traffic light functioning: 3 different color lights, crosswalk button, two directions, countdown timer on the crosswalk and whatever I and the kids see. This idea sort of came to me last week in Oregon after a day of mountain biking. One of the people I was with sort of just triggered it. Initially I thought the exercise a bit trivial; a timer, a counter and a sensor. I started thinking what I would write this in. Then it hit me, the exercise should not be the traffic program, the exercise should be what to do it with in the way of a language or a hardware. Initially I was thinking of using the Arduino; little LEDs and a button and actually make an operational signal, but then it hit me again, this can be done with all sorts of things. Digital simulation with lights on a monitor and a keyboard press. Inputs could be signal duration depending on speed limit of the streets at the signal and traffic volume. Another solution could be with Lego Mindstorms and the old railroad semaphore type signals. The problem has now changed from having a solution (a language the kids are supposed to learn) with me trying to dream up a problem to use it with, to here is a problem, now how should we solve it? Want real lights? What do we have that will give us real lights? Want just a graphical simulation? What do we need in a language to get an interesting graphic?
I am trying to get my programming classes to evolve from strictly a programming class with a selected language to more of a computer science class with a set of problems that need solutions that computers can help with. I am finding this is not easy. A Programming I class simply does not have a clue as to what tools are available to work with or how difficult some tools are to use. At the moment Programming 1 is “Here is Scratch, here is what we are going to do with it.” I want to reverse that. I want “Here is what we want to do, now let’s find something to do it with.” The list of possible somethings at this level limits the possibilities. I think I need to focus more on the pseudo-code approach at this level. I just need a way to make it interesting. Simple games like Lights Out are very good for pseudo-coding and just plain thinking about. A very simple game to play and yet requires some excellent problem solving.
Over the years my usual strategy to get kids interested in programming, and as an off shoot CS, was through games and game writing languages. Overall I still think this is a good strategy for some kids. The problem solving I am after is there but I still want to broaden their thinking, especially in the upper level kids. I still have to keep the class interesting to attract kids, it is still an elective that can die if it gets a reputation of being boring or excessively difficult. With the upper level kids I have a bit more flexibility, they are already invested and hooked.
Now I need to start looking at exercise ideas for kids to consider and build on. I have a few that I have used previously but they are a bit geeky; one involves searching Shakespeare’s Sonnets for the nth Sonnet or how many times the word xxx is used (uber-geeky but cross curricular), another involves computing the nth term of various Taylor expansions (real geeky but again cross curricular). I need to get ideas that are not quite so geeky.