Donald Knuth. “Literate Programming ()” in Literate Programming. CSLI, , pg. I believe that the time is ripe for significantly better documentation of . Literate programming: Knuth is doing it wrong. Literate programming advocates this: Order your code for others to read, not for the compiler. Literate. What is Literate programming? Literate programming is a style of programming invented by Donald Knuth, where the main idea is that a program’s .
|Published (Last):||10 May 2008|
|PDF File Size:||16.47 Mb|
|ePub File Size:||5.2 Mb|
|Price:||Free* [*Free Regsitration Required]|
Liherate was teaching classes and I was aware that people were using structured programming, but I hadn’t written a large computer program since The subroutine itself may be placed anywhere in the store. Listings generated in PDF format include hypertext links. A “closed” subroutine is one which is called into use by a special group of orders incorporated in the master routine or main program.
The typographic processing of literate programs produces code listings with elegantly formatted documentation and source code. Execute static analysis for common coding errors.
The fundamental logic of the WEB system encourages “top-down” programming and “structured” design. The system should be presented in an order based upon logical considerations rather than syntactic constraints. That’s another story I can tell you about sometime. Of course, other computer scientists have made contributions to the field that are every bit as substantial most notably Edsger Dijkstra, Charles Hoare and Niklaus Wirth.
Structured design is the process of controlling the overall design of a system or program so the pieces fit together neatly, yet remain mnuth decoupled that they may be independently modified.
This means that it should be possible to rearrange program text with respect to the order in which it will be presented to the computer, for otherwise the parts that deal with the actions at the outer level of a subroutine will be pushed apart by the pieces specifying the details of inner levels. Literate programs are written to be read by other software developers. Indeed we believe that deep understanding of a small number of algorithms in this manner provides a stronger base for further study of computer graphics than does a superficial understanding of knuuth.
Now, he says, take my large program and reveal it to the world, with all its compromises. This approach was implemented at Stanford University as a part of research on algorithms and digital progrxmming. The documentation should include a description of the problem and its solution. The following snippet of the wc literate program  shows how arbitrary descriptive phrases in a natural language are used in a literate program to create macros, which act as new “operators” in the literate programming language, and hide chunks of code or other ,nuth.
The whole concept of code sections, indeed structured programming, is to reduce the amount of text that must be read in order to determine what a piece of code is doing. By combining the two, we can develop a style of progtamming that maximizes our ability to perceive the structure of a complex piece of software, and at the same time the documented programs can be mechanically translated into a working software system that matches the documentation.
Knuth’s broader ideas about documentation and structured programming are laid out in his book, “Literate Programming. All quotes you tore out speak of literate programming program,ing if it’s just a documentation system. WEB utilizes the TeX document compiler, which includes a typesetting command language capable of tremendous litrate over document appearance. The key features of literate programming are the organization of source code into small sections and the production of a book quality program listing.
Besides demonstrating the techniques of clear, efficient coding, Knuth has sought to bring a deeper sense of aesthetics to the discipline. The presentation is engaging and clear. The simplest form of subroutine consists of a sequence of orders which can be incorporated as it stands into a program. My original idea was that WEB would be merely a tool for documentation, but I actually found that my WEB programs were better than the programs I had been writing in other languages.
This page was last edited on 20 Decemberat Literate programming is useful for programs of all sizes. He sent me a report, which was pages long, about his system-it was inspired by “The Ghost in the Machine”.
Keep it simple and straight forward as much as possible. KnuthLiterate Programming . Hanson demonstrates that “literate programming” is a viable approach to creating works of craft as well as works of art.
This differs from traditional documentation, in which a programmer is presented with source code that follows a compiler-imposed order, and must decipher the thought process behind the program from the code and its associated comments. Program comprehension is a key activity during corrective and perfective maintenance.
Literate programming: Knuth is doing it wrong
The documentation parts of the program description should allow for the same freedom of expression that one would have in an ordinary technical paper. This should include all aids such as mathematics and graphics that enhance communication of the problem statement and the understanding of its challenge.
Knuth also claims that literate programming provides a first-rate documentation system, which is not an add-on, but is grown naturally in the process of exposition of one’s thoughts during a program’s creation. The present chunkwhich does the countingwas actually one of the simplest to literatee. The reader is forewarned to not mix up the holon concept with the “module” one.
Literate pgogramming Computer-related introductions in The literate programming metalanguage provides two important features. The high-level language code and the system documentation of the program come from the same set of source files. We believe that the literate programming approach is a valuable way to introduce ideas in computer graphics and computer science in general. This is illustrated by the following snippet of the wc literate program.