The problem with "beginner's mind"

I should say up front that I know nothing about authentic Zen Buddhism. But one of the concepts that has made it into popular culture that I rather like is "beginner's mind": an expert knows what she thinks about things, while a beginner sees everything anew and judges it on what it is. It sounds kind of charming, and like a recipe for creativity. But applying it too literally can get you in trouble.

Concretely, ASTRON (where I work) arranged for a company to come in and teach programming courses to anyone who wanted them. They taught three: Introductory Python, Numeric Python, and Advanced Python. Now, I think that's a brilliant idea: we astronomers all spend most of our time writing code at one level or another, and nobody seems to have bothered to teach us how to do it well. So that ASTRON (actually NWO I think) cares is a really good sign. So of course I wanted to participate. I have lots to learn about writing good programs. I don't think I'm an expert programmer, or even a Python expert, but that latter is partly because I try not to think of myself as an expert in anything. I knew the Introductory Python course would not be productive — I write python code every day. And the Numerical Python, again, was a good idea, but having written, for example, the reshape function in numpy, and the spatial module in scipy, I figured that was probably not going to be too productive either. But the Advanced Python course sounded promising. And I wanted to show my support for the whole idea. So I signed up.

Well, the course was the last three days, and it was a pretty good course, but not at all what I needed. Which should not have been much of a surprise: when I stopped to do the math, I realize that I wrote my first python program eighteen years ago. (Good God.) Still, it was interesting to see how they ran the course, and to think about how I would run one (because if I end up somewhere like McGill that has basically nothing for physics grad students, I will run one, official or not).

The basic structure of the course was as a list of marginally-related topics in python that one might not have encountered. Things like database access, logging, and debuggers. In fact, talking to people who took the first course, I get the distinct impression that they took Software Carpentry and reorganized it, missing the point of what that course was for in the process: each segment was an introduction to how to use the particular part of the python standard library (or in one or two cases, external module) under discussion.

I did like the format in one way: there would be an hour or so of talking about a feature, then there would be an assignment. Some of the assignments were trivial, but others were kind of fun or substantial, like for example building a multithreaded network server. Since there were only ten of us students at a time, the teacher was able to circulate and help people out with problems. There were also few enough of us that we could ask each other for help. All this is straight from the literature on evidence-based teaching techniques, and it really did work.

Unfortunately for me, almost all the topics were things I already had experience with. One or two (pip/virtualenv and logging) I had recently gone out and taught myself about, but others I have known about for years (I used the the MySQL module when I was dealing with drift scan candidates, for example).

The section that was closest to what I was looking for — of course I don't claim to be the intended audience! — was the section on testing and coding style checkers. We didn't spend much time on it, particularly as it was at the end of the three long days, but it was good stuff and I would have liked to see more of it. But I know time was limited. What I would actually have liked more would have been to move it to the beginning of the course. Even without spending more time on it, putting it at the beginning would have then let us use these techniques in all the exercises throughout the course. Since I think these are maybe the most important things taught in the course, practicing them regularly would have taught just the right lesson. Of course their sample exercises would have to have been modified to have good coding style and test suites, but really, shouldn't example code be code that can serve as an example to follow?

1 comment:

Roland Smith said...

Thanks for writing numpy.reshape! Numpy has been very useful for me since I dove into Python after a long and diverse history with programming languages. And reshape is _very_ handy.

It sounds like you should have been the one to give the python course? It helps if the teacher has a similar background to the pupils. So you can skip some of the computer science stuff you tend to find in books and concentrate on the useful bits for say astronomers.