Learning to Program? Programming to Learn!

Why Everyone Should Learn to Program

Matthias Hauswirth
Apr 13, 2016 · 4 min read

We are in a gold rush in computer science education. Countless school districts, states, countries, non-profits, and startups rush to offer computer science, or coding, for all. The goal (or gold?) too often is seen in empowering students to get great future-proof jobs.

A great goal, but way too limited.

A broader goal looks at computer science education as general education that helps students to become critical thinkers. Like the headmaster of my school, who recommended I study latin because it would make me a better thinker. It probably did. And so did studying computer science.

A great goal, but still too limited.

I claim there is an even greater goal for teaching computer science to each and every person on the planet. Read on!

Computer Language as a Medium

In “Computer Science: Reflections on the Field, Reflections from the Field”, Gerald Jay Sussman (MIT) writes an essay called “The Legacy of Computer Science”. There he cites from his own landmark programming textbook “Structure and Interpretation of Computer Programs” [SCIP’96]:

The computer revolution is a revolution in the way we think and in the way we express what we think. The essence of this change is the emergence of what might best be called procedural epistemology — the study of the structure of knowledge from an imperative point of view, as opposed to the more declarative point of view taken by classical mathematical subjects. Traditional mathematics provides a framework for dealing precisely with notions of “what is.” Computation provides a framework for dealing precisely with notions of “how to.”

In his “Legacy of CS” essay, he then goes on about pedagogy:

Traditionally, we try to communicate […] skills by carefully solving selected problems on a blackboard, explaining our reasoning and organization. We hope that the students can learn by emulation, from our examples. However, the process of induction of a general plan from specific examples does not work very well, so it takes many examples and much hard work on the part of the faculty and students to transfer the skills.

And… here it comes:

However, if I can assume that my students are literate in a computer programming language, then I can use programs to communicate ideas about how to solve problems: I can write programs that describe the general technique of solving a class of problems and give that program to the students to read. Such a program is precise and unambiguous — it can be executed by a dumb computer! In a nicely designed computer language a well-written program can be read by students, who will then have a precise description of the general method to guide their understanding. With a readable program and a few well-chosen examples it is much easier to learn the skills. Such intellectual skills are very hard to transfer without the medium of computer programming. Indeed, “a computer language is not just a way of getting a computer to perform operations but rather it is a novel formal medium for expressing ideas about methodology. Thus programs must be written for people to read, and only incidentally for machines to execute.” [SCIP’96]

So, “computer programming” is a kind of advanced pedagogical device!

Programming to Learn

It’s not so much about learning to program, it’s much more about programming to learn!

I came up with this phrase while writing this post. I quickly discovered that others used it long before me. Some examples:

I find that idea of “programming to learn” extremely powerful! And I realize that I and many of my colleagues have been applying that idea in our courses for a long time: we have students implement a concept as a program just so they will profoundly understand that concept.

Given that I teach concepts in computer science, the concepts I teach often are methodological and amenable to modeling and implementation in code. For example, I taught computer architecture by having students implement a simple micro-architectural simulator. Or I teach version control by having students implement a simplified simulator of Git. And who has ever taught compiler optimization without having students implement at least parts of a compiler?

I wonder where the boundaries of this “programming to learn” approach lie. Can you teach statistics this way? Biology? Economy? Psychology? Sociology? How about history, or natural languages? Carpentry? Plumbing? Or… art?

I bet the boundaries lie far beyond computer science. And I bet few non-computer-scientists actually use a “programming to learn” approach. Sometimes because they never learned to program. Other times because their students can’t program.

In order to program to learn, you first have to learn to program. So we have to teach coding, or programming, to everyone! Not because they need to become professional programmers. Not even because it improves their critical thinking skills. But simply because it opens up a new, potentially powerful way of learning. By reading and writing code.

An expanded version of this post (which, amongst other things, connects “Programming to Think” to the Trivium from the Middle Ages and includes discussions of related perspectives) is now available (open access) in the June 2016 Bulletin of EATCS.

Matthias Hauswirth

Written by

Computer Scientist & Thinker

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade