Computer programming is the new literacy
By Robert St. Amant
It’s widely held that computer programming is the new literacy. (Disagreement can be found, even among computing professionals, but it’s not nearly as common.) It’s an effective analogy. We all agree that everyone should be literate, and we might see a natural association between writing letters for people to read and writing programs for computers to carry out. We also find a historical parallel to the pre-Gutenberg days, when written communication was the purview mainly of the aristocracy and professional scribes. Computation is an enormously valuable resource, and we’re only beginning to explore the implications of its being inexpensively and almost universally available.
But is programming-as-literacy an appropriate analogy? We tend to think that basic literacy is achieved by someone who can say, “Yes, I can read and write.” Let’s see what this means in the context of programming.
Historically, programming has been a matter of writing down instructions for a computer to follow, a style now called imperative programming. This is trickier than giving instructions to a human being, though. You’re a human being, which means you know what others are capable of doing and what they will understand. For example, if you were writing down instructions as part of a recipe, you might say, “Place two cups of frozen peas in the microwave for six minutes.” You don’t bother to add that the microwave should be on for those six minutes, that the peas should be in a container, or that “cups” means the English measuring units rather than, say, two coffee mugs. The capabilities of a computer are less obvious, though, which makes instructions harder to write. Worse, they don’t “understand” anything at all, at least in the same sense that people do. In 1998, for example, the Mars Climate Orbiter was lost, because one programming team used English units, and another team used metric units. A reasonable person given a set of instructions for maneuvering through space might wonder, “Are we all clear on what we’re talking about?” A computer would need to be given instructions to do the same.
Other approaches to programming have emerged over the years, and they involve something different from writing instructions. In some environments programming has the flavor of creating a rulebook, as you might do for a new board game. Your rules aren’t directly concerned with the details of specific games: “If Jane rolls a four with her dice and moves her piece to a red square, then…” Instead, your rules govern the flow of a game — any game — at a more abstract level. “If a player lands on a red square, then…” You develop comparable rules when you write a spreadsheet macro. Your macro (a tiny program in itself) isn’t concerned with specific numbers, but more generally with the mathematical relationships between cells that contain those numbers. “The number in this cell is the sum of the numbers in these other cells.” Ideally, your program will work on cells that contain any numbers at all; it depends on the structure of a given spreadsheet rather than its specific contents. Thinking about how to express these rules, or constraints, is part of constraint-based programming.
Yet other kinds of programming are like writing out appropriate responses for workers in a customer service department. Such-and-such a request from a customer should be handled with this procedure; business rules behind the scenes govern what’s possible and what’s not. Programming a graphical user interface means thinking along similar lines. The application waits for a button press or a menu selection, runs the relevant procedure, and then responds. This is event-driven programming, in which each event triggers its own small program to do the right thing.
Does all this sound like literacy? I’d argue yes, that these are no less forms of literacy than being able to write a business plan, a compelling legal brief, or perhaps an evocative concrete poem. In these more familiar examples of writing, literate people are expressing themselves with knowledge of a set of underlying concepts, conventions, and goals. But we wouldn’t expect hundreds of thousands of people in any given year to try to become businesspeople, lawyers, or poets in their spare time. What makes programming special?
This special property of digital computers, that they can mimic any discrete state machine, is described by saying that they are universal machines. The existence of machines with this property has the important consequence that, considerations of speed apart, it is unnecessary to design various new machines to do various computing processes. They can all be done with one digital computer, suitably programmed for each case. It will be seen that as a consequence of this all digital computers are in a sense equivalent.
It seems obvious that our everyday world can’t be shoehorned into a perspective that’s all about business or legal briefs or even poetry. But a computational perspective? The universality of computers makes the idea more promising. Konrad Zuse, a German computing pioneer, speculated in 1967 that all of physical existence might be interpreted in terms of computation, and this possibility has seen growing attention in the years since. Even if we can’t reprogram the basic principles of the universe, it’s a fascinating thought that the principles might be computational. That seems worth understanding, and learning how to program is one way to start.
If this isn’t compelling enough, we can be more practical. A few years ago, for example, I was curious whether the Democratic and Republican candidates for President used different words in their debate. I could have spent a few minutes looking for a text analysis application online and figuring how to use it, but instead I spent the time writing a small program of my own that counted unique words, ignoring the non-meaningful ones, and compared the results. This was easy, partly because I know how to program, but probably more because I’ve learned a useful set of concepts, strategies, and skills for solving computational problems. A side benefit of learning to program. The results my program generated were nothing unexpected, but after I was finished I felt a small, familiar sense of accomplishment. I’d built something new, by myself, rather than depending on what others had given me.
Literacy, even programming literacy, can be its own reward.
Robert St. Amant is an Associate Professor of Computer Science at North Carolina State University, and is the author of Computing for Ordinary Mortals, out this December from Oxford University Press.
Image credit: Lines of computer code in different languages with circuit board on the background. Image by tyndyra, iStockphoto.