Object-Oriented Platonism

Mark Foley
4 min readSep 4, 2020

What is an object, really?

This question haunts the minds of beginners in Object-Oriented Programming (OOP) and 1st-year philosophy students assigned to read Plato alike. At first little may penetrate the mental fog provoked by this question beyond the dubious statement, “an object is a thing.” Okay, but what does that mean…?

The student of OOP will soon learn that objects can have properties known as variables and can come in types known as classes. An object’s type or class is not merely another variable or attribute of the object; rather it is something fundamental from which each object derives its very existence. An object is created as an instance of its class like a cast from a mold or a building from a blueprint. The class itself cannot manifest except through instantiation as a particular object, and it can do so any number of times.

The philosophy student would recognize these concepts from Plato’s theory of Forms, a staple of 1st-year philosophy curricula. This 2400-year-old worldview proposes that objects — things in the real world — have no independent existence but are merely reflections of their ideal essence, called a Form. Each chair in the world is a particular instance (Plato would say “phenomenon”) of the class, or Form, Chair.

Like classes in OOP, Forms are conventionally capitalized to distinguish them from their corresponding instances or phenomena.

your_chair = Chair.new

Just as your_chair is an instance of the class Chair, the chair you may or may not be sitting on is a manifestation of the Form, Chair.

Plato variously likens this relationship to that of a shadow or reflection cast by a luminous source: one such source can cast many shadows or have many reflections, each of which can have a unique appearance but nonetheless all are equally cast by the same source. This is paralleled in OOP in the ability of instances to accept different initial parameters and to maintain a variable state potentially unique among all other instances of its class. Though two different instances of class Chair are not equal to one another and may or may not have different variable states, they remain nonetheless both equally Chairs.

I find in Plato a reassuring foundation to fall back on when OOP veers into murky, abstract waters. In the case of a join table, a many-to-many relationship between two classes is resolved by the creation of a third class which exists only as the relation between them. This has the convenient outcome of reducing the burdensome many-to-many relationship to two one-to-many relationships, but it can confuse our understanding of what it means to be a class. A join table can seem to be a fundamentally different type of class than the two more tangible classes it exists to connect, and yet the syntax (at least in Ruby) is indistinguishable.

This would be no problem at all for Plato; he would say the join table is merely the Form of a type of Relationship. Abstract concepts including relationships such as friendship and love are also particulars of their corresponding Forms, Friendship and Love, with these sometimes personified as deities (for example, Eros) to give such abstractions a more relatable tangible visage.

Numbers present another fascinating parallel. Consider the following:

cat_a = Cat.new("Boots") # data type: Cat, name: Boots
cat_b = Cat.new("Boots") # data type: Cat, name: Boots
integer_a = 3 # data type: Integer, value: 3
integer_b = 2 + 1 # data type: Integer, value: 3
cat_a == cat_b # => false
integer_a == integer_b # => true

Even though both cats are named Boots, they are not the same cat. But when both integers are compared, they are the same integer. You could think of this as a coding convenience, maybe some syntactic sugar on the part of the Integer class or a shortcut to save memory. Plato explores this very question, considering whether mathematics gives special direct access to the Forms of the numbers or not. The belief that this special access of mathematics to the absolute is real and not “syntactic sugar” was a central tenet of Pythagoreanism, a proto-philosophical “religion of mathematics” which was influential in Plato’s time.

It may seem odd that highly practical modern concepts like OOP’s inheritance have analogues in abstract ancient philosophy like the hierarchical structure of Platonic Forms. I don’t think Plato would find it strange, however. After all, philosophy thinks of itself as the trunk of the tree of knowledge.

--

--