Even though this article will offend people, I for one like that you are not beating around the bush, are willing to express strong opinions that you believe in, and that this is done in a way that makes you think. You are willing to reason about the bigger picture, and are clearly very intelligent. I think my favorite part was when you talked about the argument that OOP is just another tool in the box and said, “it is as much a tool in a toolbox as horses and cars are both tools for transportation”. This is something that always really bothered by. Whenever there is a discussion about “which is better” the more “reasonable” people say you shouldn’t think about it that way, and that every tool is the best in some situation. While that might technically be true, there are many tools that have become at least mostly outdated, if not something nobody should be using anymore. I’m sure there are at least a few programming languages that are now considered completely outdated, and are only used because there is already code written in them that is in use.
I have not completely bought into the idea that object oriented is a complete mistake that we should be moving away from, but I am open minded to considering it. One problem is I have never had a chance to work for a long time on a professional project written in a purely functional language to really develop a complete opinion. Although I have gone through a few elm tutorials, and have recently been writing some code in Kotlin using a functional style. I also have written functional concepts into object oriented code (in PHP), for convenience sake (like adding a map method to a list like class). Anyway, my point is I am somewhat familiar with and like functional programming concepts, but not enough to make a complete evaluation.
Reasoning from the big picture, conceptual perspective, you might have some missed opportunities for creative thinking that could lead to even more practical ideas. It seems you are somewhat caught up in the “this vs that” mentality. What I mean is, sure object oriented languages have many flaws, but is functional programming necessarily the ultimate thing? Maybe there is something better than either OOP or functional? I mean, lets get really deeply conceptual here for a second. OOP lets you express code as nouns (what something is), or classes/objects. Functional lets you express things as verbs or what something does. Is the concept of expressing code as verbs fundamentally superior to expressing things as nouns? Nothing in this article convinces me of that. You say that verbs should not be forced to be expressed as part of a noun (as methods), but one could flip that and say that nouns should also not be forced to be expressed as part of verbs. Perhaps the problem with OOP languages is not that they express things as nouns, but that they encourage mutable state, and complex abstract hierarchies. Could we not develop an OOP language that both discourages those things, and encourages the use of functional programming? Also, isn’t Kotlin pretty close to being that language? By default classes are closed, preventing inheritance. And even when you do open a class up to inheritance, each individual method is still closed by default. It also makes you label each variable as either mutable or immutable, using either var or val, thereby encouraging you to be more thoughtful about this.
I will try to put my concern with functional programming another way. Do functional languages have their own equivalent to expressing things in terms of nouns, what things are, or something similar to classes? If they do, I would be more willing to consider if they might be superior, but I don’t have an answer to that question yet.
Let me try to explain this one more way. I feel most OO programmers do themselves a lot of harm in how they think about object oriented programming. I am working on a tweak to how we think about OOP, and I call it TOP (type oriented programming). OOP is misnamed, at least with how it is used in most modern OOP languages. You are not really programming in objects, you are programming in classes. So you could almost want to call it class oriented programming. But then we have to ask ourselves, what really is the purpose of a class? In programming, every variable has a type, and this type determines the core attributes of what it can be and and what can be done with it. Strings and integers are on a conceptual level, fundamentally different things. But if a language doesn’t let you define your own types, this is very limiting. All you would have to work with are maybe different kinds of numbers and characters. That is where modern object oriented languages excel. You should think of classes, not as hierarchies of abstractions, but as custom types. Just as an integer has certain operations that can be performed with it that make sense for that type, so do the custom types you can add to the “language” via making your own classes. Methods should not primarily be though of as confusing polymorphic things, but as operations that can be performed with that type. Starting with a noun object variable, and then calling a method of what you are doing with it, is often much more readable and intuitive to reason about, which is why the core types are designed that way in most object oriented languages. You don’t say “/ 10, 2”, you say “10 / 2”. Therefore, I would argue that, despite all of the flaws of object oriented languages, on a deeply conceptual level, they get things right where functional programming gets things wrong. We should be programming in nouns primarily and verbs secondarily.
Many of your arguments against OOP come down to mutable state. But you can easily design most methods to return a new object with the intended change represented in the state of that object rather than actually mutating the internal state of the original object. I think OOP languages should be redesigned to encourage that as the primary way of writing methods.
Perhaps what we really need is a new way to program about types, maybe something completely different from inheritance and polymorphism. It should not only be something that discourages the flaws we see in object oriented programs, and encourages the advantages we see in functional programs, but also helps us think in completely new and useful ways about what things are. Or maybe I just need to learn Idris…