Bubbles_glow

≡ Literary Systems ≡

 
Corner_fold
  • Citation
  • Extension
  • Response
  • Comment
Hopo_catalog
 
Flowchart_grey_24

Literate Programming

If there is a godfather of code, a Don Corleone of algorithms, then it is certainly Donald Knuth. His multi-volume masterwork, The Art of Computer Programming, is widely regarded as the definitive treatment of the field. It's legendary both for its difficulty — the example problem sets range from simple homework to major unanswered research questions — and for its mathematical rigor. But this man, whom many would consider to be an engineer's engineer, has a decidedly different attitude when it comes to the art of computer programming. Since the early 1980s, Knuth has been a vocal proponent of something that he calls "Literate Programming." He writes:
"Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to a human being what we want a computer to do. The practitioner of literate programming can be regarded as an essayist, whose main concern is with the exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of the variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its contents have been introduced in an order that is best for human understanding."

"I believe that the time is ripe for significantly better documentation of programs, and that we can best achieve this by considering programs to be works of literature."
The kind of code style that they teach you in school is to write the obvious. To avoid cleverness, aim for minimal complexity, and use standard, unexotic techniques. This sort of lowest-common-denominator coding style may or may not be an efficient way to write programs in large, corporate groups, but it's most certainly bad literary style. Writing novels in the language of "See Spot Run" makes very little sense, and, as writers, we certainly wouldn't listen to the argument that it needs to be written at a 2nd-grade reading level so that everyone can (potentially) read it. Knuth understands this, and so his call for a Literate Programming is not a call for pedagogy, but a call for literature. The complexity at the heart of interesting programs can never be vanquished, just pushed around, spread out, or polished up and presented, jewel-like. These baroque complications call for sophisticated, multi-level, clear communication, bearing the reader along a well-defined trajectory of thoughts, leading to the inevitable ending. Execution.