Home » Teaching Code

Teaching Code

After some deep thought, I’ve realized something that’s been missing in the way I’ve taught and looked at teaching programming. I’d like to share about it so I don’t forget and so that others can learn the same lesson I did.

I realized that many coding teachers (including my past self) are only looking at half of the picture when we teach code. The half we focus on is the concepts (e.g. “what is an if statement?”). We expertly explain concepts and then we ask our students to practice using them.

The part we don’t focus on is the ability to think like a programmer; the ability to actually put abstract concepts together so that they form a complete solution to a problem.

You might imagine where this is going. For the students who pick up how to think like a programmer easily, the only thing left is the concepts, and they progress through the list of problems with ease. For the rest, it’s a struggle.

This is where the problem emerges, many teachers either don’t recognize that the difficulty is in thinking like a programmer, or do realize it, but end up doing something that makes it worse. My solution, which I’ll get to later, is duplex, to start recognizing this when it’s happening and to do something that helps.

Unfortunately, these students end up in a mix of feeling stupid and demoralized, getting shown answers without ever getting to practice thinking like a programmer, and getting progressed to harder problems even though they couldn’t solve the easier problem in the first place.

There are three ways this pattern ends:

  • The student gives up and decides that they’re not fit to code.
  • The student persists long enough for the slivers of practice to add up.
  • The student finds teachers who don’t make them feel stupid and will make sure that they get a lot of practice on the thinking part.

So that’s the question I had to ask myself, “for students who don’t know how to think like a programmer, how can I be one of those teachers?”

The thing I did for years was to make them start from a blank page and write a complete solution. If they do that, they will have practiced thinking like a programmer.

Here, the problem is that the blank page looks scary and they don’t know how to begin. If they give up and I have to show them a solution, then I’ve done all of the thinking part.

After thinking about how I learned to think like a programmer and getting the help of some friends, we came up with the idea of writing some complete code for the student, and then asking them questions to make them practice the thinking part, “what happens if I remove this?”, “Do you know how to add this small feature?”, “Can you fix the program now that I removed something important?”.

So that’s what I’ve been doing. Thus far I have taught three students with this philosophy. Without going into too much detail, I think it overall worked great and every problem we did face was better off being faced sooner than later.

Leave a Reply