As I talk with humanities faculty about the dangers of generative AI, a common concern emerges. Almost everyone prefaces their remarks with the thought that writing is thinking. Therefore, the writing task should never be outsourced to AI. But here’s the interesting part. Many computer science faculty are now saying the same thing. For them, writing code from scratch is a fundamental skill that teaches students how to think algorithmically. As such, it, too, should never be handed off to a machine. Like their humanities colleagues, writing is thinking.
All this raises an interesting question: "Does computational thinking differ from its compositional relative?" Is the act of writing similar in both cases? Or is it fundamentally different? Having written many lines of code during my technical career, I can say that these two kinds of writing are indeed quite similar.
In the early 1980s, the renowned computer scientist Donald Knuth began to blur the line between computational and compositional writing. Knuth’s series – The Art of Programming – is widely considered a masterpiece in the field. He also initiated the literate programming movement in the early 1980s. As Knuth puts it, the “main idea is to treat a program as a piece of literature, addressed to human beings rather than a computer.” In other words, a programmer writes for two audiences: human and computer. 1
Literate programming is alive and well today, first in the LaTeX language Knuth designed and also in how we write and think about code. The popular Jupyter Lab notebook system, for example, allows scientists to write both ways. They can write runnable blocks of code for the computer in code cells or write explanations in plain English for humans in markdown cells. The final product, a documented work of technical literature, is greater than the sum of its parts. Markdown, for those who don't know, provides a limited set of commands to format text. We will not delve into the technical details here. Suffice it to say, anyone authoring a Jupyter Notebook must be able to code switch; that is, jump between two or more "languages" in a single document. In this case, the languages are algorithmic and compositional writing. Jupyter provides multilingual support, so the composition part of the notebook may not be in English. However, the code is almost always in English, or at least the keywords of the programming language it's written in.
To explore the similarities between writing an essay and writing a software program, I asked ChatGPT to outline key areas of overlap between the two. The model responded that both kinds of writing call for clear structure. Or stated differently, the author needs to develop a logically consistent line of thought while writing, though how one does that differs somewhat between the two.
In a programming language like C or Python, the vocabulary, the number of words available, is limited. Reserved words, statements like while or loop, convey precise meanings to an interpreter or compiler — the two types of computer reader. When just a few words are all one has, the tendency is to develop a minimalist mindset. Great programmers are laconic yet clear. The way one structures code also communicates meaning. For example, indents are mandatory in Python, making programs much more readable. Interestingly, poets often do something similar, using novel presentation techniques to convey meaning beyond the words themselves.
On the other hand, the author who writes an essay, book, or article is confronted with a sea of words. Expressivity is greatly enhanced, though this often makes it much more challenging to maintain a logical line of thought. We’ve all read authors who wandered aimlessly, leaving us to ask, “Where’s this person headed?” That’s why outlines are helpful. With a few words and the use of bullet points, numbers, and indents, a writer can figure out where they’re headed. Wait a minute. That sounds a lot like a computer program! And indeed, it is to a large extent. Likewise, programmers often write pseudocode when designing a program. Pseudocode, as its name suggests, is not real code but rather a technical outline of a program’s overall logic.
The similarities between writing code and writing compositions is fascinating. We do not have time to explore the differences in today’s post, but I plan to do so at some point in the near future.
https://www-cs-faculty.stanford.edu/~knuth/lp.html
Fascinating comparison of code writing and composition writing. Can’t wait for your next article on this subject.