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…
Benjamin commented
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.
Richard commented
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 Aristotle. Either way, it was a very long time ago.
Autism App commented
I really love programming. but i think it is a quit hard to learn.
bilgisayar servisi commented
That’s a mold-beraekr. Great thinking!
Antagonist commented
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.
Richard Farrar commented
Very true, although I’m sure most computer programmers aren’t aware of the connection.
Antagonist commented
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).
Richard Farrar commented
Indeed, programmers are not typically well read in the classics 🙂
Structured Programmer commented
Godamn Plato! What have you done?
Blaize commented
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…
Richard Farrar commented
Having a degree in Computer Science and another in Philosophy I suppose you’re ideally placed to appreciate the Platonic link with OOP 🙂
Khaled Badeechi commented
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 🙂
Richard Farrar commented
Hi Khaled,
Thanks very much for stopping by my website and taking the time to leave a comment. Great minds think a like 🙂 It would be good to connect; what sort of stuff do you work on?
Katya Sorok commented
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)))).
Richard Farrar commented
Thanks Katya, I see you made the connection too, although I’m not certain if OOP actually drew on the ideas of the ancient philosophers, but it’s certainly an interesting point.
Good luck with your adventures in programming.
P.S. I like the artwork you have on your blog!
TR Amat commented
I recently came across this article when someone asked about whether Platonic Idealism as connected to OO programming. Nice summary.
I was interested in the follow-up question of what programming practices would result from looking at more modern philosophers, like Wittgenstein, who was in many ways totally opposed to Idealism…
Richard Farrar commented
Hi,
Thanks for comment.
I’m afraid I’m not familiar with Wittgenstein and his philosophies, but it’s always interesting to look into these sort of things, particularly with such a plethora of new languages. Perhaps time for another one exploring a different paradigm? 🙂
npv commented
I am a computer engineer that got interested in western philosophy as a reacquainted myself with the seminal work in the field, i quickly realized Plato was providing an early look at some basic OOP concepts. A quick internet search and you realize others had the same idea, fascinating,
Richard Farrar commented
The similarity is a bit spooky isn’t it, and that was written over 2,000 years ago!
Murat commented
Thank you very much for sharing this with us.
I usually find myself digging into the hierarchy between Human and Presence/Being classes step by step. I can’t think of a parent class for Presence/Being but even I touch that “wall” of mine, it is so relieving and scary at the same time.
Can an object know anything about its class? Can we?
Richard Farrar commented
Hi Murat,
Thanks very much for your comment.
It is a very interesting philosophical topic. When you’re alluding to an object, ergo us, knowing about its class, I think you might be trying to penetrate the “veil of perception” as I believe they refer to it. Theologically you could perhaps say that’s the age old question of trying to know God; perhaps two sides of the same coin?
Abdullah commented
Thank you Richard for keeping this alive , I always thought that human being are trying to mimic something , perhaps going back to something . OOP , instant knowledge , AI etc
Philosophers got the abstract that applied sciences will mimic one day . That’s why they knew that their knowledge is the knowledge and although it’s taking science (applied sciences) a long time but we are going there one day
And as APV and others commented I also always had this kind of thoughts and luckily your article was among the first results !
Richard Farrar commented
Hi Abdullah, Thanks very much for your comment and thoughts on the subject too.