2 ms·
Sure. There's fullblown literate programming, which (arguably) has been practiced very rarely. For the scoop on that, check out Knuth: http://www-cs-faculty.st
by jashkenas 16y ago
Sure. There's fullblown literate programming, which (arguably) has been practiced very rarely. For the scoop on that, check out Knuth:
http://www-cs-faculty.stanford.edu/~uno/lp.html http://www-cs-faculty.stanford.edu/~uno/lp.html
Here's an example of Adventure done up literate-style by Knuth:
http://www.literateprogramming.com/adventure.pdf http://www.literateprogramming.com/adventure.pdf
But what we're talking about here is a bit simpler. Writing code has always had this strange quality of having to write for two very different audiences at the same time. You need to address yourself both to the machine, to execute the code, and to human readers, to understand it. (Even if the human reader is only the author.) The entire history of programming languages and paradigms is a history of being able to address the human more and more directly, and the machine less directly, as computers get ever-more powerful and able to perform the extra legwork involved in translating "higher-level" forms.
Literate programming means that you acknowledge this fact -- and try to write and structure your code to be read by people first and foremost. Think of your source code as an essay to be read, rather than a list of commands to be futzed with and hacked until it works.