Understanding objects - OOP and OOO

I came into the Flatiron School a foreigner to programming and the tech world in general. To this day, I am still only beginning to understand the larger concepts of coding. However, within the first week of school, we moved away from Procedural Programming and right into Object-Oriented Programming(OOP), a methodology or paradigm that felt far more amiable to the programmer. As a former, “aspiring” art historian, I immediately recalled a sect of contemporary philosophy call Speculative Realism and the theme of Object-Oriented Ontology(OOO). Could this be related? Could it helpful in understanding OOP? I’m not an expert but I had to find out!

What is Speculative Realism and OOO?

Game influence by Kant’s ethics and his concept “Thing-in-Itself” Play here: https://store.steampowered.com/app/569340/ThinginItself/

Speculative Realism is a modern movement that evolved as a response to “Correlationism,” a branch of philosophy influenced by the seminal works of Immanuel Kant. Kant had the idea that everything we see, we see through our own perception. That we can never really know an object at hand (he calls it the “thing in itself”), but only the “appearance” of it. This was highly influential for many thinkers to come — putting humans at the center of all things in the world. Years later, speculative realists came around and were like “Nah, we reject that idea — quit being so anthropocentric!” Although there are a few differing ideas within SR, the one that I would like to refer to for our purposes is Object-Oriented Ontology, or OOO. OOO thinkers argue that ALL objects are on equal footing — whether it’s a rock, a platypus or a planet, these things exist independently of human perception.

“uh…okay?”

“Thank you for the lecture, but I don’t care about philosophy, I care about programming!!!!”

Yes, I know you are all wondering where this is going — how does this help me as a programmer? To use a quote from a fellow coder, Paul Burt, “What OOO does deliver is a clear language for communicating complexity and change. […] Importantly, its ideas are approachable and general enough that even the folks working on the non-code side of tech ought to be able to get it. That universality, I believe, is why it’s valuable.”¹ So with that, let’s dive into some basic parallels:

The very reason why OOP was created was to simulate how objects work in the real world! Opposed to Procedural Programming, which works in a linear fashion from top-to-bottom and keeps data separate from its functions, OOP wraps up both the functions and data into things called “objects.” This is a far more accessible approach to programing. In his article Applied Metaphysics — Objects in Object-Oriented Ontology and Object-Oriented Programming, writer Gabriel Yoran describes object-oriented ontologies as:

“ pragmatic and open, they are realist in a sense of being a useful system of denotators of things outside the computer (or the programming language). They aim for reusable program code, which only needs to be written once, so problems do not need to be solved twice and errors do not have to be fixed in multiple places.”²

Already we can see the major theme : Objects are the foundation for the thinking behind both OOP and OOO. Objects can be very simple, such as an author or a book. But the more we dive into OOP, we start to see how complex these objects can really be. They can have thousands of instances of themselves (think of a class) and also each one can have a variety of attributes associated to it.

An example of an object with many attributes

We can not only ask objects to know about themselves but also to know about their relationships with other objects. Once you begin building classes and methods inside of them, you start to see the possibilities available to you as a programmer.

shared via fellow student in my cohort

Another way OOO can be helpful to us as programmers is the idea that everything can be an object! When we began to explore ‘has-many-through’ relationships, we were introduced to the idea of a ‘joiner class.’ Lets take a look at the example below:

potential models for Lyft-like app — the Ride class being our “joiner”

Here we have a few things going on: A passenger can have many drivers through the rides they book with the app. And respectively, a driver can have many passengers through giving rides. So it’s obvious that a person, a physical being, can be an object— both drivers and passengers can have names, ages, backgrounds, etc. But… rides?! YES! They are in fact objects! Even if you personally don’t agree that a “ride” is an object irl, ruby sure does:

Furthermore, I’d like to highlight the idea that no two objects are the same — both in OOO and OOP, every object is autonomous and unique. In the example above, we can see each ride is assigned their own id, an identifier for each object/instance we create.

Further Research

I hope this has provided some kind of basis of how understanding OOO can lend a helping hand when first approaching OOP. Once I began researching this topic, I found many more similarities that, for now, are out of my scope as a coder, but thought to share them here in case anyone wanted to learn more:

  1. Recommended book by Graham Harman about OOO: https://www.penguin.co.uk/books/295/295720/object-oriented-ontology/9780241269152.html
  2. Kant “Thing-In_Itself” game: https://store.steampowered.com/app/569340/ThinginItself/
  3. If you don’t want to play the “Kant” game but are curious about it, watch this guy play it: https://www.youtube.com/watch?v=bVG0W8E3WyY&t=187s
  4. Simple video describing differences between SR and correlationism: https://www.youtube.com/watch?v=pt64gOU63Yc
  5. Ian Bogost, writer and video game design dabbles in object-oriented philosophy http://bogost.com/

Citations:

  1. Paul Burt. (Jan 8 2019) Object Oriented Ontology https://www.javascriptjanuary.com/blog/object-oriented-ontology
  2. Gabriel Yoran. (2018) “Objects In Object-Oriented Ontology And Object-Oriented Programming.” In Interface Critique Journal Vol.1. Eds. Florian Hadler, Alice Soiné, Daniel Irrgang. DOI: 10.11588/ic.2018.0.44744 (https://interfacecritique.net/journal/volume-1/yoran-applied-metaphysics#sdfootnote1sym