So I got bored again. We were toodling through the book just fine. We took a two week divergence into Kodu because I/we were tired of book assignments. We came back to the book. Opps. I hate doing chapter by chapter, do some selected assignments that just require looking in the chapter the assignments are at the end of, type teaching. I want the kids to look, search, dig, Google, figure out and get frustrated. In other words be like a professional programmer or a programming teacher. So here we go.
Alfred Thompson was kind enough to share a text file listing Shakespeare’s insults. There are three words per line separated by commas and maybe 50 lines (I do not plan to count them). The kids are going to write a program that randomly selects two words out of the file and place them in a sentence. (Doing this with Shakespeare’s insults does make this cross-curricular doesn’t it?) No, the sentence is not going to make much sense but that is OK. The string handling programmers of the world will think this is a fairly trivial programming assignment. The rest of us are going to work at it. The three words per line is going to be the fun part. What separates the words (commas) and how to tell word one from word two from word three is going to be the puzzler. Again the actual coding will be fairly trivial. The head scratching to get to the coding is going to be the fun part.
We are in chapter 6 of the book. String manipulation is chapter 8. Lists is chapter 11. I am simply giving them the assignment and the book and getting out of the way. One of my four students will have the assignment done before I will. It will be an ugly long no functions mess but it will work. He is going to be really unhappy with me when I tell him to do it correctly. We have been working together for two years and he refuses to do it correctly the first time. We have sort of a game going. He turns in an ugly mess, I tell him it sucks, he re-does it better than I could in half the time. Smart kids are a pain. Two of the four will get something nice in a decent time. Number four will struggle all the way to the end. He never quits though.
The balance on this kind of teaching is
1) the kid’s frustration level vs. learning on their own,
2) programming ugly vs. functions and my suggestions as to a “good” solution, and
3) using the book or Google to help finding steps to a solution vs. lucking out and finding a coded solution on the internet and just plopping it into their code and calling it good.
With a small class it is possible to watch them actually work and build the program. I can see who has hit a wall, who has gone a direction that is going to cause them issues and who has found something to plop. I did something like this last year with my senior programming class. I had what I thought were two beautiful, succinct and minimalist alternative solutions to the problem. One of the kids found a built-in Python function that made the program a 10 liner. Smart kids are a pain.