The platonic trap of Object Oriented Programming
How did the programming industry reach the current state of low-quality software? There were three forks in the road where we took the wrong turn in terms of programming practice that I can identify and articulate are:
- Mistaking the map for the territory
- Missing the forest for the trees
- Focusing on the fermionic stuff rather than the bosonic These three are not separate, just different lenses to view the same thing.
Mistaking the map for the territory
Object Oriented Programming as it exists today is a perfect example taking the wrong side of those two forks in the road. Let's go through some history, to understand how we got here, and where we should have gone instead. OOP as a term was coined by Alan Kay.
OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them. --- Alan Kay
He later regretted calling it object oriented programming later, but the damage was already done.
I'm sorry that I long ago coined the term "objects" for this topic because it gets many people to focus on the lesser idea. The big idea is "messaging" -- that is what the kernel of Smalltalk/Squeak is all about (and it's something that was never quite completed in our Xerox PARC phase). The Japanese have a small word -- ma -- for "that which is in between" -- perhaps the nearest English equivalent is "interstitial". The key in making great and growable systems is much more to design how its modules communicate rather than what their internal properties and behaviors should be. --- Alan Kay: prototypes vs classes was: Re: Sun's HotSpot
What followed is a great example of cargo culting 1: People who had no real understanding of the deep ideas that Alan Kay was trying to express 2, just took the shallow surface meaning that was in the name, went with Objects as the main idea and turned up the bullshit generator to 11, that is how we got things like: 4 pillars of OOP, SOLID, OOP Design Patterns, etc... One of these people was Grady Booch, listen to this answer where he is asked what the Booch method is
Well, let's go back to Plato, ... there is this wonderful treatise he wrote, a dialogue in which there is a debate about how one should best look at the world, should I look at it as atoms, or should I look at it as processes? Well the first golden age of software engineering was more focused on processes, the algorithms, but there is a parallel way of looking at the world, and that is looking at through, if you will, the classes and objects within them, so yes I was influences by abstract data type theory, by Plato, ...... So in short, the Booch method was, lets look at the world not through algorithms, but through objects and classes ... --- Evolution of software architecture with the co-creator of UML (Grady Booch)
Now, compare that to what Alan Kay said here:
I think our confusion with objects is the problem that in our Western culture, we have a language that has very hard nouns and verbs in it. Our process words stink. It's much easier for us when we think of an object—and I have apologized profusely over the last twenty years for making up the term object-oriented, because as soon as it started to be misapplied, I realized that I should have used a much more process-oriented term for it. The Japanese have an interesting word, which is called “ma”, which spelled in English is M-A, “ma”. And “ma” is the stuff in between what we call objects. It’s the stuff we don’t see, because we’re focused on the noun-ness of things, rather than the process-ness of things, whereas Japanese has a more process/feel-oriented way of looking at how things relate to each other. You can always tell that by looking at the size of a word it takes to express something that is important. So “ma” is very short. We have to use words like “interstitial”, or worse, to approximate what the Japanese are talking about. -- Alan Kay - The computer revolution hasn't happened yet
Alan Kay says that the focus should have been on the process-ness of things, instead of the noun-ness. The OOP cargo-cultists focused on the noun-ness. The lesser idea of objects spread like wildfire through the industry and academia, but the correction unfortunately did not.
One of the examples in Platos theory of forms is color. The noun, or object: color is a map, not the territory. The territory is the process of light coming into our eyes, and the signal getting processes by our brains to get a color. The object: color is a subjective model that is overfitted to a context, and it changes based on the environment (lighting), and based on the subject, different people see different colors based on the same signal (color blindness), different animals see different wavelengths of light. Objects being constructed by perceivers is an important concept in second order cybernetics3, it was also introduced in perceptual psychology as an "affordance". Objects are a horrible way to model the world, because they don't model reality, they model viewpoints of reality, that are overfitted to certain contexts, they "encapsulate" the context, and the more you discover of reality, the more your models have to change.
Missing the forest for the trees
This time Alan Kay also took the wrong turn here, as he focused on the components instead of the whole:
OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them. --- Alan Kay
The problem I have here is with encapsulation, I write about why encapsulation is a bad idea in Abstraction in programming. I speculate that his background in biology made him focus too much on cells, and molecules (the objects) instead of what made an organism a whole. Alan Kay focused too much on ecological systems, where the properties emerge from components interacting. But most programs have a purpose or a function that it should serve, emergent properties are bugs. Ecological systems, like objects sending messages to each other that is how you get the function of the system are not a good model for this what most programmers want from computer systems.
Focusing on the fermionic rather than the bosonic
In my opinion the mistake that Alan Kay made was focusing too much on the fermionic stuff (cells, objects), and trying to eliminate the bosonic stuff(bioelectric pattern, data, information).
- I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning -- it took a while to see how to do messaging in a programming language efficiently enough to be useful).
- I wanted to get rid of data. The B5000 almost did this via its almost unbelievable HW architecture. I realized that the cell/whole-computer metaphor would get rid of data, and that "<-" would be just another message token (it took me quite a while to think this out because I really thought of all these symbols as names for functions and procedures. --- Dr. Alan Kay on the Meaning of “Object-Oriented Programming”
Had he had access to Dr. Michael Levins research, things might have turned out differently. What does Dr. Michael Levins research have to do with this? Well, the tldr; version is that they actually found the software of living things. I highly recommend watching this video if you want to get your mind blown. We wrongly believed that DNA is the software, but it is not, it something that gives rise to the preinstalled software. But the actually software is the bioelectrical communication pattern between the cells. If we want to get inspiration from nature this is what we should focus on, not the cells themselves, this bioelectric communication pattern is what turns a collection of individual cells into a whole organism. As I talked about in Two ways to create a system, the reason the first approach works is that they have shared information, a living organism grows from one cell
By cargo culting I mean only taking the surface meaning of an idea, without understanding the deep ideas under it.↩
Expressed badly in my opinion, calling what Alan Kay was talking about Object Oriented, is like creating a door that can only be opened by pulling, and putting a push only handle on it with a large sign that says "PUSH".↩