How to make programming lectures more effective and stimulating?

Re: The desire for in-class exercises (code "on the spot") -- One thing I've discovered this semester (teaching introductory C++ out of the Gaddis textbook) is the idea of laboratory exercises with mostly filled-in programs, where the students only need to add a few lines involving the new language structures that you just lectured about. Compared to "write a whole program right now" exercises that I'd used in the past, this goes down remarkably well; fits in the right time slot for everyone, gets their hands/eyes to have typed that structure at least once, raises up the salient points/difficulties of exactly that one topic, etc.

The fill-in lab exercises I'm doing come directly from the Gaddis instructor materials, so that eases my workload a lot. Frankly, I wouldn't have expected them to work as well as they do, but every day there's an important teachable moment that emerges organically. Not a silver bullet for everyone, but it's kind of been a revelation this semester.


Live coding (in particular as done in Software Carpentry workshops) is great at getting the programming across. I've used it in standard university lectures for three years and it's very popular with students. Key advantages are

  1. It slows you down, so you move at a pace closer to the students' level;
  2. When you make mistakes - and you will, and should - you show the students that this isn't a problem, and also show them how to fix them on the fly.

These advantages have their disadvantages built in: it eats more time in a busy lecture, and you need practice to be able to prepare without over-preparing. You also need to make the code available along with the slides for later perusal - combining lecture capture with live coding works, but having the files available is better.


I've been in a similar boat, TAing for economics courses where a piece of software was used throughout that most students didn't know to begin with. I found a few things worked well:

  • Does your school have a technology lab? Mine had one, and they offered regular seminars and individual help on using common pieces of software. They were often happy to coordinate with professors for specific classes. Look for that, and if it exists talk to them.
  • Following on, dedicate maybe one entire class at the beginning to going over the software. As an alternate or supplement, offer an extra non-class session on it. This may not be practical given you work full time off campus, but if you have a technology lab there might be someone else who can do it. Particularly since you don't offer office hours, however, this might be appropriate for you to make time for.
  • Stress right from the start that learning this piece of software is crucial to passing, and that they will not be able to learn it just by watching you do it in class.
  • Along those lines, email the students before class begins so that they're fully aware they need to know the program to follow the course, and you'll only be dedicating minimal time to teaching it to them.
  • In the case of R, there are a myriad of other sources out there for learning to get started. There's no need to reinvent the wheel! Vet a few of them for quality, then recommend them to the students. This may not work as well with more obscure pieces of software, obviously.
  • Minimize the code you show on slides. Parsing another person's code is difficult in the best of circumstances, and an unfamiliar language in a slide show is far from that.

The bottom line, really, is that it's impossible to learn a programming language by sitting in class. The students will have to dedicate out-of-class time to practicing it. You can point them in the right direction and show them resources, but you can't hold their hand the entire way; at some point you just have to expect they can follow what the course requires.