Conducted by John Spurgeon from 6 August – 10 August 2018 at MiT School.
Recap
Veterans Katie, Justin, Leon, and Sun returned for another exciting week of coding and were joined by newcomers Clark and Maymuna. Of course, we quickly brought Clark and Maymuna up to speed by introducing them to the first program to write any language. Then we continued to explore the unique combination of low- and high-level programming that we began last week, which too few programmers at this or any age get a chance to really appreciate and enjoy, using mainly JavaScript and TOY respectively.
There was lots of printing, as you might expect, with the familiar JavaScript commands alert, confirm, and console.log. We sent characters to our simulated TOY output device by storing corresponding character codes to memory address #ff after first loading them into registers.Our hands-on experience with TOY was greatly enhanced this week by the introduction of register and memory displays that helped everyone see what we mean when we talk about things like registers, addresses, memory, the program counter (PC), and the instruction register (IR). A cursor that highlights and follows the PC address in memory as a TOY program executes added critical animation. And on Friday we were finally able to change the execution speed of our programs by selecting a hertz value between 1 and 512 instructions per section. That was big, satisfying, much anticipated milestone that made everyone's day.
Numbers were, once again, a hot topic of conversation and practice. Everyone was shocked to learn that we could produce a negative number by adding two positive numbers together. But the mystery behind that magic was not kept secret for long. Now everyone knows (or has at least been exposed, once again, to) the fact that numbers in computers have a tendency to cycle around like that numbers on the face of an old-fashioned clock, due to the limited number of bits (or in some case, the limited amount of address space and/or physical memory) that can be used to represent a number using a sequence of ones and zeros. We had lots of fun talking about how numbers can be expressed in different number bases and got more practice converting between number bases, especially binary, octal, decimal, and hexadecimal.
Early in the week we enjoyed meeting Marvin Minski and listening to him talk about Legos vs. Tinker Toys. He points out that you can't build triangles with Legos but you can with Tinker Toys and wonders how this simple but profound difference between the sorts of toys that kids grow up with today vs. the toys that kids grew up with just a few decades ago affects young people's understanding of the world we live in, in particular the strength of structures built with triangles. This is a very interesting topic that is analogous to the understanding of computers that one gets or doesn't get depending on whether you ever work with anything other than highly abstracted commands in languages like Python, Java, JavaScript, Scratch, etc.On the last day of class we performed a really neat activity. We ran three different versions of essentially the same program (using TOY) that sent characters to an output device. Two of the programs used a loop and one did not. Since TOY has a counter that keeps track of and displays the number of instructions that have been executed, it was easy to see how different the three algorithms were in terms of their performance, as measure by number of instructions executed, even though they produced exactly the same result by the time the algorithm terminated. This, I explained to the class, is what the branch of computer science called analysis of algorithms is all about and is, for me at least, one of the most interesting aspects of the art of computer programming. The very end of the final day saw everyone participate in an impromptu, self-directed coding exercise where students took turns writing short programs in front of the class while I stood off to the side and watched (very happily).