I’ve recently come to discover there’s actually a strong amount of criticism towards what people refer to as “modern OOP” – often comparing it to either functional programming or Alan Kays’ OOP.
Here’s the question which got me thinking: https://stackoverflow.com/questions/2409494/some-solid-oop-criticism
Wikipedia has a section about OOP criticism: http://en.wikipedia.org/wiki/Object-oriented_programming#Criticism
Coming from a computer engineering university degree, I did my fare share of programming and development classes. I’ve done Java and C++ in school as well as NodeJS, Python, Perl and PHP on my own time. In all of these languages (except for maybe Python), I either implemented some OOP or used libraries which did.
So what’s the big deal against modern OOP (or OOP in general)? Why do so many people seemingly dislike and dismiss it?
6
First off, “modern OOP” is not a deviation from Alan Kay’s OOP. Kay may have coined the term itself, but Smalltalk-style “OOP” is a significant deviation from actual class-and-object programming as it existed before Smalltalk. The original OOP system was called Simula, and it was an extended dialect of of ALGOL whose OOP concepts would feel right at home in modern languages such as Delphi, Java or C#. The Smalltalk style is the aberration, and it’s been a failure everywhere it’s been tried. (With the minor exception of Objective-C, whose popularity is due in its entirety to Apple shoving it down iOS developers’ throats; outside of the Apple ecosystem its market share is essentially nil.)
As for the question, the biggest reason why many people criticize it is simple, old-fashioned “sour grapes.” Looking at the linked Wikipedia article, the critics it names are hardly objective: one is one of the principal guys behind ML, the other is the principal guy behind Erlang, both of which are languages that have failed in the “marketplace of ideas” while OOP has taken over the world.
Luca Cardelli has claimed that OOP code is “intrinsically less efficient” than procedural code, that OOP can take longer to compile, and that OOP languages have “extremely poor modularity properties with respect to class extension and modification”, and tend to be extremely complex.
Intrinsically less efficient
? Maybe, but it’s also far more powerful. The main intrinsic inefficiency comes from polymorphism: virtual dispatch requires more CPU cycles and is cache inefficient, but it can achieve some incredibly useful abstractions in return for this engineering tradeoff. And I doubt that anyone trying to achieve the same thing in a procedural language without language-level support could do it in any way that turns out to be noticeably more efficient, so that’s kind of a silly complaint.
that OOP can take longer to compile
? Ha! Try telling that to a Delphi developer. It can literally compile code faster than the hard drive can serve it up.
that OOP languages have "extremely poor modularity properties"
? Try telling that to any Delphi, Java or .NET developer who uses the rich ecosystem of modular code that’s been built up over the years on a daily basis. This is simply not true.
tend to be extremely complex
? Well sure; they’re solving complex problems. You can’t make essential complexity disappear; you can add abstraction and sweep it under the rug, but that will come back to bite you at some point, guaranteed.
Bottom line: if OOP didn’t work well, it wouldn’t work well. And then no one would be using it because it just doesn’t work. But a simple glance at the reality of the programming world puts the lie to that concept.
14