In trying to really “get” literate programming, I have been using it for a number of my smaller, almost toy, projects. Little scripts, utilities, that sort of thing. Those chunks of code that programmers and computer enthusiasts write, not because they must or for a paycheck, not even to write that big application that’s missing from their toolboxes–but just to make those stupid little problems in life go away.
The results have been encouraging.
Overall, it does not seem to take me much, if any, longer to write the little script. Usually, the information is nothing new–it is the requirements and research that I would have had to do anyway to build the tool in the first place. At least with this method, that information is not lost as it is stored right alongside the script itself.
It is true that this does not produce the large volumes that literate programming is semi-famous for, including Knuth’s own Literate Programming, but it does fulfill the fundamental tenet of literate programming, namely that programs should be written for other human beings. This is particularly pertinent in scripting, because, it seems, that scripts are particularly prone to the read-only syndrome. I noticed this myself just recently when I was cleaning out my ~/scripts directory (superseded by ~/src and ~/bin–one of the reasons for the spring cleaning).
Does anyone else have any thoughts on literate programming for little one-offs?