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.
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:
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.”
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…