Hubert's Blog
Perspective is worth 80 IQ points.

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:

    E_0 &= mc^2                              \\
    E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}}

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:


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 #

Happy Birthday Professor!

  1. 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! ↩︎

  2. 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. ↩︎

  3. again git comes to mind. ↩︎