The language-independent noweb system provides only the bare bones of formatting and cross-referencing, whereas CWEB and Rambutan have syntax-sensitive pretty-printing, hyperlinked cross-references, and other goodies.
Literate Programming by Donald Ervin Knuth
This works like patch but cooperates better with tangle and weave. Literate programming is NOT an elaborate system for writing comments. In fact, writing literate programs tends to reduce the volume of comments needed. Nor is it a way of splitting programs into subroutines. The sections in a literate program are typically smaller than subroutines and more deeply nested. Also, they don't need to follow the syntax and scoping rules of the programming language.
Which may sound strange, but is actually a very useful freedom, because humans and compilers differ in how they like their information organized. Literate programming is not a kind of folding editor either. Folding editors imply a top-down structure, but not all literate programs have a top-down structure. Some do, but most are a mixture of top-down and bottom-up. Finally, literate programming is not a form of Javadoc. Javadoc is about documenting programming interfaces, literate programming is about the internal workings of programs.
For examples to emulate, see Knuth's programs to read, which includes a literate version of Colossal Cave Adventure if you can imagine such a thing. Home Literate programming is all about explaining how computer programs work at the same time as actually getting them to work. There are three keys ideas in literate programming.
- Infections in Hematology.
- Elephant and Ivory Trade in Myanmar!
- Imagining the Elephant: A Biography of Allan MacLeod Cormack;
- CAS-CERN Accelerator School - Advanced Accelerator Physics (VOL 1).
- Literate Programming with Org-mode?
The first idea is summarized by slightly paraphrasing the opening of the book TeX the Program: A literate program is an ordinary computer program that has been cut up and rearranged to make it easier for a human to understand. Error rating book. Refresh and try again. Open Preview See a Problem? Details if other :. Thanks for telling us about the problem.
Return to Book Page. Literate Programming by Donald Ervin Knuth. This volume is first in a series of Knuth's collected works. Get A Copy. Paperback , pages. More Details Original Title. Other Editions 1.
Friend Reviews. To see what your friends thought of this book, please sign up. To ask other readers questions about Literate Programming , please sign up. Lists with This Book. Community Reviews. Showing Rating details. Sort order. Aug 20, Josh Berry rated it it was amazing. For the most part, I will assume that folks picking up this book are already predisposed to like the ideas.
- Knuth: Literate Programming.
- Superpower Rivalry and Conflict: The Long Shadow of the Cold War on the Twenty-First Century.
- Breakdown of Will?
- Lies Young Women Believe Companion Guide: And the Truth That Sets Them Free?
- Great Books: My Adventures with Homer, Rousseau, Woolf, and Other Indestructible Writers of the Western World?
I will say that it provides a very nice historical context into how software creation has progressed. In particular, the essay on "goto" statements was a lot more fun than would have been expected.
The retrospective is fascinating to get an idea of just how Knuth approaches For the most part, I will assume that folks picking up this book are already predisposed to like the ideas. The retrospective is fascinating to get an idea of just how Knuth approaches software construction. I have since bought the TeXbook and related material to see any insights that gives. It would be a delight to see how he sketched the high level design of the system.
Rather, the point is that this style can more easily motivate others including your future self to read an implementation, such that they can more easily find the bugs. This is an argument that is very appealing to me. Especially in what I perceive as the current environment where the popular currents feel that they are trying to remove all "considered harmful" practices such that they can not be used even for valid uses.
I look forward to at least trying these techniques on more of my side projects, while keeping the dream of using it on a large one. Oct 28, Peter Aronson rated it liked it. Three-and-a-half stars? I'm not entirely sure what to think about this book. But the central thesis of the book, literate programming, just did not work for me, at least not in the examples provided. Frankly I did not find Knuth's literate programs either fun to read, or more easily understood than well designed code with well chosen variable and f Three-and-a-half stars?
Frankly I did not find Knuth's literate programs either fun to read, or more easily understood than well designed code with well chosen variable and function names would have been and far too many of Knuth's variable names are obscure. The reordering of code didn't really do anything for me, nor did I find the use of special symbols to enhance a program's readability. But it works for some people -- the approach still has its adherents, and I certainly feel more in sympathy with them than with the "comments as an antipattern" crowd. Aug 02, Dave rated it it was amazing.
Classic essays on improving the state of programming literature. Mar 21, Saharvetes rated it really liked it Recommends it for: all programmers. Shelves: maths-cs. This is a collection of material by Knuth about the philosophy and practice of Literate Programming , his idea of programs as literature. All programmers today claim to understand the importance of readable code, and slogans like "Programs must be written for people to read, and only incidentally for machines to execute" are occasionally heard from several quarters; however, with most programmers, such noble intentions seem to stop at the intention of writing a lot of comments to document the This is a collection of material by Knuth about the philosophy and practice of Literate Programming , his idea of programs as literature.
Literate Programming and Eve
All programmers today claim to understand the importance of readable code, and slogans like "Programs must be written for people to read, and only incidentally for machines to execute" are occasionally heard from several quarters; however, with most programmers, such noble intentions seem to stop at the intention of writing a lot of comments to document their code. 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.
The first feature means that literate programming can be useful even if you don't write a single line of comments. This book, like the books in Knuth's "Selected Papers in…" series, is a collection of disparate papers and articles written over many decades, each of which has some some connection in the author's mind at least to literate programming.
The first three chapters are Computer Programming as an Art , Knuth's Turing Award lecture , Structured Programming with go to Statements , a very long paper discussing several topics that were being debated at the time as part of the Structured Programming revolution , and a short A Structured Program to Generate All Topological Sorting Arrangements , written with Jayme L.
These were all written before the idea of "literate programming" had been conceived, but they give insights into Knuth's philosophy of programming. Chapters 4 to 7 are the real meat of the book, or at least what a reader may expect from the title: Chapter 4 is Literate Programming , the original article that introduced Literate Programming; Chapter 5 is Programming Pearls: Sampling by Jon Bentley, in which Bentley introduced Literate Programming to the readers of the Communications of the ACM through his column; and Chapter 6 is Programming Pearls, Continued: Common Words , the follow-up column in which Knuth wrote a literate program as asked, accompanied by a review by Doug McIlroy.
Literature deserves literary criticism, and McIlroy sets a wonderful example I wish program reviews had become a regular feature.
Chapter 9 has excerpts from Mathematical Writing , another wonderful book that came out of a course on mathematical writing at Stanford taught by Knuth. It consists of informal class discussions on programming style and examining real literate programs written by other students, written by a student, Paul Roberts.
He attributes TeX's being bug-free besides opinions held by some that TeX itself is a bug to literate programming, and this analysis was possible because he kept a detailed log, which is reproduced as Chapter The Error Log of TEX — They write a drop-in replacement to Unix's wc program which counts words, lines or characters. All in all, it's a good book, especially for those who find almost everything written by Knuth deeply enjoyable. Even in sections of the book that are unrelated to literate programming per se, Knuth's example programs contain clever algorithms and data structures that can be instructive.