Random Art and the Law of Rotten Software
- 17 August 2010
Since the death of my old web server my Random Art has not worked. Bringing it up to date and installing it on the new server was a nightmare in software management. But it was worth it. The new Random Art runs the random art program inside your browser!
I implemented the old Random Art in 2005 withÂ ocaml and cduce. Cduce is a programming language for XML which statically checks correctness of produced XML. I thought that nothing could be better than a web site that has an a priori guarantee of 100% complicance with strict HMTL. Those were the days of idealism.
Well, in 2010 it turned out to be quite impossible to reinstall Random Art on the new server. First of all, the current version of cduce is incompatible with the one from 2005. In addition, the old version of random art relies on old ocaml libraries that are not available in current Linux distributions, so I cannot easily recompile it. If I really wanted to install the old version, I would have to install an antique Debian system from 2005, but then I would suffer from old security holes. There must be a software equivalent of theÂ second law of thermodynamics, let’s call it the Law of Rotting Software:
“All software eventually fails, even if it you leave it alone.”
So it was clear that I should junk cduce and use something sane, like Django. (I know there is ocsigen, but as we say in Slovene, even a donkey steps on thin ice only once). I separated the ocaml code that computes random pictures from cduce and reimplemented the web site in Django. The site was up and running in no time!Â Except that all pictures were uniformly gray. It took me a week to figure out that this was caused by a change between ocaml 3.10 and 3.11 in how they treat mutable record fields inside function closures. It is still not clear to me exactly what the change is because I am not able to produce a small example that shows the difference.
f(x,y) from left to right). I am amazed at having 1200 lines of ocaml code run inside a browser.