Casual Literate Programming

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?

Asciidoc backend for Noweb

I’ve been toying with using noweb for some miscellaneous coding projects of late. I personally prefer Asciidoc over other formats supported as backends for noweb, including LaTeX and HTML, so I wrote a backend for it. A copy of my patchset can be found at:

http://www.mad-computer-scientist.com/files/toasciidoc.patch

The archive contains patches against the 2.11b release (current, as of this writing). Drop me a line if you have any questions or comments.

Compiling a KDE 3.5 app on Ubuntu 10.04

I was trying to compile an old KDE 3.5 application this weekend because no port to KDE 4 has yet been made. Judging by the activity on the site, it is doubtful that it ever will be. For the curious, I was trying to get SchafKopf [1] up and running. I am running Ubuntu 10.04 (Lucid) which has long since ditched the KDE 3.x line for the shiny 4.x line.

While some of the KDE 3 libraries still ship, some key ones for this particular application were missing. Namely, libkdegames. The solution turned out to be the KDE/Trinity project [2]. This project attempts to continue development and maintenance on the 3.x line.

As a sidenote, this is what is so beautiful about open source software. The vendor threw out a line that was beloved of some and replaced it with something they did not like so well. Rather than being stuck, they can maintain the software themselves.

Back to the problem. All that I needed to do was install the libkdegames-kde3-dev package and run:

% ./configure --without-arts --includedir=/opt/kde3/include/kde
% make
% sudo make install

and everything was cool. --without-arts may or may not have been necessary after installing the trinity libraries. It was earlier. /opt/kde3/include/kde is where the includes were placed, instead of the standard path.

Have fun.