Seriously, though - seeing how most adult programmers do OO poorly ...
Seriously, though - seeing how most adult programmers do OO poorly ...
How does a paradigm like that survive? I might be a fan of functional, but I'm not even saying go that way- stay procedural! Learn your abstractions over time and only build them when necessary.
Also, while one can do composition about as easily as inheritance, it still has its warts in languages like C++. If you want to unit test code, it's recommended to use dependency inversion instead of regular composition - there are other good reasons to do DI as well. But when you start coding the same stuff in non-OO paradigms, you realize that it's just much easier - stuff like DI was popularized to get around the flaws of the OO implementation in those languages. The same goes for most OO design patterns.
suggest how this may be fixed
> and requires a list of caveats so large that it effectively draws down to "only use it in these specific places"?
I don't recognise this, can you explain please
Only allow composition. Allow composition techniques to add state, detect the presence of other composition types, etc.
I wonder when our institutional/civilizational memory of this will fade entirely with childhood vaccination...
Python: Sure, everything is an object, but you don't need to know much about OO to use them. I program in Python professionally, and rarely do I write classes (unless I'm using a framework like Django that requires them). Also, if your language doesn't support data encapsulation, can you even call it OO?
JS: Wasn't OO a later addition to the language? You can get a huge amount done in JS without classes, and that isn't considered poor JS. The general push in JS is to go more functional, not more OO.
C++ is just C with an overly complex OO appended to it. Again, you can write fantastic code in it without relying on OO directly.
The web DOM is object oriented. But sure, in these languages you don't have to write your own classes and methods, use inheritance, etc. But plenty of code has used it, and somebody is maintaining, using or extending that code.
Of course good stuff has been written in OOP. I personally like that Django uses OOP - it's a good fit. Doing it well is not easy, though. And many problems are easier solved without it.
> JS is a prototypal language, classes are just sugar on top of the prototypes.
Is OOP now a vague term, akin to "functional programming"?
I still maintain that not having data encapsulation (i.e. Python) means it's not OO. (Not that I particularly want it to, either).