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 .
|Country:||United Arab Emirates|
|Published (Last):||13 February 2009|
|PDF File Size:||10.51 Mb|
|ePub File Size:||5.35 Mb|
|Price:||Free* [*Free Regsitration Required]|
This does not exclude the possibility that the source is written as a plain text file, but then it should undergo some form of processing to produce the actual program description. 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.
In other words, the name of one macro can usefully be a parameter to another macro.
By combining the two, we can develop a style of programming 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. High quality documentation facilitates program modification with fewer conceptual errors and resultant defects. If Microsoft had made source files XML, tens of thousands of programmers would already be putting pictures and hyperlinks in their code.
Many programming environments are completely controlled by specific vendors, who may well choose to switch from flat text to rich markup for their own reasons. Re-think or refactor code which is difficult to understand. Quoting from Kernighan and Plauger, ‘Top-down design and successive refinement attack a programming task by specifying it in the most general terms, then expanding these into more and more specific and detailed actions, until the whole program is complete.
I had a discussion with him in approximately ; I’m trying to remember the exact time, maybeyes,perhaps when I visited Newcastle? Second, the language provides a mechanism for presenting program code to the reader in an entirely different order than it is supplied to the compiler. Anything that is logically part of liferate section should be moved into it, thereby reducing the complexity of the code where it is referenced.
The presentation is engaging and clear.
Programking least one of these three parts must be non-null. The CWEAVE program is so named because it takes a given web and intertwines the TeX and C portions contained in each section, then it knits the whole fabric into a structured document.
This description both stands for the fragment that is being specified elsewhere, and also serves as a comment describing the function of that fragment at a level of detail that is appropriate for understanding the part of the program containing it.
But Knuth’s work brings to life the complex mathematical underpinnings of the discipline, and deals prograjming the logistics of programming on all levels, from the conceptual design of solutions literatr the most intimate details of the machine.
In literate programming the emphasis is reversed. At best, a professor might publish very small routines as examples of how to write a program. Well, this was frightening. The holon integrates with other holons in the hierarchy according to a flexible strategy. So I was pgogramming with the idea that I would actually be expected to show someone my program.
Knuth: Literate Programming
The meta-language capabilities of literate programming are also claimed to facilitate thinking, giving a higher “bird’s eye view” of the code and increasing the number of concepts the mind can successfully retain and process. This type of subroutine is called an “open” subroutine. As I was writing TeX I was using for the second time in my life ideas called “structured programming”, which were revolutionizing the way computer programming was done in the middle 70s.
If we express a program as a web of ideas, we can emphasize its structural properties in a natural and satisfying way. It is the difference between performing and exposing a magic trick.
Long procedures are restructuring by folding portions of the code into sections.
From Wikipedia, the free encyclopedia. A hierarchical structure is present, but the most important thing about a program is its structural relationships. This may seem like a trivial change, but in fact literate programming is quite different from other ways of structuring software progeamming.
The articles have been revised, extended, and brought up to date. Matt Pharr and Greg Humphries. 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. 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.
Besides providing a documentation tool, CWEB enhances the C language by providing the ability to permute pieces of the program text, so that a large system can be understood entirely in terms of small sections and their local interrelationships.
There had to be compromises. And we could polish those until But sigh it probably isn’t.
Literate programming increases product quality by requiring software developers to examine and explain their code. Code sections improve on verbose commenting by providing the ability to write descriptive paragraphs while avoiding cluttering the source code. Literacy in programming means different things in different circumstances. The typesetting language enables all of the comprehension aids available in books such as pictures, diagrams, figures, tables, formatted equations, bibliographic references, table of contents, and index.
The first published literate programming environment was WEBintroduced by Donald Knuth in for his TeX typesetting system; it uses Pascal as its underlying programming language and TeX for typesetting of the documentation. Instead of writing code containing documentation, the literate programmer writes documentation containing code.
Hanson demonstrates that “literate programming” is a viable approach to creating works of craft as well as works of art. Production of a book quality program listing.