6 ms·
A bunch of these objections are incorrect, or at a minimum apply only to certain implementations of OOP (both from an organizational and linguistic perspective)
by asdfasgasdgasdg 6y ago
A bunch of these objections are incorrect, or at a minimum apply only to certain implementations of OOP (both from an organizational and linguistic perspective).
"Everything has to be an object" is only true in some languages, and even then it's a questionable claim. If I have a Java class that has public data members only, how is that materially different from a data structure?
"Data type definitions are spread out all over the place" Again, a questionable assertion. It's plenty easy to define all your data types in one package or header file in Java or C++. Some folks choose not to organize it that way, but that's a different and substantially weaker objection.
"Objects have private state" Unless you want all parts of your system to be able to depend on the internal state of all other parts of your system, some kind of state access control is going to be necessary. I'm not aware of any system, OOP or not, where the internal details of, e.g., the Mutex datatype are available for inspection. This is private state by a different name.
"Why was OO popular?" I have a simpler explanation. For many years, the most performant unmanaged language with something even close to resembling a strong or useful type system was primarily an OO language (C++). There were no close competitors. And the fastest managed language was also an OO language (Java). I also deny the proposition that OO is materially harder to learn than other paradigms, supposing you want to learn in those other paradigms how to do the sorts of things that come built-in in OO languages.