Teaching Programming

This past week I starting to teach lab sections for an “Intro to Systems Biology” class. The class marks a return to Matlab for me, which is the first really dynamic language I learned, but a language I haven’t particularly been missing. We’ll see how it goes, but I’ve already identified some rough spots from the lectures that I think will end up being confusing:

A “new” language

One of my strong suits in teaching Python is that I have a lot of practice using it. What that means is I’ve acquired a pretty deep sense of where things are likely to go wrong, because I’ve made (and, let’s face it, continue to make, though not as often) all the same mistakes. This won’t work as well for me in Matlab, since although I’ll be able to spot the structural errors, there’s lots of ways to write things in any language that look mostly correct, but aren’t.

The for loop

Having taught grad students how to program for the last several summers, for loops are the place where things have historically gone off the rails for a fraction of students. I think it’ll be worth hammering this home, and specifically showing them exactly what’s going on. Fortunately, Matlab has a nice debugger that will step through the code line by line.

Syntax oddities

Function calls in Matlab look just like indexing. Will this be a problem? Maybe. I can’t wait until the first time someone names a variable sum or exp or log or something like that, and they try to use the function. Could you do this in Python? Sure. But now I think it’s going to give me weird errors that aren’t related to the fact that an array isn’t callable.

The good stuff

All that said, I think the structure of the course is actually a nice, really gradual introduction to programming. I think the limited scope of the course and the tight matching between the material and the language (’cause let’s face it, if you never write a for loop in Matlab, you’re doing it right) will really help students get their teeth sunk into it.

Leave a Reply

Your email address will not be published. Required fields are marked *