An interactive approach to teaching programming concepts

While comprehending the syntax of a programming language can be challenging to novices, the computational mechanisms represented in a program text can be even more difficult to understand. It is very useful for programmers to develop ways of mentally visualizing a program's computational process. I have been experimenting with an approach that develops the user’s ability to visualize computational processes through puzzle solving and macro building. As the user issues the commands to solve a puzzle, these steps are recorded as a program sequence (similar to recording a macro).
An interactive flash demo of this approach can be found here.

I would much appreciate your ideas/feedback regarding this approach.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Beautiful, but do you have

Beautiful, but do you have any write up on the pedagogy behind the system? I'm not exactly convinced this is helpful in learning programming.

I think of it as part of a supplementary curriculum

I don’t think it does teach programming per se as it does demonstrates certain features of stack computation such as the importance of operation order, or their ability to compute branching structures. I also wanted to allude to the idea that something with a complex branching pattern (the nesting) could be specified in as linear command sequence. These ideas are not always intuitive; I believe it helps to interact with such models to understand them better. This is a single exercise, to be truly effective it must be part of a whole curriculum of such exercises that demonstrate different kinds (and aspects) of computation.

Well, this really begs the

Well, this really begs the question: would pre-training of non-programmers using these exercises lead to better learning of programming afterwards. This would actually be quite easy to test, and could lead to real improvements in how we help kids get programming.

However, if we look on the app store, there are a lot of games that are based on similar concepts (write small programs to solve puzzles).

There are many puzzle games

There are many puzzle games that involve programming tasks. Most of these appear to be based on sending directives to agents in an environment. These are very good exercises. I have found very few such games where the puzzle is solved by manipulating potentially complex data structures. I feel this is missing from the pre-training curriculum.

Such puzzles could be added

Such puzzles could be added in at a young age, but it is not clear how they can relate to improved future programming skillz and technical literacy; we need to do more research in this area! This is one area of PX where I believe empirical evidence is necessary and is actually feasible to get through controlled experiments.

The reason that these techniques are not pursued in academics is that no one has figured out if and how they connect to actual programming tasks the learner will do later. Instead, we just throw them directly into Java or some other language, since what they learn will definitely be highly relevant. I guess if we take the puzzle approach, we have to figure out what the graduation path is (David pointed out Codespells in another thread, which seems to be directly related to Java).

Very cool

It should really have a robotic voice in the background chanting "inside first, then build out" for that final touch. Good fun, there seems to be a good connection between the puzzle and the idea that is being learned. The sequence of steps introduces different levels, and sequences of nodes, then combines them.

One random idea is that the values being operated on in the stack and the register are actually visualisations of trees - it might be useful be able to see the trees as trees. Perhaps a mode switch somewhere that flips between drawing the states as shapes and trees. It could be that being able to access both representations makes it easier to learn.

Have you given any thought to what kind of experiment you will design to evaluate this work?

tree visualization

I am very glad you like it! As for your comment on tree visualization, that is certainly a direction I would like to go in. The way linear command sequences can generate branching patterns is a fundamental concept in programming that is not always easy to grasp.

CodeSpells is another recent

CodeSpells is another recent work on interactivity for teaching programming. The IDE is a spellbook. There is a paper on the pedagogy.

FORTH Warrior is another interesting game that could be used to teach code. I've an idea for teaching programming through live programming of game characters overcoming a series of progressively difficult puzzles and building a library (though I was thinking of a small team of goblins with different skills and limited ability to carry tools, in a style akin to lemmings)

.

I've always wanted to build

I've always wanted to build a MMPG set in a high-magic fantasy world where spells were...completely programmable. Balancing would be a pain, but the creative results could be tremendous (not to mention the educational benefits).

Programmable spells

Programmable spells have been done in MOOs and emulated in SecondLife, etc.. But most of these are more social in nature, no strong gameplay aspect.

If it's a PvP or PvE game, you could address balance issues in terms of resources (mana/stamina, ingredients, space for runes or time for arias, etc.) consumed by the various commands in the spell. Similar to a linear logic. Resource constraints would also prevent spells from running completely unchecked on a server.

You might diversify players by giving them some 'talents' e.g. in terms of commands with lower costs, and one could then have commands with overlapping or redundant effects (such that simple refactorings can sometimes lower costs). This would encourage players to understand, remake, and fine-tune spells obtained from other players, and would increase the learning and optimization surface.

It's certainly an interesting idea!

Balancing can be done in many ways.

If casting a "custom" spell has some cost which is exponential in (size of code * frequency of use) and available in limited supply or at a limited rate, then the game will reward succinctness and also autobalance to some extent.

[technical] you should separate

[technical] you should separate recording the solution from rendering it, or otherwise find some way to speed up the processing of button clicks. I was solving them faster than it could keep up, and it missed a lot of clicks, which frustrated me.

(also, I didn't notice any increase in difficulty)

more levels

Now that i finished the pure synthesis levels, it would be fun to have levels where I am given an already existing shape and have to edit the instructions to conform to the target shape. This could work through direct editing or by the addition of 4 more instructions for programatic tree editing (decend tree, move right one element, insert element, delete element).