Syntax error: revisiting programming education from a natural language perspective

Sure, it is possible to learn computer programming by browsing a coding book and using the internet whenever you get stuck. But with knowledge of programming becoming ever more important in our society, it is high time to develop accessible educational support that can reach a wide range of people. Vivian van der Werf addresses this challenge from a natural language perspective.

vivian van der werfWith a background in archaeology, owning two rabbits, and rejoicing whenever one of her houseplants grows a new leaf, Vivian van der Werf does not have the giveaway characteristics of somebody pursuing a PhD in computer science. And that’s a good thing. “The common misconception is that you have to excel at math in order to become a good programmer,” she says. “But recent research has indicated that language skills are at least as important as mathematical skills, if not more so. I therefore think that a natural language perspective may be instrumental in teaching programming skills to a wide variety of people. It can help in tackling the misplaced fear of needing certain technical skills and show people that you can be creative at programming no matter what.”

Back to basics
Current programming education almost purely focuses on writing code. That’s a mistake, as far as Van der Werf is concerned. “It certainly is very rewarding when you manage to code a solution to a mathematical problem or your own hangman game, but by also addressing other skills we may be able to assist many more people in achieving coding proficiency. Think of how you learn to play an instrument, or master a language. You don’t start by reading a book, but first learn the letters and how they sound, then small words, brief sentences, some grammar, interpunction. Learning to program should be similar: taking many small steps rather than overwhelming the student with large pieces of code consisting of very precise-working syntax.”

   A natural language perspective may be instrumental in teaching programming skills to a wide variety of people.

Explain in plain English
One of her earliest endeavours while pursuing her PhD within the Leiden Institute of Advanced Computer Science was to delve into code reading. “It is an often-overlooked step in learning to program but it is a good indicator for code comprehension, and it correlates with code writing skills,” she says. She asked bachelor students to explain the working of a program in plain English. But rather than explaining the purpose or ‘social function’ of the program – you play a game of rock-paper-scissors against the computer – groups of students also focussed on specific syntax and the actual output of the program.

Many of the students also made the same mistake when interpreting a piece of syntax called a FOR-loop. Van der Werf: “What may be straightforward after only a while, may not be so for someone just learning to program. It indicates that the instructional steps must be even smaller, more explicit. That may be too slow for some learners, but that is no different from when teaching a language, numeracy, or sports.

   What may be straightforward coding syntax after only a while, may not be so for someone just learning to program.

What’s in a name?
She also interviewed programming teachers from secondary education all through university level on how they teach variable naming. “A consistent and unambiguous naming convention helps improve code readability and code understanding – for example by someone who will continue to work on your code later on,” van der Werf says. “But while there is a lot of research into such naming practices, as of yet little attention seems to have been paid to how to best teach this good practice. There is a lot to gain here when it comes to wider education in programming.”

Qualitative research
Perhaps even more so than any other discipline, research in computer science tends to be very quantitative, focussing on numbers and correlations. And innovations in programming education can often boil down to inventing the wheel by introducing (hyped) practical solutions. Van der Werf, however, employs a qualitative approach – such as observational studies and individual interviews – to gain a deep understanding of underlying reasons and motivations. “Sometimes it makes sense to approach a challenge from a different perspective.”

She also feels her archaeological background to be of value for her research. “In archaeology, whatever you excavate may have originally been accompanied by some material that by now has decayed or been pillaged. You also need to bear in mind that you are biased by our current our society when interpreting any sample. So, I am very careful when interpreting the data I acquire on programming education, and fully aware that someone else may draw different conclusions from these same data – or even I myself, ten years from now.”

   No attention has yet been paid to how to best teach good variable naming.

Impact on teachers
Next up for van der Werf is an assignment at the level of secondary vocational education (MBO in Dutch). “They asked me to come up with an alternative way for teaching computer programming. A very interesting assignment as the MBO constitutes a very large group of students that is typically overlooked in educational research. It certainly fits my aim for my research to be applicable for a wide variety of target audiences.”

Van der Werf is expected to complete her PhD in a little under two years from now. At that time, she hopes her work is set to make, or will already have made, an impact on teachers. “For myself, I want to have gained a deep theoretical understanding as I would like to continue my career consulting or training professionals. One way or another, I want to keep working with teachers and lecturers.”