2 min read

Programming as Theory Building

Naur argues that the primary aim of programming should be for programmers to build a comprehensive understanding or "theory" of the problem they are solving
Programming as Theory Building
Programming as Theory Building
Table of contents:

Introduction: Beyond Code Writing

Programming has long been viewed as a task of writing code to solve problems. However, this perspective is somewhat limiting and doesn't capture the essence of what programming truly is. According to Peter Naur's seminal paper "Programming as Theory Building" programming is not just about writing code but about building a theory of the problem you are solving. This blog post delves into this revolutionary concept and its implications for the software development industry.

The Core Idea: Theory Building

Naur argues that the primary aim of programming should be for programmers to build a comprehensive understanding or "theory" of the problem they are solving. This theory is not just about the code or the algorithms but about understanding how the program relates to real-world affairs, justifying each part of the program, and being able to adapt it to new requirements. In essence, the code is just a by-product of this theory.

Why Traditional Views Fall Short

The traditional view of programming as merely code production is inadequate for understanding the complexities involved, especially when it comes to modifying existing software. This is because the code and its documentation are often insufficient carriers of the program's underlying theory. Without a deep understanding or "theory," even well-documented code can be difficult to modify or extend.

Implications for Software Development

Understanding programming as theory building has profound implications for the software development process. It emphasizes the importance of the programmer's role in understanding the problem deeply, which in turn affects the program's life and modification, system development methods, and even the professional status of programmers.

Examples to Illuminate the Theory

Example 1: Building a Payment Gateway

Consider the task of building a payment gateway. The traditional approach focuses on writing code to handle transactions. However, the theory-building approach would involve understanding the financial regulations, the user experience, and the security implications. The programmer would build a theory around these elements, and the code would be a manifestation of this theory.

Example 2: Developing a Machine Learning Model

When developing a machine learning model to predict stock prices, the code is just the tip of the iceberg. A programmer adopting the theory-building approach would delve into economic theories, market behaviors, and data science principles. The resulting program would be a reflection of this comprehensive theory.


What is the Theory Building View of Programming?

It's a perspective that views programming not just as code writing but as building a comprehensive understanding or "theory" of the problem being solved.

How Does This View Affect Program Modification?

With a deep understanding of the problem, programmers can more easily adapt the program to new requirements or changes in the problem domain.

Is the Code Unimportant in this View?

No, the code is still crucial, but it is a by-product of the theory. The theory helps in writing better, more adaptable code.

How Can I Apply This in My Programming Tasks?

Start by understanding the problem deeply. Ask questions that go beyond the code to understand the real-world implications, justifications, and future adaptability of your program.

By rethinking programming as a task of theory building, we can revolutionize how we approach software development, making it easier to adapt to changes and solve complex problems effectively.