Pioneered by Donald Knuth, literate programming is a paradigm in which a program and prose which explains its construction are interleaved.
See also Computational notebook.