Donald Knuth. “Literate Programming ()” in Literate Programming. CSLI, , pg. I believe that the time is ripe for significantly better documentation of . 3 Oct Literate programming: Knuth is doing it wrong. Literate programming advocates this: Order your code for others to read, not for the compiler. Literate Programming is also the name of DonKnuth’s book (ISBN One speculation for the reason behind Knuth’s pushing of LP is that according to Stanford’s.
|Published (Last):||20 May 2010|
|PDF File Size:||2.89 Mb|
|ePub File Size:||4.95 Mb|
|Price:||Free* [*Free Regsitration Required]|
Matt Pharr and Greg Humphries. Listings generated by the WEB system are unlike any other form of program listings in existence. It is not an ideal book for evangelizing literate programming, however; one wishes that someone, preferably Knuth, had written a book that is not so tied to the particular combination of Pascal and TeX with its documentation designed for paper, with page numbers and indexesunfamiliar to the majority of programmers today.
But Knuth’s work brings to life the complex mathematical underpinnings of the discipline, and deals with the logistics of programming on all levels, from the conceptual design of solutions to the most intimate details of the machine. The snippets of the literate wc above show how an explanation of the program and its source code are interwoven.
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. But as time went on, I’ve become extremely pleased with the name, because I think that a complex piece of software is, indeed, best regarded as a web that has been delicately pieced together from simple materials.
Knuth’s broader ideas about documentation and structured programming are laid out in his book, “Literate Programming. Literate programming is not a documentation system per ce, it’s a programming paradigm. Chris rated it really liked it Apr 25, TeX-in-Pascal was distributed around the world byI think. The articles have been revised, extended, and brought up to date. The documentation portion is often a verbal description of the algorithm.
This misconception has led progrsmming claims that comment-extraction tools, such as the Perl Plain Old Documentation or Java Javadoc systems, are “literate programming tools”.
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. When the last order of the subroutine has been executed the machine proceeds to execute the order in the program that immediately follows. Obviously there should be a clear indication of where pieces of program have been suppressed, and which other program fragments give the detailed specifications of those pieces.
It is designed so that when its task is finished it returns control to the master routine at a point immediately following that from which it was called in.
Classic essays on improving the state of programming literature. But after gaining experience with WEB, I have come to realize that there is no need to choose once and for all between top-down and bottom-up, because a program is best thought of as a web instead of a tree.
Now, he says, take my large program and reveal it to the world, with all knuuth compromises. A Survey,pg. The program description should describe parts of the algorithm as they occur in the design process, rather than in the completed program text. Organization of source code into small sections.
Macros in a literate source file are simply title-like or explanatory phrases in a human language that describe human abstractions created while solving the programming problem, and hiding chunks of code or lower-level macros.
He said to me that I should publish my program for TeX. TeX automatically handles details such as microjustification, kerning, hyphenation, ligatures, and other sophisticated operations, even when the description part orogramming the source is simple ASCII text. He can hardly be faulted for that; the idea is from an early time, before HTML and other modern markup sophistication.
Applicability of the concept to programming on a large scale, that of commercial-grade programs, is proven by an edition of TeX code as a literate program. Journal of Statistical Software.
Literate programming: Knuth is doing it wrong
In I wrote my first structured program; it was fairly good sized-maybe, I don’t know, 50, lines of code, something like that. It is only the literate programming system that really takes the idea seriously and to its logical conclusion, by 1 freeing the programmer to write code in whatever order is appropriate for exposition, not the order that the compiler wants, and, more generally, 2 being a system for writing a document that contains the program, not for documenting a program after it has been written.
Please send suggested corrections to knuth-bug cs. A preprocessor is used to substitute arbitrary hierarchies, or rather “interconnected ‘webs’ of macros”,  to produce the compilable source code with one command “tangle”and documentation with another progrsmming.
The documentation should include an examination of alternative solutions and should suggest future maintenance problems and extensions. Happy Halma rated it liked it Jun 18, In either case please include your postal address, so that I can mail an official certificate of deposit as a token of thanks for any improvements to which you have contributed. Then when I started writing TeX in this period I began the implementation of TeX in October ofand I finished it in May 78it was consciously done with structured programming ideas.
Zarthas rated it it was ok Aug 14, Instead of writing code containing documentation, the literate programmer writes documentation containing code.