Ask HN: any experience with literate programming?
The concept of literate programming was invented in the 1970's by DEK with WEB [1] during the rise of structured programming. In my understanding, the goal of literate programming is to implement concepts in programs by following one's own approach, and make it understandable to other human beings.
WEB and its relatives rely on a programming language (eg. C) and a document formatting language (eg. TeX). The program and its documentation are written at the same time, in an unique source file. At anytime, one can extract the whole source files (aka 'tangling') or the documentation explaining its implementation (aka 'weaving').
Have you ever used literate programming? What is you experience with it?
[1] http://www.literateprogramming.com/knuthweb.pdf
1 comment
[ 2.5 ms ] story [ 14.1 ms ] threadCurrently I use a bastardized form of literate programming that would not qualify as "real" literate programming. I put the code in the order the code belongs and I embed the document within comments in the code. This leaves the source executable for scripting languages, or directly compilable for compiled languages. We made a tool to flip the source "inside out" to produce a document (TeX/PDF,HTML).
According to LP people I am doing it wrong and not really getting the benefits. That's pretty harsh, but I've managed to live with myself somehow. What we end up with reads like a document, looks great as a web page or printed, and provides encouragement to write meaningful text descriptions. The biggest part to stress is the very last bit: writing meaningful text. Since you produce a document you expect it to read like one. This discourages stupid comments stating the obvious and encourages you to talk about reasons why and other meaningful things.
Please keep in mind that this is just my opinion, coming at LP without the benefit of working with someone who already knew it well.