Via my brother a lovely example of gamification: codecademy is an interactive javascript tutorial on introductory programming in javascript. It's browser-based and gives you constant bits of feedback, rewards, and a constant helping hand of just the right level towards the right answer; both the code and the pedagogy appear sound. I haven't tried really hammering on the platform to see if, for instance, malicious code could be injected, but it can certainly catch errors from its intended audience of blunder-prone novice coders.

One of the nicest things this site illustrates is how to build learning-supportive feedback directly into the doing of the task itself. It's long been shown that context-switching is a mentally inefficient and disorienting task. This UI layout, with the tutorial content right next to (or in some cases, inside) the code environment itself, prevents you from needing to context-switch at all; compare this to a textbook, where you have to rapidly transition between reading about programming and actually doing programming. Lecture is even worse; not only do you have to context-switch constantly, you have no control over when you context-switch and what content is presented to you at what pace (when the teacher talks about a topic, they talk about that topic right then, regardless of whether or not it's what you need to hear).

I've dropped the makers of codecademy a line to see if we can learn more about what they're using for a backend. I'm curious what sort of tools are out there to support good pedagogical techniques, and how flexible/extensible they are for other applications. It doesn't look like it's open source right now, but we'll find out, I hope.