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.
|Country:||United Arab Emirates|
|Published (Last):||18 October 2010|
|PDF File Size:||20.65 Mb|
|ePub File Size:||15.75 Mb|
|Price:||Free* [*Free Regsitration Required]|
The holon integrates with other holons in the hierarchy according to a flexible strategy. Document source code using an API documentation standard doxygen.
Often a complex parser program is needed to re-arrange the code into computer acceptable form — such is the case of Knuth’s WEB.
The key features of literate programming are the organization of source code into small sections and the production of a book quality program listing. The question was “why didn’t?
If anything the comment can confuse because programmers don’t usually read code, but can find it easy to agree with the comment so they move on.
Listings generated by the WEB system are unlike any other form of program listings in existence. But until English can be executed by a computer, you must use programming languages to get the lump of sand proggamming do stuff. It’s one thing to imagine a profession of literate programming as practiced by Donald Knuth; it’s another thing entirely to imagine it as practiced by the kind of people who are actually writing code.
The present chunkwhich does the countingwas actually one of the simplest to write. Some of it also seems very tied to particular languages. This means that in the course of reading this book, you will read the full implementation of the pbrt rendering system, not just a high-level description llterate it.
Literate programming – Wikipedia
Here’s a good write up of notebooks and science: LP is “just” that commentary written directly in the code. The former is writing code first, then write documentation to explain the code without changing the code significantly. In some sense, the literate programming system is just an enhanced macro substitution package tuned to the task of rearranging source code. The “program” then becomes primarily a document directed at humans, with the code being herded between “code delimiters” from where it can be extracted and shuffled out sideways to the language system by literate programming tools.
Literate programming is useful for programs of all sizes. But Knuth is concerned not only literatf 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. Such codebases use docstrings and other mechanisms available in the language to do exactly the same thing that previous LP implementations did. This feature makes the description of the program just as important as its actual source code, encouraging careful design and documentation.
I can’t help but think “so what? Bad code will make your programmers groan and occasionally threaten to quit, but it usually won’t threaten the existence of an organization.
Suppose you need to change it I don’t recall exactly the date now. If you don’t do it in a language which supports it – shame on you. That makes it hard to come up with a sensible system of organization, as we’ll put effort in to enumerate and categorize only to discover that it falls apart.
Literate programming encourages meaningful documentation and the inclusion of details that are usually omitted in source code such as the description of algorithms, design decisions, and implementation strategy. The time I spent on the documentation could have gone – from my current perspective – into making the code smaller and simpler.
Literate programming is just a single technique to be used along with all the other well established software engineering practices. Knuth wrote a “novel” which explains the code of the interactive fiction game Colossal Cave Adventure.
This is illustrated by the following snippet of the wc literate program. The largest and most visible one is Axiom https: Most developers are terrible, terrible writers. Basically, if there are any parts of the program that you would describe differently in conversation, then it isn’t the same litrrate.
I still think LP can have it’s place, especially when writing code meant to be read as a teaching tool, like: Someone else mentioned that he sees value in LP in the context of education. And no, I don’t have a dog in there either, not the least because I’ve never seen anyone use literate programming in the same building I was in.
It may be any textual information literzte aids the understanding of the problem. The only reason it is apparently “hard” has nothing to do with computers, and everything to with the inescapable fact that correct, consistent and reproducible logic patterns are hard. The document should moreover contain fragments of a program written in some traditional structured programming language, in such a way that they can be mechanically extracted and arranged into a complete prgoramming in the formatted document on the other hand layout and choice of program,ing for these program fragments should be so as to maximize readability.
However, the syntactic affordances of languages doesn’t really do this justice. B and C don’t work because they break the test case; A is required. You don’t have to define or even declare functions before their first use in the file, you can easily extract any part of the code into a function or method and you can place it anywhere you want.