3 ms·
> it is common because academia loves OOP. Absolutely not! I doubt that anybody was ever taught OOP in an academic PL course, unless it was really an "introduc
by fmap 8y ago
> it is common because academia loves OOP.
Absolutely not! I doubt that anybody was ever taught OOP in an academic PL course, unless it was really an "introduction to programming" course, or their professor was working on this topic at the moment. The meaning of a program in an object oriented language with imperative features and inheritance is not pretty.
There are aspects of object oriented programming that are useful for structuring programs (hidden state) and others which are a recipe for disaster (recursive types). This complexity is always swept under the carpet when teaching OOP. Classes/inheritance/objects are always taught via imperfect analogies, which should tell you everything you need to know about how "easy" OOP really is.
No, the reason it is taught so widely is purely practical. It's a popular paradigm and a lot of practical programming projects might need an OOP background.
---
Edit:
Just to be clear, I'm not trying to say that OOP is bad per se.
The information hiding and namespacing aspects of objects are really useful, both in theory and in practice. It's just that I think that implementation inheritance is an imperfect way of facilitating code reuse and not something you should teach to new students...
- scarface74 8y agoThe information hiding and namespacing aspects of objects are really useful, both in theory and in practice. It's just that I think that implementation inheritance is an imperfect way of facilitating code reuse and not something you should teach to new students... And most professionals agree with you. “Prefer aggregation over inheritance.” Which by the way Resharper makes really easy. You add a private variable to your class of the type you want to aggregate and it creates wrapper methods in your aggregating class that just calls your other class.
- brians 8y agoIt’s in SICP, leading up to the adventure game project. That dominated intro-PL conversations for a long time. Also, it’s OO with delegation-based inheritance, prototypes—and some discussion of why.