Donald Knuth: Observations About Programming and Specifications

Donald Knuth

When you’re doing programming, you have to explain something to a computer, which is dumb. When you’re writing a document for a human being to understand, the human being will look at it and nod his head and say, “Yeah, this makes sense.” But there are all kinds of ambiguities and vagueness that you don’t realize until you try to put it into a computer. Then all of a sudden, almost every five minutes as you’re writing the code, a question comes up that wasn’t addressed in the specification. “What if this combination occurs?” It just didn’t occur to the person writing the design specification. When you’re faced with doing the implementation, a person who has been delegated the job of working from a design would have to say, “Well, hmm, I don’t know what the designer meant by this.”

It’s so hard to do the design unless you’re faced with the low-level aspects of it, explaining it to a machine instead of to another person. I think it was George Forsythe who said, “People have said you don’t understand something until you’ve taught it in a class. The truth is you don’t really understand something until you’ve taught it to a computer, until you’ve been able to program it.” At this level, programming was absolutely important.

When I got to actually programming TeX, I had to also organize it so that it could handle lots of text. I had to develop a new data structure in order to be able to do the paragraph coming in text and enter it in an efficient way. I had to introduce ideas called “glue,” and “penalties,” and figure out how that glue should disappear at boundaries in certain cases and not in others. All these things would never have occurred to me unless I was writing the program.

Leave a Reply

Your email address will not be published. Required fields are marked *