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 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.

Author: Mikree Fegor
Country: Uzbekistan
Language: English (Spanish)
Genre: Business
Published (Last): 28 July 2005
Pages: 67
PDF File Size: 9.52 Mb
ePub File Size: 6.50 Mb
ISBN: 963-5-76716-729-7
Downloads: 32699
Price: Free* [*Free Regsitration Required]
Uploader: Gardale

Whenever I’m on a team and I get the opportunity to do code reviews, I strongly encourage it to reduce the Bus Factor.

Ask HN: Why did literate programming not catch on? | Hacker News

We believe that the literate programming approach is a valuable way to introduce ideas in computer graphics and computer science in general. It is true that the equations are the essence but without the surrounding text they are quite opaque. In WEB one deliberately writes a paper, not just comments, along with code.

In any particular file, I can see what is going on, but getting the global perspective is what is progarmming. Utilize pre-conditions and post-conditions using assertions.

Unless the program is different than LP work. Like many of my cow-orkers I’ve configured my editor to hide the tomdocs in normal use. That is a good point. Maybe to get the wiki closer to the code, you could put links to relevant wiki pages ltierate your programmibg comments.

No, you really aren’t. Webarchive progrmaming wayback links Wikipedia articles needing clarification from September CS1 errors: Myrmornis on Aug 17, It’s for other people and also yourself in the future – I have certainly come back to my own code a year later and wondered what the hell I was doing. Knuthh program is also viewed as a hypertext document, rather like the World Wide Web. The “notebook” paradigm in Mathematica is another good example; arguably it’s as much a part of the experience as the underlying Wolfram kernel.


It may be any textual information that aids the understanding of the problem. I suspect lots of people have simply never considered coding in a literate style – never knew it existed. Parts of the program that belong together logically should appear near to each literatf in the description, so that they are visible from the part of the documentation that discusses their function.

Literate programming

Since you are doing stage 1 and 2 on a computer system, you could go on, and write the code of stage 3 in that very same wiki too! I played with literate programming for a bit and I had a similar experience: Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means.

I discovered from reading some of the articles, you know, I could find three bugs in a program that was proved correct. It wasn’t an obstacle to getting it done; it forced me to do what I really always knew I should – think about the design, make sure it made sense.

Many people adopted or invented independently this style of code structuring and commenting. Tony Hoare was a great pioneer for proving the correctness of programs. Why don’t I see it elsewhere? Choices about architecture are hard to test in a unit-test sense, but are worth commenting on. And if your code repository is HTTP-accessible, you could put links to your code on your wiki pages.

Programmers often say comments are for describing algorithms — especially hairy ones, but it’s a straw man: Besides providing prohramming documentation tool, CWEB enhances the C language by providing the ability to permute pieces of the program text, so that a large system programminy be understood entirely in terms of small sections and their local interrelationships. 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.

Short of hiring people full-time to write documentation, and to ensure that all changes to the program are done in a heavyweight-enough process knutth ensure that documentation changes match the programming changes, those are your two choices.


He proposed a way of taking a complicated program and breaking it into small parts. Making programs really big by duplicating efforts, and working around workarounds, using Java seems to “work” for strange values of workso perhaps this is a blub thing?

Some groups of chunks would get commentary, discussing at a high level the design that they were meeting. EliRivers on Aug 16, Software is hard enough as it is, without adding yet another hurdle to get from brain to. Code sections improve on verbose commenting by providing the ability to write descriptive paragraphs while avoiding cluttering the source code.

The documentation portion is often a verbal description of the algorithm. Also, once you have a big code base, there may be parts of the code that are critical e. Instead, it is wrenched into the daylight and made the main focus. If the choice is testable, you can write a test case for it. Provide formal or informal proofs of source code correctness.

There certainly is revision control in MediaWiki, Confluence, and others. Yes, you are ;- The thing is, as I wrote in the other comment, that “modern” like Lisp, as someone noted ;- languages already allow you to structure the code as you see fit.

Or rather, and this is important, optimal from one perspective, e. The most obvious and natural way to do this is to suppress the program text for those inner levels, leaving an prgramming of the outer level, while the inner levels may be specified and documented elsewhere; this is a bit like introducing subroutines for the inner levels, but without the semantic implications that that would have.