I teach in a small high school in southeast Alaska, and each year I teach an Introduction to Programming class. I recently learned how to use IPython Notebook, and it has completely changed the way I teach my classes. There is much to improve about CS education at the K-12 level in the United States, and sharing our stories and our resources will go a long way towards improving what we offer to students.

My first programming classes

Like many people who teach Intro to Programming classes, I don’t have a formal CS degree. I started programming as a kid, and then went on to a degree in Physics. I have always programmed for fun, however, and recently I have started to take my programming more seriously. As I have taken my own programming more seriously, I have been looking for ways to bring it into my teaching.

The first time I taught an introductory programming class, I created lessons each day and came up with exercises and challenges for students to try. Students loved the class, because they spent most of their time trying to apply what they were learning to problems they could solve. They felt like real programmers from the first day of the session. The class was a nice start for me as a programming teacher, but we didn’t get very far. It was just too hard to create curriculum at a pace that kept up with my more capable students. As someone without a formal CS background, there was also plenty I had to clarify for myself along the way.

The second time around, I tried to base the class on an established curriculum. I tried to use Zed Shaw’s Learn Python the Hard Way, because I had heard such consistently good things about it in all the tech communities I participate in. It didn’t work out though, because students just did not catch on to the approach of LPTHW. I know LPTHW asks students to write their own programs, but for people brand new to programming, there was just too much left to them to figure out, even with a teacher in the room. I have one student who really enjoyed it, but for most students we didn’t get a whole lot further than my first class, and they had a lot less fun along the way. This is not a criticism of Zed’s work, it is an admission that I did not use his curriculum in a way that captured my students’ interest in programming. My students seemed to respond better to very specific exercises based on what they just learned, with a more gradual transition into exercises and challenges that ask them to apply their own ideas to what they have just learned.

This year’s class

This time through, I wanted to go back to creating my own lessons, with more efficiency than I had before. I also needed a backup plan for students who might outpace my teaching. I heard about IPython Notebook every day at PyCon this past year, so I decided to take a look at it. Once I got used to it, I couldn’t believe how effective it could be as a tool for teaching.

If you are unfamiliar with IPython Notebook, it basically lets you mix Python code and text on the same page, and lets you run your code blocks as separate programs. IPython Notebook was developed for scientific programming, where you want to solve a larger problem through a series of smaller programs, with notes in between about your progress. This approach allows for a much more efficient workflow than having to write a bunch of separate program files, with your notes in separate text files.

As a teacher, I found this was a perfect tool for creating lessons. I write a few notes about a topic, then write a small program to illustrate how to implement the topic in code. IPython Notebook makes it easy to develop these lessons locally, and GitHub makes it easy to store these notebooks in a publicly accessible place. The IPython Notebook Viewer then makes them available in a reader-friendly format.

My basic workflow:

I created a notebook for the syllabus I’d like to follow.

For each topic in the syllabus, I create a local notebook which will hold lessons for that topic.

When I have time, I create lessons at home and push them live.

I always teach with my computer hooked up to a projector. When I clarify something during a lesson, I push the changes to GitHub as soon as the lesson is over.

If I cover a new topic in class, I write my examples directly in one of the notebooks. If the live work is clean enough, I push it straight to GitHub. If the live work needs a bit of cleanup, I commit locally and then push it live after class, when I have the chance to look it over more carefully.

If a student starts to outpace me, I can steer them into something more established such as Udacity or Coursera. These are the students who are likely to be successful in more independent learning settings.

Results so far

This workflow has been extremely satisfying so far, for me and for my students. We are having as much fun as we had the first year I taught a programming class, but we are covering things much more quickly as well. I can see a number of benefits in this workflow:

Students can have a copy of all class materials open on their own computers, and accessible outside of class.

We can add and modify exercises and challenges at will, throughout the class.

Students get to see some of the tools they will use when they become more proficient, such as git, GitHub, IPython, and others.

What’s next?

I really want to figure out a way to embed programming in my school culture throughout the year. A few thoughts about how to move forward on this goal:

Continue to develop the notebooks throughout this session. Some of this involves converting old blog posts into IPython notebooks.

Develop a core set of assignments that students can do in any class, that use their programming skills to help them in their other classes. For example, use your understanding of Python’s dictionaries to keep track of the key words you are learning in each of your classes.

Set up a system where students who reach a certain level of skill and understanding begin to teach newer students, using our class materials. This would take the pressure off of me to always teach introductory courses, and would let me teach some more advanced classes.

Clean up the notebooks, so they stand on their own rather than serving as class notes. Right now, they don’t read well for independent learning. This could be improved, although they probably shouldn’t get too wordy.

Collaboration

If you’d like to play with these notebooks, check out the project page on GitHub. I’d be happy to collaborate on building out these resources, so get in touch if you’d like to contribute. I can be reached through email, ehmatthes at gmail, or twitter @ehmatthes. If you are active on GitHub, you can also leave feedback on Issue #10.