Illiterate Programming

Let’s start with a quote from a Wikipedia article about literate programming:

Literate programming is a philosophy of computer programming based on the premise that a computer program should be written with human readability as a primary goal, similarly to a work of literature. According to this philosophy, programmers should aim for a “literate” style in their programming just as writers aim for an intelligible and articulate style in their writing.

In case you have no idea what that means, try to look at the original TeX sources, which are written using the WEB system, both of which Donald E. Knuth came up with. The sources read as a regular book explaining how TeX works, with included code snippets to illustrate some points – but in fact these snippets are the TeX code. The WEB system then extracts that code, and compiles the final software out of it.

The literate programming view, of course, clashes with the more common view that you write code as instructions for a computer to execute. If you consider that TeX has been free of bugs for many, many years, something that certainly can’t be said of the majority of software packages out there, it may seem odd at first that the argument over which is the better approach has not yet been resolved.

The reason will most likely lie in the fact that writing good explanatory prose can be quite a lot harder than writing the code in the first place.

I’m sure there are many more arguments for either side – I, however, am not interested in discussing any of them. I’m picking up on the theme to point out two examples of what I’d like to dub illiterate programming – that is, examples of very good code that’s so fucking hard to read it becomes nearly unusable.