Read Programming as Theory Building

Hacker News Top News

Summary

The article recommends Peter Naur's 'Programming as Theory Building,' arguing that programming is fundamentally about constructing and communicating a mental model of the software rather than just writing code.

No content available
Original Article Export to Word Export to PDF
View Cached Full Text

Cached at: 05/09/26, 03:36 PM

# You should read Programming as Theory Building Source: [https://codeutopia.net/blog/2026/05/09/you-should-read-programming-as-theory-building/](https://codeutopia.net/blog/2026/05/09/you-should-read-programming-as-theory-building/) When I finished reading Peter Naur’s Programming as Theory Building my first thought was “How come nobody ever told me to read this?” I ended up reading it multiple times, as I attempted to collect my thoughts on why it makes so much sense\. Have you ever had a situation where you’re trying to explain something or say something, and you’re looking for a suitable word or term, but no matter how much you look for it, you can’t find it? I think Naur’s “theory” is that term when it comes to writing good code and creating maintainable software\. I’ve had many ideas and thoughts on those topics, but they were all disparate concepts, which even when grouped together didn’t really answer the question “why is writing good software hard?” Viewing programming as “theory building”, as Naur puts it, is the missing piece that pulls all of it together and answers the question\. In summary, Programming as Theory Building suggests that the program code, documentation and other products are secondary to what programming really is about: Building an understanding, or a mental model, of the program, its requirements, and how they relate to everything around it\. That is, your primary goal as a programmer is to learn, understand, retain, improve and share this “theory” of the program\. ![All the aspects of the theory influence the program code](https://codeutopia.net/blog/2026/attachments/Drawing%20-%20Theory%20influences%20code.png)I cheated and used the text tool in this drawingIf you think of things like “good code” or “maintainable code”, what is it that comes to mind? It’s probably things that make code easier to understand, like following good conventions, writing “clean” code, having a good architecture, and so on\. You might also think of documentation and diagrams\. Perhaps automated tests\. If you think about it, the goal with everything that relates to writing maintainable code is actually about communicating the design intention of the code\. You write clean code because it’s easy to understand what it does, you architect code so it’s easy to understand its structure and purpose of the structure, you add documentation to help explain what the code does, and draw diagrams for similar purposes as well\. But at least in my experience, developers treat the different aspects of this as separate activities \- eg\. writing tests is its own activity with its own goals, writing documentation is its own activity, and so forth\. If you look at programming as theory building in the way Naur suggests, you can see these activities as part of a larger whole: Communicating the theory of the program\. When seen as part of a larger whole, you can start using the separate activities to achieve the shared goal better\. And communicating the theory of the program is important: If you try to modify a program without having an understanding of the theory, you won’t be able to do it in a way that isn’t hacky\. Similarly, if you need to evaluate the feasibility of some change to the code, such as a new feature, you cannot do this unless you have an understanding of the theory\. In this sense, programming is theory building\. If you think of it in this way, suddenly many more things connect together\. For example, what do design patterns and Domain\-Driven Design have in common? They help you communicate ideas and mental models used in your code \- that is, they help communicate the theory of the program\. Similarly, others have suggested concepts like[Intellectual Control](https://www.georgefairbanks.com/ieee-software-v36-n1-jan-2019-intellectual-control)\- having a mental model of the program, allowing you to confirm it works correctly, and reason about changes to it and so forth \- which could also be seen as a form of “theory building”\. Hopefully I’ve managed to convey at least some of the value of reading Peter Naur’s essay\. There’s more to it, so I highly recommend reading the original “Programming as Theory Building” text\. It isn’t too long, and you can find it pretty easily on Google \- I would link it, but it’s a bit of a gray area copyright\-wise, and I’d have to deep link it from someone’s website\. If you have read it, I’d love to hear your thoughts on it\.

Similar Articles

Learning Software Architecture

Hacker News Top

A software engineer shares insights on learning software architecture, emphasizing the primacy of social and incentive structures over code, with examples from rust-analyzer and scientific code.

My practitioner view of program analysis

Hacker News Top

Practitioner Rory Sawyer reflects on a decade of applying program analysis to bridge the gap between code and human intent, emphasizing static analysis as a communication tool for correctness beyond execution.

The seven programming ur-languages (2022)

Hacker News Top

An essay exploring seven foundational programming language archetypes (ur-languages) that underlie most modern programming languages, arguing that learning fundamentals rooted in these archetypes is more important than the specific language chosen.

Teaching Language Models to Think in Code

arXiv cs.CL

This paper introduces ThinC (Thinking in Code), a framework where language models use code blocks exclusively for reasoning after a brief natural language planning step, outperforming existing tool-integrated reasoning baselines on math benchmarks.

@SaitoWu: https://x.com/SaitoWu/status/2053101671035851216

X AI KOLs Timeline

The article summarizes a talk by Matt Pocock criticizing 'specs-to-code' approaches, arguing that solid software engineering fundamentals like TDD and modular design are more critical than ever for effectively using AI coding assistants like Claude Code.