Log in

No account? Create an account
entries friends calendar profile Elf Sternberg's Pendorwright Projects Previous Previous Next Next
Is Literate Programming dead? - Elf M. Sternberg
Is Literate Programming dead?
So, for the first time in about a year, I turned to writing some C this week and discovered to my annoyance than Noweb is broken in Emacs 22.0. It doesn't do code transitions or font locking anymore. This is actually very unacceptable; I must have code modes and font locking to switch between C and LaTeX as I work.

I went looking for alternatives, and there are none. Sadly, no new work in Literate Programming has been done in the psat two years. LP is being allowed to die on the vine, unused and unloved.

I really don't understand that. It's a great methodology for single programmers, and there are still a lot of us out there, doing our own little things, not bothering anyone. I'm really pissed off that noweb.el is borked, and I don't know nearly enough elisp to do anything about it.

Current Mood: annoyed annoyed

5 comments or Leave a comment
(Deleted comment)
elfs From: elfs Date: July 18th, 2008 01:08 pm (UTC) (Link)
LP never had shiny. You might be thinking of XP (Extreme Programming), which is still very much alive and still the methodology of choice at Google. LP is old enough there are Don Knuth essays from the early 1980s about it, yet it never took off. As Knuth points out, LP asks you to be a good programmer and a good writer. Apparently, there aren't that many people out there who qualify.
blaisepascal From: blaisepascal Date: July 18th, 2008 02:07 pm (UTC) (Link)
I've read a number of Knuth's essays on LP, and I've read the CWEB book cover to cover a couple of times. My impression of Knuth's examples of LP is that it's amazing what, with the proper tools, you can accomplish with global variables and spaghetti code.

In all fairness, Knuth wrote what he wrote mostly in the day before OO became popular, and he's an educator. I think WEB attempts to do two things: It allows code reuse and structured organization in languages which don't do it well; and it provides a structure for documentation, which Knuth used to educate people about how his code worked.

Both of these can be good things, but most folks aren't interested in the second and changes in language technology have alleviated most of the problems with the first. As I mentioned, Knuth's code, probably the widest distributed examples of LP, isn't very well designed by modern standards. He uses opaque variable names, globals, nothing resembling an object, etc.

A minor point which made his code very hard to read to me was his typography (I understand the irony of complaining about Knuth's typography). As a mathematician, he prefers to read code as symbolic math, not as code. As such, CWEB's TeX output (the "Literate" part of "Literate Programming") translates C operators to mathematical symbols and plays font tricks with keywords, variables, etc. This makes it hard for me to actually read his C code, as I have to mentally translate it back to C code to understand it. To the degree it turns readable code into unreadable code, it's a failure in my opinion.

elfs From: elfs Date: July 18th, 2008 07:30 pm (UTC) (Link)
My experience writing LP is that one can write a clear and concise framework or library with a good API with LP just as well as with opacity and spaghetti. You can combine excellent OO design skills with adequate writing skills and produce meaningful documentation that serves the needs of both maintenance and end users. Dismissing LP because Knuth's style is tragically idiosyncratic isn't really all that fruitful.

blaisepascal From: blaisepascal Date: July 18th, 2008 09:32 pm (UTC) (Link)
I don't dismiss LP because Knuth's style is tragically idiosyncratic. Instead, I found the main source for information, the main body of examples using it, and the most well-publicized toolchain tragically idiosyncratic, which made trying to adopt it (for me) difficult and a failure.

Do you have any examples of LP tools and programs which demonstrate its successes, and not Knuth's idiosyncrasies?
5 comments or Leave a comment