Programming as Theory Building

From Weekly I/O#102


Programming is not about writing code but about building a theory as a comprehensive mental map of how the pieces fit and why they matter. A program dies when the original team processing the theory leaves because new developers cannot construct that theory from code and artifacts.

Paper: Peter Naur, Programming as Theory Building

Why do some software projects thrive over time while others collapse under their own weight?

Peter Naur states that the fundamental nature of programming is not the creation of source code or documentation, but rather the construction and maintenance of an evolving "theory of the program" shared within the minds of the people working on it.

This theory is a mental map constructed through fixing bugs, developing features, and debating design tradeoffs. Developers learn how the pieces fit and why they matter so they can use this theory to predict how the software behaves, solve new problems, and make reasonable modifications.

The code and other artifacts are merely written representations of this theory. They are secondary products and are inherently "lossy". Therefore, the complete theory cannot be rebuilt solely from these artifacts.

This explains why software projects collapse. A program dies when the team possessing its theory is dissolved. While the software might continue to run, its death becomes inevitable when modifications or extensions are needed. A new team lacking the original theory will eventually cause changes that diverge from the original intent. To extend a program's life, new developers must build their own theory by working closely with existing developers.

To save "dead" programs, it might be more effective to discard all existing codes and solve the problem from scratch, rather than attempting a difficult, frustrating, and time-consuming effort to rebuild a theory for an existing, potentially obscure program text.

Seeing programming as theory building resembles how Deutsch and Popper think knowledge is from guesses we invented as theories and the process of turning mental construct into code resembles how writing is the process of encoding a web of ideas into a string of words using a tree of phrases.

The concept of the lifecycle of software projects also reminds me of Ted Chiang's novella The Lifecycle of Software Objects, which I've briefly noted here.


Want to learn things like this every week to understand the world better? Sign up below for my weekly newsletter.

Weeklyio Banner

You might also like