Achraf Kassioui

Blog

Why is programming writing?

Is programming text-based for necessary reasons or contingent ones? What would another universal and expressive programming medium look like?

In its most general form, we program computers by writing text. Why writing? Why don’t we draw instead? Or maybe do some kind of dance with our hands and arms?

I’ll try to clarify this question in three steps: 1) we program by writing because programming is related to logic and reasoning, and logic and reasoning are associated with written language, 2) we program by writing because text-based interfaces are the historical interfaces used by computer programmers, and 3) programming uses whatever is the established way to express thoughts.

1. Language centric culture

Reasoning is done using language. Logic and mathematics are expressed with a written system of symbols. Therefore programming, which is about laying down logical processes, has to be done using language and a precise syntax.

2. Historical contingency of text-first user interfaces

Computers were first designed to input and output text. Before bitmap screens, displays were outputting characters in cells like a teletype printer would do. To this day, programming text editors work on a cell based grid. Even though code appears to be all text, the underlying cell grid is used by the programmer to organize code.

The visual layout of text isn’t innocent: the monospaced grid allows for predictable navigation, indentation helps the mind follow hierarchy, and different modules of the program are spatially separated. Text editors are visual editors where characters are the drawing primitives.

Text input has also been refined along the way: did you notice how the caret in a text editor does not move trivially when you use the arrow keys? Input hardware and text editors have implemented many details to interface with text efficiently: go to end of line, go to end of word, go to end of page, and so on.

Therefore programming uses the most familiar way to interface with a computer that has been transmitted amongst generations of insiders.

3. Programming uses the established way of expressing thoughts

In our culture, written language is the established way to express and communicate thoughts and relations between things. Writing consists of combining symbols to express these relations. Literacy is the basis of our education. So programmers use what the education system taught them to use to express thoughts.

Counter-point 1: many programmers are good at expressing relations with a programming language, but are not particularly good at expressing thoughts with prose and natural language.

Counter-point 2: most of the relations that are expressed with a programming language aren’t in the written symbols. Instead, 1) they are “in” the programmer’s mind, who performs a mental gymnastic to tie up the atomic symbols, and 2) ultimately these relations are what the computer does, i.e. an evolution of physical states that unfolds across time.

Opinion: saying that programming languages are like any human language is probably the most misleading description of programming.

Question: how would you teach programming to a person who doesn’t read and write?

One could argue that if our civilization had come up with another universal way to express thoughts and relations, programming would’ve used that way. Or programming could grow to become that way, yet to be defined.