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 .

Author: Kigagami Vocage
Country: Swaziland
Language: English (Spanish)
Genre: Photos
Published (Last): 8 January 2018
Pages: 71
PDF File Size: 11.15 Mb
ePub File Size: 18.2 Mb
ISBN: 517-9-11896-207-5
Downloads: 52286
Price: Free* [*Free Regsitration Required]
Uploader: Shabei

Functions are decomposed into several sections. A traditional computer program consists of a text file containing program code. This may seem like a trivial change, but in fact literate programming is quite different from other ways of structuring software systems.

Literate programming

I replied to his letter on 16 November much earlier than I remembered. If programs are written in a way that concentrates on explaining their design to human readers, then they can be considered as works of technical literature; it is for this reason that Knuth has named this style of software construction and description “literate programming”.

And the fact that there’s no need to be hung up on the question of top-down versus bottom-up, since a programmer can now view a large program as a web, to be explored in a psychologically correct order is perhaps the greatest lesson I have learned from my recent experiences. 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 many.

This book received the Productivity Award from Computer Language magazine,awarded to products that significantly increase programmer productivity. It should be an unusual but not exceptional case when a module contains no documentation.

He proposed a way of taking a complicated program and breaking it into small parts.

Knuth’s expository gem will teach future readers about programming style and data structures, whether they use the code or not. Knuth called these modules or sections. Literate programs are written to be read by other software developers.


The code section is a form of data reduction in that the section name is a placeholder representing the code contained in that section. Modules have programing parts: Instead of comments provided as side notes to source code a literate program contains the explanation of concepts on each level, with lower level concepts deferred to their appropriate progrmaming, which allows for better communication of thought.

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.

It may be any textual information that aids the understanding of the problem.

The fundamental logic of the WEB system encourages “top-down” programming and “structured” design. Choose class names, function names, and variable names wisely.

Programming on the universal canvas is one revolution that can’t possibly arrive too soon. This page was last edited on 20 Decemberat Parts of the program that belong together logically should appear near to each other in the description, so that they are visible from the part of the documentation that discusses their function.

A “closed” subroutine is one which is called into use by a special group of orders incorporated in the master routine or main program. TeX automatically handles details such as microjustification, kerning, hyphenation, ligatures, and other sophisticated operations, even when the description part of the source is simple ASCII text. Not to be confused with Natural language programming. This book is a long literate program.

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. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

If we express a program as a web of ideas, we can emphasize its structural properties in a natural and satisfying way. This should include all aids such as mathematics and graphics that enhance communication of the problem statement and the understanding of its challenge. 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.


Literate programming – Wikipedia

They resemble programs from computer science textbooks rather than listings from executable programs. Avoid duplicate code by creating shared functions. This type of subroutine is called an “open” subroutine.


The reader is forewarned to not mix up the holon kjuth with the “module” one. 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.

Literate programming: Knuth is doing it wrong

From Wikipedia, the free encyclopedia. Then, to understand the complicated whole, what you needed is just to understand the small parts, and to understand the relationship between those parts and their neighbors.

But Knuth is concerned not only with bytes and microseconds, but with a concept that has come to be known in coding circles as “elegance,” and that applies to programming at any level.

WEB adds functions which are specific to computer programs, such as boldface reserved words, italicized identifiers, substitution of true mathematical symbols, and more standard pretty-printer functions such as reformatting and indentation. 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.

Provide formal or informal proofs of source code correctness. Programminy literate programming the emphasis is reversed. Literate programming increases product quality by requiring software developers knnuth examine and explain their code. Of course, I developed TeX so that it would try to continue a history of hundreds of years of different ideas. Implement automated knugh testing which is also a form of documentation.

Again, I did this in the interests of simplicity, because I programmming that most applications of multiple parameters could in fact be reduced to the one-parameter case.