|
I think a cousin of Literate Programming that does work well is computational notebooks, like Jupyter. Interleaving code and textual description fits the exploratory workflows and scientific communication well. My favourite is Observable (https://observablehq.com/), where code has reactive structure (resolving a DAG like a literate program would at tangle-time), you can choose to keep some code hidden by default (to reduce clutter, make the document end-to-end readable), and use code to make the notebook fully interactive. In terms of Knuth-style literate programming, Org Mode in Emacs, with its Org Babel feature, is a very good tool for this. It's an outliner with rich markup, and where you'd ordinarily insert a code block, in Org Mode, you can also execute it (works with any language you've configured Emacs to connect to) and feed the results to further code blocks. So it works like a computational notebook. You can also tangle the blocks to produce a separate source file, the Knuth way. One common application I've seen is making literate Emacs configuration - people prepare the minimum necessary to set up Org Babel, and then tangle the proper (often large) config from an .org file, where it's written in literate style. As for my own experience, I occasionally try literate programming on small things, and so far - outside using org mode as a Jupyter alternative - I didn't feel more productive with it. I often flesh out the idea of a solution while writing it (I alternate between coding/recoding and design phases), and literate programming adds extra work - refactoring code means also refactoring the surrounding prose. On top of that, the narrative structure seems to interfere a bit with program's own architecture. I know it shouldn't (thanks to the way tangling works), but it somehow does in my head. |