The first computer program I ever wrote, in the second grade, was composed in pencil and ran on the platform known as my friend Nicholas. We were about to start learning Logo, the program that teaches kids how to draw things on the screen by writing out commands for a turtle. Before we got some face time with an Apple II, we had to act out the simple commands— Forward 10 steps, Left 90 degrees—in real life. I eventually succeeded in programming Nicholas to walk in a square.
Logo is the most memorable in a lineage of games that have tried to make programming fun and intuitive. I was reminded of it recently when I saw a demonstration of Kodu, a newly released video game from Microsoft aimed at the 9-and-over crowd. Kodu is light years beyond Logo, with modern 3-D graphics, a world players can landscape to their liking, and a cast of characters that isn't limited to the Terrapene genus. But the mission is pretty much the same: to place kids in an open-ended environment and arm them with a simple language that lets them build things. At the risk of blaspheming my youth, I dare say that Kodu is more fun than Logo. It's also a reminder that the mission of games like these is not actually to teach kids how to write code. It's to teach them how to think like programmers.
The first thing you should do in Kodu, before any of the programming stuff, is build a little world. To start with, you pave out a bit of earth and do some decorating, building mountains, digging holes, maybe filling a lake or two. Then you populate that world with trees, rocks, buildings, and other inanimate objects. Next come the characters. Among your options here are the eponymous Kodus, which look like porcine, floating submarines.
Once the props and characters are in place, you start composing rules for your denizens. This is where the learning begins. First, you choose what object or character (an apple, a Kodu, a rock) your new rule will affect. Next, you choose the situation that will prompt the rule to execute (a collision or a press of a button). Last, you dictate what the object in question should do when this situation occurs (run away, fire a missile, change color). All of this is done using on-screen, graphical menus—no writing required. The end result: a command like When something bumps into this tree, make the tree glow orange or When the Kodu sees a green apple, run away. (You can watch a video demo that shows all of this in action.)
Kodu offers enough different commands and characters that can be used to make games within the game. UFOs can be programmed to shoot missiles and dodge enemy combatants at the press of a button, accumulating points toward a "win condition" that ends the game when you reach a certain total. If you want to make a side-scrolling game like Super Mario Bros., you can alter the camera perspective. Equally satisfying, I found, was to build peaceful worlds that change and evolve according to my rules—a digital terrarium in which trees launch glowing fruit and little creatures mingle peacefully and multiply. As you build your world, it becomes increasingly likely you will get strange and unexpected results when all of your rules interact. In my first game, I unwittingly created a never-ending cascade of exploding apples as two of my trees perpetually provoked one another—a fantastic demonstration of the dangers of coding an infinite loop.
The marriage of games and coding has often felt forced. Most attempts err on the side of being educational, which is probably why they're more often associated with school than home. The graphics in these programs have gotten progressively better since Logo's heyday, but most of them—Alice and Scratch, for example—still involve writing code. (Lego, which used to collaborate with Logo, now offers a sophisticated robotics line with a more graphical programming interface.) I loved playing Logo, but I was always aware that I was learning. Super Mario Bros. had come out three years earlier, and not too many of us would have chosen turtles over their mutant cousins the Koopa Troopas. Kodu's pedagogical mission, in contrast to its predecessors, doesn't feel contrived because it doesn't require any of that pesky writing and it has the same production quality as any other video game for kids.
What are kids who play with Kodu actually learning? While Logo puts code in the foreground, Kodu deliberately keeps out any mention of variables, functions, recursion, or any other programming argot. In fact, the interface is so friendly that players can be forgiven if they don't realize that they're learning anything at all. There is not currently any obvious bridge between the game and traditional coding—you aren't taught how to write out commands, and there's no way to look under the hood to see your rules translated into traditional code. What you are learning is how to build an environment.
From a programming perspective, this is an advanced concept. Most software is still written sequentially, like Logo, with one command running after another, the same way you read a book line by line. Kodu is more like a piece of orchestral music, with lots of individual parts all playing at once. The characters you create do not patiently wait their turn to act—all of the UFOs react to all of the other UFOs, all at the same time—which is why delightful complexity is almost unavoidable after you've written a few lines of Kodu legislation.
Without making any bold predictions about the future of computer science, this feels like a useful way to think about how to write a program, particularly as we move to a computing environment in which lots of parallel processors are running in tandem. That being said, Kodu's built-in language probably won't escape the bounds of the game anytime soon. Matt MacLaurin, the game's creator, says he's thought about expanding Kodu to allow players to write their own rules in code when they want to do something that's not included in the game's considerable library of tools. (By way of analogy, think of blogging platforms that let you write posts in a word-processor window but give you the option of messing with the HTML directly if you're trying to do something fancy.)
While this is a sensible thing to offer down the line, it's not an essential part of Kodu's mission. Even without tinkering with code, kids will develop reasoning skills by simply messing around. That's why I recommend the game even for those of us who are over the age of 9. There is something innately appealing about dabbling in a mechanical world of your own making. Building a game forces you to think of complicated situations as the sum of simple rules. It also makes you realize that, even when you write the rules yourself, understanding the whole system isn't as easy as understanding each individual part. Predicting how lots of pieces will or won't work together is a central question in any number of fields, and Kodu is a surprisingly good microcosm of this problem. Give it a shot, even if Logo lost you at Forward 10.