I was chatting with a friend the other day about how some people just seem to ‘get’ programming and some find it an up-hill grind. Having some time on my hands I did some research into the issue and found that this was not an uncommon theme amongst people who teach programming.
The common element seems to be the need to problem-solve with explicit instructions in a way which does not give you direct feedback. And I’m wondering if today’s computer games which aim to teach programming make this situation worse than it ever was.
Solving a programming challenge requires you to:
- Grasp the problem / understand the required result.
- Visualise the steps required.
- Create a mental model of what’s required to fulfill the steps.
- Write instructions that give effect to the model.
The problem is that once you get beyond a basic level you have to write instructions that don’t in themselves do anything. They are elements that build towards a conclusion, but not a thing that provides you with feedback along the way. It’s like one of those fiendishly clever paintings they used to do on children’s shows in the 1970s – line after line would go on the canvas, but it wasn’t until the very last brush stroke that suddenly you’d be able to make sense of it all.
There are numerous programs now aimed at young children that involve moving robots around, either on screen or in the real world, by giving step-by-step instructions. The thesis behind these is that it teaches kids to break the problem up into smaller pieces, into step-by-step instructions in the way that is required for programming. But the problem is that each of those steps is itself giving immediate feedback – you can see the starting point, the end-point and the possible motions on the screen in front of you or in the robot’s movements on the desk. We’re training people to expect each step to provide feedback when that’s not how the real world works: Generally in a real programming environment it is only the starting point (a blank screen) that’s in front of you and the code you write wont do anything until it’s completed.
Games designed to teach programming, and most modern computer games for that matter, give constant feedback and encourage the user through a path to a defined goal. But it is the capacity to find your own path in an open environment that is the very thing that researchers say separates those who ‘get’ programming from those who don’t.
I’ve taken to showing my Primary School programming group a finished program in Scratch – I don’t let them see the code, just the resulting program which is built using concepts I know they’ve been exposed to. I then challenge them to make their own. They don’t always produce something that’s very stylish in approach, but it’s great to see the kids rise to the challenge. And what encourages me is the idea that regardless of what they learn about programming, this approach has them learning a lot about how to tackle a problem in the real world without having their every step directed and corrected.
I still don’t know whether at a higher level some people just get programming in a way which others never will; although I suspect that, at some level, that concept can be applied to any field of human endeavour. Some people just see the poem on the blank sheet of paper or the sculpture hiding in the block of marble. But it is increasingly clear to me providing small steps with constant feedback and limited pathways is a great way to program robots, not teach programming.