Programming and Philosophy

I’ve never been good with my hands. Give me a set of parts and tools, and I can produce a mess in record time. I don’t change my own oil, won’t even try to fix my car and avoid even the most basic of handyman tasks around my home. In short, don’t rely on me to build anything.

Yet the creative urge burns within me. I want to create functional things, tools I can use. I want to look at something useful and think “I built this”.

Fortunately, I have an abstract realm within which I can create. I can write, develop models, create ideas, and most importantly, I can program.

I especially value programming because I don’t have to mentally simulate the results, and this gives me a reality check. For instance, I can create an incoherent idea, write a novel full of plot-holes or create inconsistent models, because these are static creations. But a program is dynamic and is executable. When I run it, I can see if what I created really worked. This puts me in the same position as a carpenter or mechanic.

However, as a programmer I have far more power. While carpenters and mechanics build physical structures constrained by the laws of physics and economics, I can build anything. I don’t have to pay for raw materials when I program, so I’m limited only by my ambition and intellect. I can even create my own rules. I can create crazy simulations, create worlds with their own unique logic and go far farther than can people constrained by the limits of the physical world.

I spoke of world simulation. As a programmer, I simulate the world a lot. I’m not speaking of games, although they do involve the most obvious examples of world-building. I’m speaking of almost everything. For instance, if I write a payroll system, it simulates the part of the world in which employees receive checks, pay withholding, etc… If I write a word processor, it simulates that part of the world in which people write letters, articles and so on.

However, I need not restrict myself to this. I can define entirely new worlds and rules, alien to anything we know. I can create a world in which 1+1=3, in which true=false. In short, in my own little realm, I can play God.

This gives me a unique appreciation of philosophy. Why? Because philosophy studies the most fundamental aspects of reality. It studies the things that exist, the rules we make, the nature of our ethical systems. It asks questions so fundamental, so basic, that often people may think them games or wonder how philosophy can ever answer them. And these kinds of questions arise when you are building a world.

For instance, my software consists of the user interface that people see and interact with, and the model – the underlying “reality” that feeds the user interface. Does this sound familiar? This resembles the phenomena (appearance) and noumena (thing in itself) distinction that Kant proposed.

When a philosopher speaks of something like this, I find it intuitive. I not only have encountered this dichotomy, but I’ve encountered some of the implications.

For instance, I can have several user interfaces connected to the same model, and I can have even have a model that has no user interface and thus runs without anyone observing it.

Which reminds me, it also makes sense to me when someone speaks of a reality outside of senses.

I also understand the principle of verification. I reinforce it every time I test my software. When I test my software, I run it and observe its behavior. This behavior tells me what happens within. If someone reports a problem, and I cannot observe anything in the program that demonstrates the existence of the problem, then I conclude there is no problem for all intents and purposes. Thus I can understand how Logical Positivists consider some philosophical claims “nonsense”, without falling into the trap of considering that equivalent to “false”.

So I understand some of the loftier, unobservable philosophical claims, and the objections to them. I can do this because I can go beyond the user interface and observe reality (the model) directly. Imagine a philosopher had the ability to peel back the veils of reality, to observe things beyond sense. I stand in that position.

I also can appreciate various philosophical theories without holding to any of them. For instance, as a developer, I have many ways of developing software. I can choose an object oriented method, an imperative method, a functional method, a logical method, and so on. Each method has its strengths and weaknesses and can produce equivalent software. Yet none of these methods is “true” or even objectively “better” in all cases than any other.

Thus, I can understand how different “theories” of reality can all fit in with the facts. I find no confusion about this, nothing that needs a second thought.

Furthermore, my choice of representation depends on what it buys me. For instance, I may find that object orientation leads to a design (for that application) that I can maintain and extend with more ease, and so I choose it. Therefore, I can argue for a representation without claiming one representation as true or all representations as arbitrary. I see no problem with any of this and I intuitively understand pragmatism – I apply it every day in my job.

In addition, I find that these same methods of chopping up reality correspond to some philosophical methods. For instance, object orientation lines up with how we view the world as composed of “things”. Objects consist of methods and properties, which fits in with the philosophical view of things as having attributes. On the other hand, imperative or functional programming maps more closely onto “process philosophy” which views the world as process. Even logic programming has affinities with logical atomism. I can switch between representations as I decide which one best fits my needs at any moment.

From this emerges a natural pragmatism and a natural skepticism. With so many ways to chop up reality, I find it difficult to adhere to any with any sense of dogmatism and instead consider any method provisional, subject to pragmatic concerns and the best information we have at any given time.

I can take functional programming and ask if the world is immutable. In other words, do things change, or do we have a world composed of snapshots at different points in time? This brings to mind philosophical theories about the continuity of self, including the belief that the self doesn’t change from one moment to the next, but that memory gives it an illusion of continuity.

Some programming topics tie in more directly with detailed philosophies, and here, the two have mutually reinforced each other. For instance, tacit programming doesn’t use variables. I won’t go into details, however this ties in with the work of Quine, and the work of Haskell and Howard have fed into this in the form of the Curry-Howard isomorphism.

Logical programming maps onto logical atomism. I see things as logical objects and try to model them, not in terms of processes, but in terms of logical relations. I can ask about the tiniest elements or atoms of logical thought, hence “logical atomism”.

In addition to all of these, having a system that can execute purely “non-physical” operations gives even the most abstract of theories the potential for concreteness few have imagined. I can for instance attempt to simulate or build a program to execute a series of relations and in the process test the theory for consistency. I can test it to see if it can do the work expected of it, and if not pronounce on its truth, at least pronounce on its plausibility.

In addition, an analytical and reductionist mindset comes very easily for programmers. For instance, every time I develop software, I analyze it into smaller components and try to re-use those components (parsimony) as much as possible. Thus I find absolutely no problem with reductionism and don’t even understand why there would be any controversy associated with it. Reductionism and analysis go hand in hand.

I also intuitively understand the tendencies of analytical philosophy to define and understand term use. For instance, when I write software I will often use certain functions that may not exist, and I therefore must define them. This definition can use other definitions and so on, until I get to the most fundamental components of the definitions, the language and library primitives that I must use to implement those definitions. Thus the emphasis on definitions and the lengths to which definitions can go do not surprise me, and I engage in them often.

Even on a higher level, I will often discuss project features and take great care to be consistent in language and avoid language that may mislead (domain language). In fact, the constant confusion between users and developers has developed an appreciation in me for the pitfalls of language, and so when an Analytical Philosopher announces language to be a problem, my reaction is “of course!”.

As a programmer, I can also define the truth of a claim as the means for its verification. When I get requirements, I can only ask if my software fulfills those requirements based on testing. How can I verify adherence to requirements? I do not for a moment consider requirements outside the means of their verification. I find verification absolutely essential; I see no point in even attempting to write something I cannot test, and if I have a say, I will not do it. Thus I share with the positivists a central concern with verification.

Even the process of testing and fixing bugs has an affinity with philosophy of science and theory building. In fact, If we extend the concept of philosophy here to include philosophy of science, we get into interesting parallels with falsifiability and theory verification. A program can be considered a theory, and the subsequent runs of the program can be considered observations. Once an observation fails (bug) then the theory must be either abandoned or updated to take the new data into account (bug fixes).


  1. Just this morning I wondered what the link was between interest in philosophy and computers. This answers the question! I guess I never saw the metaphor all that clearly. Not even the Matrix made that clear to me. Thanks!

    “For instance, I can create an incoherent idea, write a novel full of plot-holes or create inconsistent models, because these are static creations.”

    Interesting that you should mention plot holes in this context, because I like to think of my writing as a simulation, and my writing group’s responses as the result of a test run. In the last meeting, I had a character pick up something that was physical impossible to access. Of course, people tend to focus on theme and writing quality, but that little stuff matters. We don’t want characters walking into walls!

    • Talk about timing :).

      I can see the process of reading a piece of writing as a simulation, as the reader is creating a mental model to fit the written word. In that sense, yes, your writing group is very valuable, as you get multiple runs of the simulation on different “machines”.

      I hear you on not wanting characters waling into walls. I think this sort of thing was what also motivated some of my posts on generating plots. There are rules in novels as well. Not everything goes 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s