Happy Birthday Prof. Knuth
Donald Ervin Knuth is turning 85 today. He is one of the most fascinating persons in the Computer Science world to me. Let’s indulge as I am telling you my favourite facts about him.
Fact #1: One Book, One Life #
When he was 24, Don Knuth agreed to write a book about compilers. You know, something straightforward, à la “Compilers in action”: chapter 1 Lexers, chapter 2 Parsers, chapter 3 Generation, etc. Add a few optimisations techniques in the appendix and call it a day. Well, that didn’t work out as expected. Knuth quickly realised there was no proper framework to talk about marginal topics like data structures or algorithms. Remember it’s 1962, early days for our science. That’s all right, Knuth decided that instead of three chapters, he would write seven volumes, the title would become The Art of Computer Programming, and that would be the undertaking of his life. Six years later in 1968, he published “Volume 1: Fundamental Algorithms”. Don’t let anyone tell you that 2022 wasn’t a great year since it gave us volume 4b: Combinatorial Algorithms! While we already know the title of the last volume – Compiler techniques – we have no idea of its publication date.
We can take away here that we, young padawans from 2023, stand on the shoulders of giants. How inspiring to see Knuth’s aptitude to see a gap in our field, and throw himself so wholeheartedly to addressing it no matter the effort.
Fact #2: DIY Typesetting System #
In 1977, after the release of the first version of the third volume, Knuth had enough: the typesetting system in use by his publisher was frustratingly poor in quality. He took then a sabbatical and started writing his own1, as you do. One year later, this was the first release of TeX2. What a result! A “labor of love” according to his inventor but also of profound elegance. Speaking of which, Knuth also took the opportunity to invent a language to design vector font: METAFONT. No one will ever measure the magnitude of impact TeX has had on today’s world. This became the de facto communication tool for ideas in academia. It’s especially true in Mathematics where it has brought a standard and beautiful typography for formulas and equations.
On top of TeX, Leslie Lamport would later add his own layer, LaTeX,
the now dominant method for using TeX. I wish we had stopped there in
terms of word processing in the software industry. If you’re not
convinced, look at what you get from any document in Word 2013 and
then admire a document produced by TeX82, e.g. The Only Probability
Cheatsheet You’ll Ever Need. Don’t get deterred by the equations,
feel the joy of your eyes skimming through this pure layout. Zoom at
will into the first diagram and watch out for those ligatures like in
the ffl
in waffle.
Or here to contemplate the power of those algorithms that optimise hyphenation and spacing between words and letters to provide such a beautiful justification.
In TeX, this code:
\begin{align}
E_0 &= mc^2 \\
E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}}
\end{align}
will produce this output:
\begin{align} E_0 &= mc^2 \\ E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}} \end{align}
This fact illustrates perfectly one of Knuth’s principles that the very act of communicating one’s work clearly to other people will improve the work itself. Elegance matters. Let’s push it further with the next fact.
Fact #3: Literate Programming #
Ce que l’on conçoit bien s’énonce clairement,
Et les mots pour le dire arrivent aisément.Whatever is well conceived is clearly said,
And the words to say it flow with ease.– Boileau, The Art of Poetry (1674)
Ok, so we have mentioned this principle of Knuth’s that communicating one’s work clearly improves the work in itself. We also know of the dogfooding principle whereby using your own solution internally can be of great benefits in terms of design and usability3. What does that mean for TeX? In case you didn’t know, this is called Literate Programming. Knuth indeed coded TeX and METAFONT in TeX or more exactly in WEB. WEB is the first published literate programming environment. As you may have guessed, it was devised by Knuth. It uses TeX for typesetting and Pascal for the coding. In essence, a WEB file is a TeX file that describes and includes a program. With it, you can then tangle the source code ready for compilation and weave the document.
The literate programmer is more of an essayist. It is not totally surprising that it didn’t became mainstream as not all devs resonate with it. Yet Test Driven Development is no less radical while being (kind of) mainstream. Anyways, I wish Literate Programming was more commonly adopted.
It works really well for me. It makes the whole process of thinking, designing, testing and coding natural and pleasant. I use org-mode with org-babel. One day, I’ll have to show you that.
Oh, what a tangled web we weave
When first we practise to deceive!– Sir Walter Scott, Marmion (1808), Canto VI, XVII
Fact #4: You Can’t Get Geekier #
It’s actually a list of facts:
- TeX version numbers asymptotically approach π. First version was
3
, then3.1
, then3.14
, etc. For METAFONT, it’s the constante
. Both are frozen and only accept fixes. When Knuth passes away, versions will respectively become π and e and that will be the last change on those projects. - If you find a bug or a typo in one of Knuth’s books or programs, you’ll get paid in hexadecimal dollars (0x$) as a deposit at the Bank of San Serriffe, “which is an offshore institution that has branches in Blefuscu and Elbonia on the planet Pincus”.
- Knuth has a planet named after him.
- In his spare time, he plays pipe organ which you guessed it, he designed himself.
- He wrote a book that studies each verse 16 in chapter 3 of each book in the Bible: 3:16 Bible Texts Illuminated.
Famous Quotes #
Beware of bugs in the above code; I have only proved it correct, not tried it.
Premature optimization is the root of all evil.
Further Reading #
- Don Knuth’s Homepage.
wc
as an example of Literate Programming.- Vast collection of lectures by Don Knuth on Youtube and iTunes.
- I reckon Knuth is not the best speaker ever. I do recommend his lectures about TeX.
- A random story about Grand Theft Auto, Knuth and a Maths book by Knuth et al, written just for us software engineers.
Happy Birthday Professor!
Somewhat a similar story to what Linus Torvalds would do 40 years later with git. But it took only 4 days for git to be self-hosted! ↩︎
In total, the sabbatical would last 10 years to stabilise TeX and METAFONT! I am sure by now you have recognised a pattern in Prof. Knuth’s ways with completeness vs deadlines. ↩︎
again git comes to mind. ↩︎