I thought I’d take a break from blogging about my research and instead write a little about my favourite research on the Psychology of Programming. The following paper is quite old now, but inspired me hugely.
In 1999, Marian Petre and Alan Blackwell set out to ascertain whether there was truth in the belief that experienced programmers use visual mental images when they are thinking about program design. They asked expert programmers (who had been programming for more than ten years, worked on large-scale, data- and computation-intensive programs and were described by their peers as ‘experts’) to describe what they were doing. In particular, when they stopped writing, closed their eyes, stared into space, stared at blank paper or gestured in the air they were prodded to explain what was happening. They were also asked again about their visual imagery once the session was complete. The results are fascinating and appeal to me whenever I mistakenly think about programming as an entirely step-by-step, logical process.
First, The responses show huge creative diversity. Programmers describe their mental models in phrases like: “It buzzes … there are things I know by the sounds, by the textures of sound or the loudness … it’ s like I hear the glitches, or I hear the bits that aren’ t worked out yet … ” or “ … oh, that happens over there … it’s on the horizon, so I can keep an eye on it,but I don’t really need to know … ”. Expert programmers were talking of being able to ‘fly over‘ the solution they were building! I was astonished and it triggered a distinct memory I still have of working on a complex, data-related programming problem and having a really strong mental image of a set of enormous metal tubes all around me that I needed to navigate through. This didn’t feel quite so strange when I read one of the expert quotes in this paper saying that their mental model was a machine that was like “a great, bristling, multi-coloured scaffolding of pipework and gadgets floating in space”.
Even more dumbfounding, the experts ALL talked about their models having more than 4 dimensions. The extra dimensions usually related to alternative strategies or views or additional information. They could tell how complete part of a solution was simply by looking at their mental image of it.
There are many other aspects in the paper itself, which remains a great read. The final one that really struck me was that the mental images of expert developers were more creative, complex and multi-dimensional than I would ever have imagined. Marian Petre and Alan Blackwell describe them as “stoppably dynamic”. That is, they move through the problem but the programmer can vary or freeze their rate of execution. Sometimes they can even make it go backwards.
The research was intended to help inform the use of diagrams and visual representations in software development tools. For me, it’s impact was more in the way it seemed to confirm the presence of the creative aspects of computer programming. The part of what we do that is hard to articulate to others. The ‘secret sauce’ that makes a great programmer. I’m still fascinated by it after all these years.