Talk:Literate programming

Wiki Education Foundation-supported course assignment
This article is or was the subject of a Wiki Education Foundation-supported course assignment. Further details are available on the course page. Student editor(s): User:Pranavnawathe.

Above undated message substituted from Template:Dashboard.wikiedu.org assignment by PrimeBOT (talk) 02:43, 17 January 2022 (UTC)

Remove syntax highlighting?
As noticed by 206.47.249.252, the source code listed is not quite C, as promised to the syntax highlighter. It's unlikely the highlighter will ever support something like lang="noweb#c", so it may be best to just use "&lt;pre>" or custom formatting instead. But the former looks plain and the latter is labor intensive... — Preceding unsigned comment added by Daggerbox (talk • contribs) 02:20, 7 January 2011 (UTC)

Who uses literate programming?
The article would be improved if it contained a list of software programs that have been written in a literate programming style. From what I gather, this is still a small number, so a list would not be out of place. I know of TeX (which was even published as a book TeX: The Program) and METAFONT by Knuth, and I've heard about Axiom, but are there any ("big") programs or software projects written in literate programming? 59.92.198.129 (talk) 07:32, 22 March 2011 (UTC)
 * Good question. I glanced at the official discussion group for Literate Programming, which is now a Google Group. These discussions might be useful to read, in order to gain further insight regarding your question, and corresponding inclusion in the article, What is the future of literate programming? (July 2011) and Is Literate Programming useful? (March 2011). Note that comp.programming.literate has been active through October 2012. --FeralOink (talk) 15:14, 1 January 2013 (UTC)

I. Actually, if we include Notebook interfaces, which wikipedia also classifies as LP tools, LP is used a lot- right from the deployment of Mathematica notebooks on the Apple II.

II. It has not been clearly stated, but Tim Daly's "Axiom" does not just provide LP tools, but is a massive CAS, created completely with LP.

III. "Physically Based Rendering"- the great literate program which was used to create slick CGI software, with the documentation published as a textbook, is a great example- and it's use by Pixar earned its makers an Academy Award.

IV. More examples in the lecture by DEK: https://channel9.msdn.com/Events/useR-international-R-User-conference/useR2016/Literate-Programming

-PSG1997 — Preceding unsigned comment added by PSG1997 (talk • contribs) 19:40, 7 December 2018 (UTC)
 * Yes, many "notebooks" implement literate programming in Mathematica, Python, etc. But I have not seen the credit to Don Knuth, they just present it as a feature inducing to people to think it is their invention by not calling it literate programming with the respective credit. — Preceding unsigned comment added by 2806:106E:B:C6E9:BC25:52AF:2868:251 (talk) 12:55, 28 November 2021 (UTC)
 * That's unlikely to be relevant. General CS paradigms do not require, at every instance, citations to the authors who first devised and published the ideas. What would actually matter is whether any independent reliable sources identify Notebook interfaces (individually or as a class) or any other implementations as examples of LP.  As WP editors, we are not (per WP:NOR policy) in a position to opinionatedly declare various things to be or not be LP based on our own sensibilities.  — SMcCandlish ☏ ¢ 😼  20:42, 22 June 2024 (UTC)

Literate programming practices
Literate programming is almost a standard approach in scientific computing decades and now in data science too. --mcyp (talk) 02:09, 30 May 2020 (UTC)

Removed tagging.
Nothing here to make clear what action to take in nearly a year so removed. Please replace if you can give specfics. 72.228.189.184 (talk) 15:21, 6 May 2012 (UTC)

EHC/UHC and Web68 update
I updated external references but tried to include external links in my revision comment. Guess what: It didn't work!

This is what my edit was: I revised URLs due to the transition of EHC content to UHC per the UHC Wiki Project News, (Sept 2010). I also removed red link/ non-existent wikilinks. Also, I updated and cited properly, the Web68 reference. --FeralOink (talk) 14:41, 1 January 2013 (UTC)

Project Jupyter needs adding
Project Jupyter should probably be added to the list of examples.


 * IPython
 * https://speakerdeck.com/fperez/project-jupyter

Best wishes. RobbieIanMorrison (talk) 22:50, 21 November 2016 (UTC)


 * this is added long time ago along with R. --mcyp (talk) 02:09, 30 May 2020 (UTC)

What horrible thing
This section is initiated by someone suspected of vandalism. --mcyp (talk) 02:09, 30 May 2020 (UTC)

The article is totally missing any discussion of the failings and shortfalls of WEB or even Literate Programming as concept. Instead it reads as The Gospel according to Saint Knuth. The fact that even proponents of this abortive concept struggle to find examples of relevant software written in it (other than by Knuth himself) should alert to the many reasons that make it next to useless for any proper software project outside of the software lab of Knuth & His Acolytes. Allow me to mention a few: Substituting 'natural language' for properly defined programming languages can only lead to increased ambiguity, not less; proficient programmers should have no difficulty conveying (and understanding) meaning through properly written code in a well-known programming language; this is especially true for the most complex parts of algorithms (ie, where it matters most), and even the WEB examples provided for Unix's 'wc' program (a relatively simple application) amount to a load of comments around blocks of traditional code that carry out the actual work; ie, it increases verbosity ungainfully.

I should probably work these objections into the article myself, but i can't be bothered. If this Literate Programming nonsense mattered to anyone other than Knuth's uncritical followers, the article would already have plenty mention of these issues, and others. (By the way, this Knuth fellow is the guy who, not so long ago, lambasted the hell out of microprocessor designers for 'persisting' in making multicore architectures, claiming that it is incumbent upon them to build fast single-threaded processors instead of trying to 'force' programmers to learn parallel programming. WTF?) — Preceding unsigned comment added by 79.168.138.50 (talk) 20:52, 12 January 2017 (UTC)
 * You seem to have strong opinions on the topic (and many others).
 * To add anything to this article (or any others), you will need reliable sources. - Sum mer PhD v2.0 03:20, 13 January 2017 (UTC)
 * From your offensive language about Knuth, on can infer that you certainly know nothing about computer science, and are a total ignorant about Knuth's seminal work.
 * You have no idea of what a robust program is, nor what a good style is.
 * Do not confuse a simple example, not a good one, with the literate style, it is essential to write real maintainable software. — Preceding unsigned comment added by 189.233.107.221 (talk) 22:19, 28 March 2017 (UTC)
 * This is unacceptable attitude for a scientific computing article and personal attack to Knuth, what do you mean by "Saint Knuth"? You are mocking one of the prolific scientist in our century in something he pioneered and now used in scientific computing almost as a standard tooling. Please do refrain on edit or comment on this article further, you are not objective or working in this field. I can tell by experience of 2+ decades in scientific computing. Your comment is derreogotary at best and probably constitutes as vandalism. mcyp (talk) 02:09, 30 May 2020 (UTC)

While I agree that LP has serious flaws, your comments seem to indicate that you have entirely missed the point. It is in mo way a 'natural language programming' attempt, and the fact that you seem to think it is shows that you haven't read the explanation carefully.

The goal with LP is code documentation (as differentiated from either code comments or the code itself), a practice that is generally ignored in the industry at large. While the typical LP system such as noweb involves the writing of the code and documentation together, the intent is not that they be read together; rather, the LP document is processed into separate source code ('tangling') and prose documentation ('weaving') files. The crux of the idea is to ensure that the documentation remains in sync with the source code. The intention - flawed though it is - is to have a document the programmer can read before looking into the code proper.

The problem, of course, is that hardly any real-world programs have any code documentation at all, for reasons completely unrelated to the technical merits or flaws in the idea. The real reason LP fails is because managers don't care about code documentation (or code maintenance in general), and trying to write any would be career suicide for a working programmer. This is the sad, idiotic reality of the IT industry, and is unlikely to change any time soon.

I do think the idea has more merit than it is usually credited, but I do not consider the approach as given by Knuth to be adequate - what it really calls for is a hypertextual approach, and one not tied to using inline markup as seen in HTML, at that. However, even that won't ever get most programmers to adopt it, because it runs counter to the running-in-place nature of the industry at large. It is yet another sign of how programming as a field is Lewis Carroll's Red Queen - it runs at full speed without advancing, always moving but going nowhere new despite the appearance of change. All the advancements of the past four decades have been down to hardware - the software, while radically different than in the past, is not actually innovative. The last truly new things in the field were the LZ compression algorithms and the Bricklin spreadsheet model - both of which date to 1977. The rest is just rehashing things that were too hardware-intensive to be practical before. Schol-R-LEA (talk) 18:48, 17 March 2018 (UTC)
 * An Spanish refrain says "si la envidia ffuera tiña ..." ("if envy were ringworm ...")
 * Insults for the kind Don Knuh? This guy needs a visit to psychology. I don't understand Wipedia guardians which had erased comments when digging a subject in more detail on one side and keep insults as in this comment.
 * Removing all the hate in the comment, (s)he has no idea about Knut's work, which never attacked parallel programming, he said that parallel optimization of sequential code could not be done automatically, that is something that a programmer do, so (s)he is also defaming the professor.
 * (S)he confuse literate programming with the "self documenting" verbosity of COBOL. — Preceding unsigned comment added by 2806:106E:B:C6E9:BC25:52AF:2868:251 (talk) 12:40, 28 November 2021 (UTC)

Haskell was designed to write literate programs
Haskell is a very formal language, it supports algebraic data types and is a purely declarative language. A programmer use algebraic laws to transform code into a more efficient equivalent one. For that reason I rewrote that point. — Preceding unsigned comment added by 189.233.107.221 (talk) 22:23, 28 March 2017 (UTC)
 * Not exactly, Haskell is a declarative language which can be seen as an executable specification language.
 * Haskell was designed to use the literate programming style, either with the Bird's style or within a LaTeX code environment.
 * Due to the purely declarative nature of Haskell, all definitions in the script may be written in any order. That is an advantage for literate programming because there is no need to sort the code before compilation. That is a property of purely declarative languages, not an explicit design for literate programming. That is not casual, both pursue clarity of though.

I am not sure that you have actually understood the idea or intent of LP. The key idea is not to try to write 'self-documenting' code, but to write the prose documentation for the code (which is a separate concept from both code comments and code clarity - and one almost always ignored in practice) together with the code itself, with the tangle and weave tools then separating them for alternate presentations. The goal is to ensure that the code documentation - which, as I already said, is not widely practiced in the first place - is updated at the same time as the code. The source code itself is automatically extracted from the LP document once it is written - the LP document is not itself source code.

While the idea is sound when approached in a vacuum, in practice it has serious problems, primarily in that, like Test-Driven Development, in it's classic form it is really only suited for example programs - projects which have a clear goal at the outset, where the design does not change during the initial coding process and is never updated afterwards. While the intent was to ensure that the code documentation is synchronized to the source code itself, the assumption that documentation is going to be written at all entirely ignores meat-grinder the reality of commercial code development - if a programmer were to take the sort of time to meticulously document their code in this manner, they would be dismissed out of hand as being unable to keep their schedule.
 * until here I agree. But I disagree in part with the following part because literate programming, although induces a good methodology, it does not claim to be a programming methodology per se.

This is unfortunate, but the primary forces at work are economic ones, not technical ones - good engineering practices in software development are the exception rather than the rule, because the people responsible for deciding the 'best practices' are not themselves software developers, and usually hold programmers in contempt as mere factory laborers. The entire point of things like Agile Development (before they too got corrupted) was to find a way to cope with this reality.
 * I ignore Agile Development, but I recommend to run away of such working environments for mental heath. In my point of view it is worse to be forced by an ignorant boss to do my work in a way that I don't like knowing that the imposed way is wrong an inefficient, that do a different work, maybe less creative but in a better environment.

However, the fact that the idea is so poorly understood has made those problems irrelevant - it gets ignored because no one except academics have bother to look at it in the first place. It could well have merit if a way to adjust it to fit the reality were found (unlikely as that is), but the truth is that no one cares enough to try. Schol-R-LEA (talk) 17:18, 17 March 2018 (UTC)

External links modified
Hello fellow Wikipedians,

I have just modified one external link on Literate programming. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
 * Added archive https://web.archive.org/web/20080820091137/http://sunburn.stanford.edu/~knuth/programs.html to http://sunburn.stanford.edu/~knuth/programs.html

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

Cheers.— InternetArchiveBot  (Report bug) 16:28, 3 January 2018 (UTC)

A comment on the "Critique" section
Just an amplification or clarification of what the existing section says.

Disclaimer: I am neither a Wikipedia editor nor a professional programmer. But this section triggered my memory of reading the McIlroy article many years ago.

McIlroy's wonderful metaphor "industrial-strength Fabergé egg" is a critique of the algorithm Knuth chose for his example, and not at all a critique of Literate Programming (which McIlroy praises). He criticizes the use of a complex algorithm for a problem which has a much simpler solution. And he criticizes the unnecessary use of a complex data structure, but he praises the data structure itself. (He does also criticize some small details of the actual presentation of the algorithm in the Literate Programming example, but not the use of Literate Programming.)

Dudley Brooks (talk) 18:51, 12 December 2019 (UTC)

"Latex" section
Given the context, I'd expect the title of the "Latex" section to make slightly more sense as "LaTeX", but I'm still not sure it's supposed to have anything to do with this TeX format. Can anyone shed some light on the matter? Splibubay (talk) 21:06, 8 July 2020 (UTC)

Literate programming is a style NOT a paradigm
Where says:
 * Literate programming is a programming paradigm introduced by Donald Knuth in which a computer program is given an explanation of its logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which compilable source code can be generated.

Should say:


 * Literate programming is a programming style introduced by Donald Knuth in which a computer program has code embedded with in a text explanation about the problem solving and design decisions that were taken into account in the writing of code. Literate programming express the logic in a natural language, such as English, different but not excluding the derivation of code from formal specification languages. The use of natural language has the allows the programmer to do more introspection on the domain problem. A literate program looks like a well written physics book, where some phenomenon is described in natural language and translated into mathematical notation deriving the laws in question, a literate program derives a piece of code. A literate program is more maintainable than those programs with only "self-documented" code with sparse comments, because it is very hard to understand what the program does to a programmer new to the problem domain, because that knowledge is not written explicitly in the code.
 * Any good programming style enforce the idea that code should be understandable for humans, not just for machines. As mentioned before a literate program has snippets of macros and traditional source code, interspersed within the explaining text, from which compilable source code can be generated. — Preceding unsigned comment added by 2806:106E:B:C6E9:BC25:52AF:2868:251 (talk) 11:08, 28 November 2021 (UTC)


 * No, *Literate* programming it is not just a style, but an actual paradigm, since you start from the human prose that describes the code that you want to write and "tangle" produces the machine-readable code. The major point is that code is not just embedded in text, but the main structure (= order) follows the textual description rather than plain code. Eli Barzilay 11:13, 1 June 2022 (UTC)  — Preceding unsigned comment added by Elibarzilay (talk • contribs)

Add MATLAB Live Script?
Could the MATLAB Live Script be considered literate programming? Does it matter if the file is a binary format? — Preceding unsigned comment added by 206.241.0.254 (talk) 20:37, 8 February 2022 (UTC)

"Literate programming practices" section nearly useless
It seems that almost all of the entries in the huge table are misleading in that people will read them as examples of literate programming tools. One extremely common example is Jupyter notebooks and its many clones (including things like org-mode), which are systems that are useful, but have nearly nothing to do with the actual proper concept of literate programming. They're usually even more limited than semi-literate programming, since you cannot split code in arbitrary places (eg, function definition in one code block, and its body in a different block).

Removing non-LP tools is likely to be futile since people will probably add such tools again. Instead, it would be better to drop the table completely, and have a quick mention of a few *proper* LP tools. (In the sense that they do unrestricted tangling of code.) — Preceding unsigned comment added by Elibarzilay (talk • contribs) 12:34, 1 June 2022 (UTC)


 * > They're usually even more limited than semi-literate programming, since you cannot split code in arbitrary places (eg, function definition in one code block, and its body in a different block)
 * how about separating it in two tables? one for the proper/semi, and other for all these notebook environments? Other way could be to force some form of sorting on this, but I don't think that force sort will be a good solution in wikip context. Yashpalgoyal1304 (talk) 06:02, 3 December 2022 (UTC)
 * Well, i have understood what literate programming is about (i didn't earlier). Thanks a lot for highlighting the difference - it's only yours this mention which kept me thrusty to uncover the true meaning of it. And rightly so, I can imagine that literate programming would be wonderful.
 * I have added some sentence before table and 2 columns in the table to aid in this differentiation. The latter one is unambiguously "Cellular execution" which is what these new notebooks do. I have titled the other one as "Macros & Custom Order" for now, but as this can be of wide varying degree (i guess?) - i am not sure this is the right column title. With varying degrees I mean the following possibilities:
 * full fledged - code chunks can be specified, used (embedded elsewhere), and then appended, and so on
 * just specifying the code chunk, and explicitly embedded them elsewhere without being able to modify them
 * doing the above point implicitly (giving unique hidden id to the "cells") and automatically (by dependency resolution) - pluto.jl does this
 * and maybe many more ...
 * Just a side note, I like cellular execution too - what is that called btw: Exploratory programming ? i dont know. I hope someday some tool will provide both these features and some other tool for independent "reactivity" as well :) Yashpalgoyal1304 (talk) 06:21, 7 June 2023 (UTC)

Column for licences of LP tools?
I think like at every other table involving softwares on wikipedia, this table should have licenses too? Yashpalgoyal1304 (talk) 05:59, 3 December 2022 (UTC)


 * inspired from Comparison of TeX editors, and using the table in this article; I have created a draft here: Comparison of Literate and Interactive Programming Tools. After that page is published with sufficient details, this article can be modified to contain only a summary of the table. Yashpalgoyal1304 (talk) 16:26, 7 June 2023 (UTC)

Critique section is presently bunk
We have a "Critique" section that appears at first to be (and legitimately should be) about critiques of the idea or general practice of literate programming. Instead, it is a tedious exegesis of an critique of  someone wrote. This badly misleads the reader into thinking this material is pertinent, wasting their time reading it only to find most of the way through that's it's just been a dirty trick. It's just like one of those jokes that go on for 5 minutes only to have no real punch line (or one suitable for a 5-year-old) just to see if you can get someone to listen to it all and groan at the end.

The material in this part concludes with mention of another test implementation that integrated two different approaches to a solution and that this was in turn the subject of a critique. critique might conceivably be encyclopedically relevant, but of course it is entirely absent.

Unless someone wants to rewrite this section from scratch to actually be something that belongs in an encyclopedia article on the concept and practice of literate programming, instead of utter trivia about Knuth and McIlroy, this section should simply be removed. — SMcCandlish ☏ ¢ 😼  20:35, 22 June 2024 (UTC)

PS: I see above that this section was previously flagged as problematic for misleading the reader into thinking it was about a critique of LP rather than a critique of an example program. Given that this was posted more than 4 years ago and no improvement has happened in the interim, I'm simply going to remove this pseudo-encyclopedic material. — SMcCandlish ☏ ¢ 😼  20:48, 22 June 2024 (UTC)