Two Types of Language
When I was a teen, I taught myself an old-school programming language called BASIC. Languages like BASIC are “procedural,” like a recipe. Each line has an instruction, and the computer goes from line to line, obeying commands.
- Add 1 tsp salt
- Add 3 cups flour
- Add five dozen eggs
When I got to college, I was taught Java, and I am currently reading Practical Object-Oriented Design in Ruby , by Sandi Metz. Languages like Java and Ruby are “object oriented,” instead of procedural. They group together information into chunks called “objects.” Each object not only has certain properties, but can perform certain functions.
In an object-oriented programming language, it’s as if your recipe is accomplished by robots.
- Tell the teaspoon to scoop in salt once.
- Have the measuring cup add flour three times.
- The eggs should now throw themselves into the bowl. Five dozen of them should do this.
- The bowl should grab a spoon and stir itself.
Transition to Philosophy
After college, I went to grad school for philosophy, and started learning about ontology. People would ask me about the transition from computer science, a STEM discipline, to philosophy, a Humanities discipline. I would say, “Programming teaches you how to create complex, consistent systems. And that skill is key to what philosophers do.”
But at some point I heard someone make an even stronger claim: with object-oriented programming, you need to understand Aristotle. Object-oriented languages treat reality as if it were divided into Aristotelian “substances.”
The longer I’ve worked with both programming and philosophy, the more “right” this way of looking at the subject seems. Or, rather, the clearer it’s been that modern programming languages make certain philosophical assumptions, and using requires you to do philosophy about the world.
Programming as Ontology
Philosophy asks four questions, as someone once wrote. The first question is, “What is there?” This is where all programmers start when creating a new program. And usually, the answer is, “There is a system here made up of interacting objects that I need to model with my code.” And that means that creating good code, at least in an object-oriented programming language, requires figuring out how to “carve reality at the joints” (to borrow Plato’s phrase).
In creating a new program, in other words, coders are doing ontology. They are figuring out what exists and how it works, then describing it by creating a model in code.
For example, if you are writing a program to allow people to order airline tickets online, you have to figure out what the basic “objects” are, and how they should interact. Your code will at least need to have a basic model for customers. A customer will be an “object” that can store credit card numbers, seat assignments, and mailing addresses, and that can place orders, check in, cancel, etc. And your code will need a basic model for flights. A flight will be an “object” that has destinations, origins, expected departure times, numbers of seats, IDs, etc., and that can leave, arrive, refuel, etc.
Will you also need models in your code for seats (with properties like “row,” “window,” “occupied”)? Will it also need to have objects like “Attendant” and “Pilot”? Probably. More attributes and interactions to work out. And if any of those “objects” in your code doesn’t accurately model the real “objects” in the world — or doesn’t model how they interact, properly — you’re going to end up with a real-world mess.
While philosophers worry about whether or not they should even be doing metaphysics (the fancy name for “ontology,” which is already pretty fancy), or whether philosophy has any application to real life, computer people are actively doing philosophy. They even have an entire discipline they happily call “ontology.”
And it’s not just programmers. To design a proper database system to store information — whether in scientific or business contexts — someone has to do an ontology. They have to figure out what kinds of “objects” (people, events, transactions) they are going to be storing information about, and how those “objects” relate to each other.
I’ve long argued that philosophy is the practice of thinking clearly about life. If that’s true, then there’s a sense in which philosophers don’t need to defend their discipline, or justify its existence. Philosophy is a practice you will find happening everywhere; without it, the world wouldn’t work.