Saturday, October 20, 2012

"Daddy is a Robot" on Ada Lovelace Day

Tuesday this week was Ada Lovelace Day, an annual celebration of the women in science, math, technology, and engineering who have inspired us to become who we are today.

Ada Lovelace Day is doubly important to me: in Grade 3—when I was 8 or 9—the person who introduced me to computer programming was a smart, supportive, and encouraging woman named Lise; now I have a six-year-old daughter named Ada who is smart as a whip, kind and thoughtful, and full of creativity. Lise engendered in me a lifelong joy of programming by teaching me Logo and BASIC on an Apple ][; naturally, I've been eager to give Ada the same chance by teaching her Logo.

But not on an Apple ][. Not on an electronic computer at all. Not just yet. Instead, we've been playing the "Daddy is a Robot Game."

The setup is simple: I used index cards, some sticky labels, a pen, and a pencil. I cut up the labels into small rectangles and wrote the basic Logo commands on them in pen, like this:

Note the blank space to the right of the commands. That's where the programmer writes in the parameter. I gave Ada a pencil with an eraser for this, which helped a lot when it came time to fine-tune and debug the program.

To get things started, I put a few simple commands (FD 2 RT 90 FD 2) on a card. I gave this card to Ada. I explained that when I was a robot, I would follow the instructions on any card that someone hands me. So I became a robot, Ada handed me the card, and I followed the instructions. I ended up running into a wall. Ada was hooked immediately!

Coming up with inspiration for a program turned out not to be a problem. On her own, Ada quickly decided to try and get me to go upstairs.

We designated a place on the floor as "home," and Ada made a card that had just the HOME command on it. At first, she would hand it to me before each run through her program. Then, to make things efficient, she wrote HOME on the back of her program card, then she invented the TURN command, which told me to flip the card over and run the program on the other side. How quickly programmers want to become language designers!

Giving the arguments to LT and RT in degrees was not a problem. Ada is in first grade now, and although she's not completely comfortable with "big" numbers, it was a comfortable stretch for her. She had no trouble remembering 90 degrees is a right angle and 180 degrees reverses course.

But from my point of view, the most amazing part was to watch Ada debug the program. It came naturally to Ada to sit at the table and visualize herself moving through the program as me. She would locate the instruction that caused me to overshoot or undershoot a turn—or run into something—and then erase the number and write in a different one.

Taking this exercise to the computer will be a small step: we're already using real Logo syntax, and we're working with the concept of starting over with a blank slate in the home position (in Logo, you do this with the DRAW command).

I have no idea what Ada will want to do when she grows up. Veterinarian, Astronaut, and Drummer are all on the list. I wouldn't be surprised if she adds Computer Programmer after we take this game onto the computer. Whatever she chooses to do, I think that it can only help that she's making the neural connections now that will give her an intuitive understanding of what it means to program a computer.

If you're a mom or a dad, a teacher, or an uncle or an aunt, why not try this with the 5- and 6-year-olds (or older) in your life? It uses simple supplies you probably have in a desk drawer already, it takes minutes to get started, and it just might lead to a lifetime of fun.


  1. My dad taught me to write .bat files when I was not much older than Ada. Having been familiar with if-then statements and other loops since childhood has been SO helpful to me and is one of the big reasons I was able to settle right into HTML and PHP when I was older, not to mention Logic classes in university!

    I think the other thing this teaches is a tolerance for making errors and the ability to troubleshoot many times. This:

    "She would locate the instruction that caused me to overshoot or undershoot a turn—or run into something—and then erase the number and write in a different one."

    is such a key step towards becoming persistent instead of giving up when something doesn't work right away. It also teaches humility, because the errors in our code don't go away just because we think we're right. Programming teaches me over and over to swallow my frustration and re-check my logic.

    I'm teaching SketchUp classes right now and we talk a lot about the fact that everyone gets stuck or messes things up, and how to undo things or zoom out when you get lost inside a model. One of my assistants, an architect who uses SketchUp daily for her job, was demonstrating something the other night and messed something up and had to start over. I was so glad it happened in front of the class because it really demonstrated that even the experts are not just "good with computers" — we are just persistent and know how to back up and try again. And it was nice that it happened right after our lecture to Save Early, Save Often. ;)

  2. I love your approach -- it detaches the computer, with all of its distractions, from the mental exercise of getting the algorithm right. Like cooking a complicated dish with many steps and ingredients, it's important to do a run-through in your head of all the steps.

    Once you have a clear idea of all the things that have to happen, and what problems you might run into, then you can start work.

  3. Good for you Jonathan Fuerth! The fun part for me was to see the moment they actually "get it" and how they take off from there.

    I also taught a chess class in the elementary school and many of the concepts are similar. Learn all the rules, Be prepared to loose. Analise what went wrong. etc.

    Keep up the good work with your kids. They will thrive with this kind of interaction.

  4. That is amazing Jonathan! I love the way you incorporated the fun aspect into it, seems like the perfect idea to keep a child's interest. At the same time, learning to work out a problem, testing and revising your solution will be such an important skill that they learn from this game. Great idea!

  5. Thanks everyone for your comments and encouragement so far!

    @Heather Ann: it's good to hear that your batch file hacking sessions with your dad continue to be a fond memory and have provided the confidence and experience you needed both professionally and at school. We will stick with this. Ada is loving it!

    @Alex: Yes, even though one of the design goals of Logo was to provide clear error messages, I think I can deliver them with a bit more genuine encouragement (and slapstick humor, which plays well) than the Logo interpreter. We'll get to the computer eventually, but this person-to-person exercise still has some value to it!

    @Kaldy: Thanks for the kind words! I have to admit, although I know the rules of chess, I was never much use at winning. I will have to find a better mentor for my daughter when she takes an interest!

    @Kevin: Yes, fun was always a vital part of learning for me. Even into university, I learned a lot more in the lectures from the "fun" professors like Buhr, D'Alessio, etc. You may remember me sharing my opinions on this back at SQL Power. :-)

  6. Hey Jonathan!! Jason Harley pointed me over to this blog. I have a 5 year old now and I am getting out the index cards NOW to jam this down her throat... I mean lovingly encourage her to embrace the game :)