The role of instructors in programming training

I've been spending a bit of time recently arranging to run some instructor-led training courses early next year, which has got me thinking about the role of the instructor in teaching/learning programming. This is a pretty important question – essentially, why is an instructor led course better than self directed learning? – so I decided to write down my thoughts on the matter.

Roadblocks to learning

I want to address the question in a kind of roundabout way, by first talking about a phenomenon I have tentatively called roadblocks. These are the moments that occur whenever you're learning any new skill in which there's something that you don't quite understand, which prevents you from making further progress. When you're learning a new skill and you hit a roadblock, it's not necessarily a bad thing – indeed, the point when you overcome a roadblock by correcting your understanding is probably the instant we would point to if asked exactly when "learning" occurs. The nature of programming, though, means that these roadblocks tend to come thick and fast, especially for beginners, and are particularly hard to get around.

Programming is unintuitive

It's very easy for those of us who have been programming for a long time to forget just how unintuitive programming is. When you're first learning to write code, there's no obvious reason why variables or loops or dictionaries behave the way they do – these things seem profoundly arbitrary. Ironically, it's only once you dig deeper into programming, and understand something about how these things are implemented, that their behaviour seems to flow predictably from the way they work. Once you know about stack frames, it's easy to see why scoping works the way it does – but that knowledge usually arrives too late to save you from having to struggle with scoping issues earlier in your education. This unintuitive behaviour means that roadblocks arise (I think) more frequently than in other fields of learning.

Programming is relentlessly progressive

The practise of programming revolves around building up small, simple pieces of functionality (like statements) into bigger, more complicated ones (like functions, objects and entire programmes). The process of learning to program follows the same pattern – you start by learning the most basic, atomic blocks (variable assignment, simple statements) then use this knowledge to bootstrap your ability to use more complicated things (loops, functions, etc.). The practical upshot of this is that you have to understand each of the simpler building blocks in order to make sense of the more complicated ones. In other words, when a roadblock comes along, you can't continue to make progress by simply going around it and moving onto a different topic.

By way of analogy, imagine you've never cooked a meal in your life, and you decide to learn cooking from scratch using an online tutorial. You happily work your way through the various chapters with titles like Sauces and Pickles and Vegetable Soups until you come to the section on Bread Making. At this point, you run into a roadblock – none of your breads will rise, and you have no idea what you are doing wrong. No matter – you can just skip the bread section for now, and move onto the chapter on Rice and Pasta.

Contrast this with the situation where you're learning programming from scratch. You make it through Variable Assignment and Printing Strings, and are making good progress until you encounter a mental roadblock in the chapter on Loops. Somehow you just can't get your head around the way that the loop variables acquire different values in each loop iteration. Just like in the cooking example, you decide to skip the troublesome section and work on something else for a while, so you move onto the next chapter, Processing Files. Unfortunately, the very first example involves using a loop to parse each line of an input file, and you can't understand the example because you don't understand loops. You try again, and skip forward to the chapter on Dictionaries, but again, half of the examples in this chapter use loops to either construct or iterate over dictionaries. Your forward progress is stalled until you can go back and really get to grips with the concept of loops.

Because programming is progressive in a way that cooking is not (and this analogy is in no way meant to belittle cooking as a skill!), the roadblocks that beginners encounter are harder to get around.

It's hard to ask the right questions

This is another aspect of programming that experience tends to render invisible: when you encounter a roadblock in programming and need to ask for help, very often it's difficult to know how to phrase the question. The lack of understanding that causes the student to need help in the first place also ensures that they're unlikely to know what question to ask, or the right way to phrase it. I'm certainly not suggesting that this problem is unique to programming – it's found in pretty much every technical field – but the highly abstract nature of the things that we talk about ("method calls", "return values", "function pointers") make it particularly tricky. This difficulty in communication explains why, even though the internet is bursting with forums, message boards and mailing lists populated by helpful people who are happy to assist novice programmers, it can take a long time to pin down the root cause of a student's misunderstanding.

It's hard to stay motivated

There are two main reasons why students find themselves on my courses – either they want to use programming to solve a problem, or they've been told to attend the course by some higher authority (an employer, a PhD supervisor). Overwhelmingly, it's the ones who have a concrete problem to solve that tend to make better progress, not because of any intrinsic ability, but because the problem provides the motivation for them to persist with learning a difficult skill. Especially in the early stages, learning to program can seem a relatively thankless task, where the only payoff from successfully understanding a tricky new concept is the prospect of moving onto the next, even trickier one.

Of course, later on in the learning process it usually becomes clear how mindblowingly useful programming is (and I purposefully structure my courses to get students to this point sooner rather than later). Nevertheless, one of the biggest problems many students have when learning programming is simply running out of steam and becoming demoralized – a process that is usually triggered by encountering yet another roadblock.

Getting over roadblocks

The point that I am trying to make under the headings above is not simply that programming is hard, but rather that it's hard in a particular way that is amenable to being solved by the presence of an instructor. The chief role of the instructor, as I see it, is to get students over these roadblocks as quickly and painlessly as possible. To illustrate the value of this, let's consider a typical scenario facing the self taught programmer…..

Imagine that you have set aside a week from your busy schedule to get started with learning to program, something that you've been meaning to do for ages. You sit down at your desk on Monday morning with your chosen learn-to-program book in hand, and start working your way through the exercises. Give that you're fairly computer savvy – you know how to use a text editor and a command line – you should have no problem getting a good grounding in the basics by the end of the week.

Just before lunchtime, you run into a roadblock – some concept or example that you can't seem to figure out. You've obviously misunderstood something, because even when you look at the example solution to the exercise, it doesn't make sense. You decide to take a break for lunch. When you get back from lunch you still don't understand the example, and resolve to read the chapter again from the start to see if you've missed something important. When this doesn't help, you decide it's time to ask for help. You post a question on the mailing list for your language of choice, explaining your problem. Then you alt-tab over to Facebook and kill some time while you wait for a reply...

Sometime near the end of the day you get a response. Excellent! it's from an experienced programmer who's prepared to help you work through the problem. They've emailed you back with a couple of clarifying questions that will help to figure out exactly which bit of the code you don't understand. Unfortunately, they live on the other side of the world, so you will only be able to communicate during the brief period when you're both awake. By the time you go home, you're feeling a bit demotivated; you had planned on getting through at least two chapters per day but you're still stuck on the first one, and you have a feeling that there'll be many more roadblock moments to come.

Now, admittedly this is a bit of a gloomy picture – things will not always be this bad! There may be experienced colleagues you can talk to, or you may be able to get over your roadblock with the help of a second tutorial that explains the concept in a slightly different way, etc. But the overall pattern will, I think, be familiar to anyone (myself included) who describes themselves as a self taught programmer.

Contrast this with what might happen in an instructor led course. Just as before, you encounter a roadblock in one of the exercises and you can't understand why your code isn't working. After puzzling over it for a couple of minutes, you stick your hand up and the instructor comes over. Because the instructor has taught this material many times in the past, they've probably seen this exact problem before, and rather than just fixing the code for you, they can use this experience to quickly figure out the cause of your confusion by asking a couple of questions. They can then write a couple of lines of code illustrating the problem that you're having and explaining how to solve it, while simultaneously clearing up the original source of your confusion, while you watch and ask questions in real time.

In this way, five minutes after you encountered the roadblock you've already overcome it and can move on to the next section and keep making progress. Rather than feeling demotivated that you've wasted a bunch of time, instead you feel like you understand the material better for having struggled with it, and are increasingly confident that this programming business might actually turn out to be quite tractable.

I have exaggerated the two scenarios above to make the point, but the central idea remains: the main job of the instructor is to ensure that when a student encounters a roadblock, they overcome it rapidly and don't simply give up.

Having read this far, if you think that instructor led training could be useful to your organization, drop me an email: