Wednesday, October 31, 2007

Play to Learn

I've learned a lot of computer languages in my time. And I've learned a lot about learning languages.

Right now, I'm picking up Ruby on Rails for an ultra-top-nonsecret project for work. I'm actually reading a book on learning Rails: a nice book except for a few code typos.

In all honesty, I like the typos. When you compile something and it doesn't work, you're forced to go back through whatever you've typed and try to understand where it is failing. In tutorials like these, it's usually pretty easy. Even if you typed the tutorial carefully considering every line (which you didn't, nobody does), you don't really have a deep, semantic understanding of what's going on since you didn't design the code. You don't understand the architecture of the program.

Learning the architecture of a language is the hardest part, assuming you're learning a language with new architectural features and not just another Java clone. (If you don't know what I'm talking about, you need to learn LISP. Now.)

I admit, some of the languages I have learned, I have learned "badly". That is, I ignore the architecture and simply use "standard" architecture with new syntax. Bad practice, so why did I do it?

Because tutorials are crap.

This doesn't reflect on the makers of the tutorial! The best tutorials in the world... are crap. It's sort of like trying to teach someone how to make a spaceship using only quotes from eighties movies. No matter how clever your references are, it's not gonna fly.

And it's funny. Flawed tutorials actually teach you more, because they make you struggle to get your code to work. In the process, you learn more about the language than the rest of the tutorial combined. The rest of the tutorial is just a reference - it's that moment when you have to fix it that it gels.

It stands to reason that this could be done on purpose.

More specifically, it stands to reason that it could be done in a game.

I've tried creating games of this nature before, but it's very difficult to get the interface to be good enough. My incomplete mini-game Turing's Prison (now mysteriously not available, hm...) was a mediocre first stab.

Using a game, you could teach any number of programming concepts in any sequence. In my mind, it teaches you a concept, then pushes that concept to its complexity limit. Then it teaches you a new concept that simplifies all that complexity. It does all of this in the framework of a game: programming robot(s) seems most likely, although in Turing's Prison I used the code to control the rooms instead.

For example, you learn about basic single-tape, single-head Turing machines. You program your robot to do simple tasks using them. Then you slowly add more complexity: multiple tapes, multiple heads, registers, IO pipes...

Eventually the player has built a "Turing program" of very high complexity. Building a more complex Turing program would take more than one programmer and a lot of hours.

So you introduce something like assembly with jumps and hardware interrupts. That gets more complex, so you introduce something that wraps functions, like Basic. From there you can keep adding functionality in any way you please: object-oriented code, lambda functions, generative code, unit tests, databases, networks, distributed processing, alternate IO...

I can easily see it being fun. But... programming it is very hard!

What do you think?

8 comments:

Patrick said...

With the right kind of visual metaphor this could be a very succesfful serious game to be sold to universities or high schools.

The name Turing's Prison could be improved on, when I read it I thought of a game about a closeted homosexual trying to come out and be accepted by society. :P

Craig Perko said...

Well, my New Game Design is Completely Different and Just As Doomed. That should be an acronym, it's so common. MYNGID (JAD)

You read it here first. ;)

Olick said...

Well the big folly with "educational" games is usually.. its either bluntly not fun, or tacked on to an otherwise normal/fun game. However, for programming (or learning Turing machines or Automata) a puzzle game might work out nicely.

Btw: Ruby on Rails is fun to program in.

DmL said...

In a few years I will commision you to make this game (and do the graphics and story if you like) for my daughter. In the meantime I'll teach her with Alice and Scratch. : )

Craig Perko said...

Olick: The idea is to make it a cross between a puzzle game and Sim City. Puzzles to introduce the concept, then a toybox to let you try to use it yourself.

David: A Young Lady's Illustrated Primer? Wheeee!

DmL said...

That's a good name... very good name. Or maybe "A Young Lady's Interactive Primer" (like maybe with the illustrated cross out. : )

Craig Perko said...

It's a reference to Diamond Age, which is an interesting enough story. It centers around a "book" that teaches hundreds of thousands of otherwise educationless girls how to do advanced programming.

DmL said...

I know. Neal Stephenson is a god. Can't wait for diamond windows and microwaves that get their own material from the pipes. : )