Plato and Object Oriented Programming

Object Oriented Programming represents a paradigm shift away from the traditional modular programming methodologies that have prevailed since the advent of computers. While today’s computer scientists are undoubtedly clever chaps, the intrinsic concepts underpinning Object Oriented Programming were actually considered almost 2,500 years in the dialogues of Plato!

Now, it is extremely doubtful as to whether the architects of Object Orientated Programming (OOP) were aware of these prior concepts, as the stereotypical computer scientist is not normally renowned for his classical education. However, even if they weren’t aware, there does seem to be a remarkable correlation between the thought processes of Plato and the later day software architects, even separated across the millennia.

Ancient Greek Philosophy

Plato was born in Athens, Greece in the year 428 BCE and was tutored by Socrates (often credited as the father of Western philosophy). However, it is Plato, not Socrates, who is arguably the best known of the ancient Greek philosophers (if not of all philosophers), due in large to his profound influence on modern philosophy through his legacy of prolific writings; 35 dialogues and 13 letters.

While Plato’s writings cover many philosophical subjects, it is his radical metaphysical concepts, developed throughout his many dialogues, that are of particular interest in our comparisons with object oriented programming. Fundamentally, it is Plato’s theory of forms that is directly analogous to the foundations of OOP.

Theory of Forms

Throughout his metaphysical discussions, Plato refers to forms as abstract representations that are templates or patterns for real world objects or characteristics of objects.

By way of example, to explain the concept of a form, Plato discusses the concept of beauty. A flower is beautiful and a picture can also be said to be beautiful, but neither are beauty itself. Plato argues that the form of true beauty exists independently of the objects that have it, as such we may have a notion of perfect beauty, but can never actually experience it first hand.

In Plato’s parlance, a flower is said to partake of the form of beauty. It’s beautiful, but we never see true beauty. The flower is said to be a particular that inherits its qualities from the forms, one of which is beauty.

The form of true beauty is constant and unchanging, whereas a flower may possess beauty for a while, but ultimately looses it when it withers and dies. Being abstract, forms exist independently of the particulars or real world objects that inherit their qualities.

Heavy stuff at the best of times, let alone for over two millennia ago.

Computer Programming

The Traditional Approach

Computer programs are essentially a list of instructions to be followed in a pre described order by a computer; do A, then do B etc.. A bit like following a cooking recipe step by step.

As computers became more advanced, their associated software programmes also became much longer and quite cumbersome. Quite often, a computer would need to run the same bit of code again and again. So, rather than rewrite this bit of code every time it was required, functions or procedures were written as semi-isolated pieces of code that could be called upon whenever they were required. This helped software develop in a modular fashion, with individual modules being responsible for certain computational procedures.

Object Orientated Programming

Object Orientated Programming took modules to the next level, with the modules becoming self contained pieces of code called classes.

A class is a piece of computer program that serves as a template for the creation of an object in exactly the same way that Plato’s forms were abstract philosophical templates for real world objects. The piece of code, or class, is not the object itself, but like the Platonic form, merely a pattern describing what the object will actually be like and what properties it will have when created. Exactly the same concept as Plato’s, just transposed to a different discipline and separated by 2,500 years!

Similar to Plato’s hierarchical system of forms, these classes or templates can be enhanced. Expanded classes can be created, inheriting all the properties of the parent class, but enhancing it with additional properties to create a new “child” class containing all of it’s parents properties, plus a load more of its own:

1:// Our template or perfect form of a chair

2:class Chair

3: {

4:// bits of code to define the chair goes in here

5: }

6:

7:

8:// New template for a type of chair inheriting properties from the perfect chair form

9:class OfficeChair extends Chair

10: {

11:// bits of EXTRA code for the office chair goes in here

12: }

13:

14:

15:// Create an actual object, or particular of the office chair

16: $objMyOfficeChair = new OfficeChair();

17:

18:// Create an another object, or particular of the office chair

19: $objMyOtherOfficeChair = new OfficeChair();

This is an extremely simplified example, but hopefully the concept of classes and objects and their associated analogies to the Platonic forms and particulars can be seen.

Nothing is New

So, whilst we may think that we’re the cleverest generation to walk on the face of this planet, it may be worth pausing a while to reflect an try to gain a little humility, as we may often just be taking a new slant on old ideas.

Even the bible, in Ecclesiastes 1:9-10, recognises this:

Nothing is new under the sun. Even the thing of which we say, “See, this is new!” has already existed in the ages that preceded us.

Great scientists and thinkers of the past have also acknowledged this fact. Even Isaac Newton paid homage to the inspiration of his predecessors:

“If I have seen a little further it is by standing on the shoulders of Giants.”

Seeking Inspiration

If you’re struggling to come up with an answer to an intransigent problem, or want to find a new way of doing things, perhaps you could do worse than brushing up on your classical education in search of inspiration.

By studying history, even in different disciplines to your own, you may come across ideas that could transpose into your own field of expertise and take you in directions that you would never have dreamed of. They even have a name for the process, they call it the cross fertilisation of ideas.

So, next time you’re a little stuck with a problem, where will you turn to for your inspiration? Plato, Aristotle…

Share this Page!

Subscribe to Get the Latest Posts

Comments

Thanks for the article. I like the comparison between Plato’s philosophical concepts and OOP and I think you do a good job for an introduction to object-oriented programming. However, if I were to attribute OOP concepts to a philosopher I would choose Plato’s student Aristotle for his ideas of the universal (classes) and particulars (objects) and for his classification of living things.

Thanks Benjamin. It was quite difficult to get such concepts over in a short article. Regarding Plato vs Aristotle, you could argue that the outline ideas were proposed by Plato and then expanded by Aaristotle. Either way, it was a very long time ago.

Awesome ,
Couple of weeks before I started going to classes for OOP , I was reading about Plato and his theory of forms.
And right before , there where lot’s of people saying that OOP is not that easy to understand , and most of them sad I wont be able to understand (Just because they did’t).
And while I was in the middle of the class , I though to my self , ( isn’t this the same shit I was reading days before ? )
And there it was , one very simple and yet so powerful and elegant concept of OOP.

yes , I though I’m the only one that have spotted the connection , until I saw this post.
And I’ve been talking with a lot of colleges , and the result always is NO ONE knows that.
And the reason is quite obvious , programmers don’t give a shit about philosophy and vice versa (most of the time).

Does this apply to class-less languages like JavaScript? I suppose Aristotle’s rebuttal to Plato would more aptly describe these types of languages because every instance of a form has to be a particular to exist, and behold, the prototypical language with first class functions was born…

Hi Richard,
Few weeks ago i was reading about Plato’s Theory of Forms, and the idea of this article came to my mind.
I was so fascinated by the link between OOP and Plato’s Theory that i wanted to write an article about it.
While doing my research i saw this article, and it really shocked me how you have written exactly what i was planning to write !
I would be very happy to contact with you. Maybe we have more shared ideas that we can exchange, and who knows, maybe we can work together on larger projects 🙂

I found this article because of google search if anyone already wrote about the connection between OOP and Plato and Aristotle. I am new to programming and learning JavaScript right now. Today I saw that every time you create an object the prototype for object is there and some properties and methods are already available. I immediately thought of Plato and Aristotle and actually thought that it is where computer science took the idea from)))).

Trackbacks

[…] of Object Oriented design is that it is reheated Platonism. See, e.g., blogs by Vlad Tarko and Richard Farrar. ((Should the frequent light analogical treatment of Platonism and software sound a note of alarm […]