
Object-Oriented Programming, Science, the Economy of Thought
日本語版(Japanese version)↓
Note: This article may contain outdated perspectives overall (e.g., object-oriented programming is considered outdated, and falsifiability is no longer seen as a defining feature of science…). I'm keeping it here as a personal lesson, but please keep this in mind if you choose to read it. Hmm… I clearly have a lot more to learn.
I do some light programming with Python as part of my job, and in the process, I occasionally read books on programming paradigms. Among them are books on object-oriented programming, and I’m often struck by how deeply philosophical concepts are embodied in them.
Object-oriented programming (OOP) is characterized by its ability to organize code through abstraction. For example, suppose a zoo builds a management system for its animals. The program's code would not describe “this particular panda named Xiang Xiang.” If the code tried to capture that specific panda—or any individual panda—it would need to be rewritten for each one, which is clearly impractical.
Depending on the level of detail required, the code would typically define a hierarchy such as "Animal" → "Mammal" → "Panda." The individual panda, Xiang Xiang, would not be directly written into the code, but rather treated as one instance of the “Panda” class—just a data object processed within the structure. Object-oriented programming abstracts individual entities and describes their behavior at the level of generalized categories. This is much like how the concept of the species Homo sapiens does not refer to Aristotle himself, yet includes the fact that humans are mortal.
The code created through such abstraction becomes functionally layered—or structured. From an upper layer, the lower layers are seen only in outline, without exposing their inner workings. It’s much like the relationship between a map and the actual terrain: the abstract outline is separated from the fine details. This is similar to how we understand the fact that someone dies, without necessarily grasping the biological processes of death at a scientific level.
Furthermore, the upper layers of well-written code are often remarkably simplified and abstracted, yet capable of handling a wide range of specific cases. Someone reviewing the code later can follow it from the abstract top layer down into the details, allowing them to understand the system holistically. If they only need to see what the program does in broad strokes, viewing the top-level code alone may suffice. Object-oriented programming, in principle, reduces the cognitive cost of processing code.
This characteristic closely resembles the nature of scientific description. The hallmark of scientific description is its economy: explaining or predicting particular phenomena without unnecessary detail, using abstract concepts and universal rules. Famous principles that articulate this idea include Occam’s Razor and Mach’s Principle of the Economy of Thought. Both advocate for explaining as many phenomena as possible with the fewest necessary concepts. In this economic use of abstraction, we find a guiding principle of science—and that same principle is shared by well-designed object-oriented code.
This philosophical gaze toward the relationship between universals and particulars has a long history, going back to Plato’s theory of Forms in ancient Greek philosophy. Plato posited that there exists an ideal “Form” of, say, a chair in a heavenly realm, and that any particular chair in this world is a derivative of that ideal. From the universal, the particular is born. In this sense, we could say that object-oriented programming is a contemporary technological translation of Platonic idealism.
In a way, both science—driven by abstract concepts in pursuit of cognitive economy—and object-oriented programming are intellectual descendants of Plato’s theory of Forms, which itself was influenced by Pythagoras’s dictum that “all things are number.” They share a commitment to describing rules through number and structure: science through mathematical formulas, and code through its eventual translation into binary machine language.
Explaining particulars through universals is a principle that runs through ancient Greek philosophy and forms the foundation of both object-oriented programming and the scientific method. At its core, this shared foundation can be reduced to the fact that all of these are, fundamentally, theories about knowledge—that is, about information processing. The English name for Plato’s theory of Ideas is the Theory of Forms, and the etymology of the word information—meaning “to give form to”—is profoundly suggestive in this context.※1
However, pursuing the economy of thought by explaining things through universals is, in a sense, only one side of science. The philosopher of science Karl Popper famously argued that the hallmark of a scientific statement is its falsifiability—that it can, in principle, be proven false by the occurrence of a certain event.
A statement is considered scientific insofar as it can be refuted by some empirical instance. That is, a scientific theory must clearly specify the threshold at which it would collapse and must be testable. In contemporary philosophy of science, falsifiability is not necessarily viewed as a necessary condition of science, but rather as a desirable one. A similar idea can be applied to programming, where the counterpart to a falsifying instance is what we call a bug.
Just as an empirical observation that falsifies a theory invalidates it and demands a new one, in programming, if a particular input causes a bug in the code, the code must be rewritten. Programming is thus an ongoing endeavor to reduce the occurrence of such bugs.
One programming paradigm developed for this purpose is Test-Driven Development (TDD). In TDD, the developer first writes the tests—the code that will verify whether the actual code behaves as expected—before writing the functional code itself. By preparing input-output pairs in advance and confirming that the actual outputs match expectations, developers reduce the likelihood of bugs.
Poorly written code often lacks properly modular structure, making it difficult to verify through such tests. Writing testable code requires a certain level of skill. Test-Driven Development is a continual practice of writing verifiable code to minimize bugs.
This effort in TDD closely resembles the philosophical pursuit of generating falsifiable discourse. Science, of course, is not about producing statements that are intended to be falsified. Rather, Popper’s intention was that we should formulate statements that could be falsified, but which persist in the face of numerous attempts to refute them. Similarly, in this programming paradigm, developers aim to continually write code that does not produce bugs (i.e., avoids falsification), while keeping it in a testable (verifiable) state—a clear analogy.
Yet what does it mean, ultimately, to approach truth through falsifiable discourse? It means treating a theory that might one day be refuted by new evidence as a provisional truth, and continuing the inquiry in search of theories that explain more and more phenomena. Whether or not falsifiability is strictly required, this general attitude lies at the heart of science: a persistent search for more comprehensive truths, built on critical testing and refinement.
I believe this attitude closely mirrors what Immanuel Kant called the pursuit of regulative ideas. Kant argued that reason inevitably conjures certain illusions—inescapable appearances—which it cannot help but pursue. He referred to these as regulative ideas. Examples include the concepts of perfect freedom, perfect goodness, the totality of the world, and God. These ideas cannot be empirically verified, yet they function as indispensable ideals—compasses that guide reason itself—and cannot be erased from our thinking.
We can never obtain absolute truth—truth that is unfalsifiable and complete. And yet, as if drawn toward a regulative idea, we continue the effort of verification and correction. This is the essence of scientific endeavor. And the same is true of programming. Modern computation, grounded in the principles of the Turing machine, inevitably encounters the problem of computational undecidability. No programmer can ever write a program that is guaranteed to be entirely free of bugs. Still, within limited time and resources, we employ practices like test-driven development in pursuit of the regulative ideal of a flawless program.
Just as Plato was enchanted by the Forms—ideals that exist in a heavenly realm forever beyond our reach—science and programming both engage in the pursuit of a perfect universal, not as an attainable reality but as an orienting ideal. This may reflect a fundamental human drive: to seek completeness, order, and abstraction in a world of limited information and finite forms.
In this way, I believe that beneath the surface of both science and programming runs the legacy of Western philosophy—a lineage that extends from Pythagoras and Plato to Popper and Kant. Their ideas continue to live on, shaping our approach to knowledge, reasoning, and computation.
※1 I’ve written an article on this subject here: