4 ms·
This misguided blogger thinks that object-based programming is necessarily about members and inheritance. It isn't. It's about message-passing and uniform inter
by BuuQu9hu 9y ago
This misguided blogger thinks that object-based programming is necessarily about members and inheritance. It isn't. It's about message-passing and uniform interfaces and bundles of state and behavior. It's about ravioli code and modules and separation of concerns.
- stabbles 9y agoObject-based programming is not about inheritance by definition.
- kazinator 9y agoThere are "Blub" languages which are such that if you don't use inheritance to connect two record types T1 and T2, either to a common supertype S, or to each other, then T1 and T2 are not substitutable. The users of these languages came up with the term "object based" for that situation in order to try to linguistically connect that to object-oriented programming somehow. In real OOP, we don't have to use inheritance for objects of different types to be substitutable, so "object based" doesn't exist as a separate phenomenon. We use inheritance when two or more things are internally similar, such that they can share a chunk of implementation. If things are similar only externally (API level) but have totally different internals, then we don't use inheritance. OOP is happening when we substitute objects of different types into the same code and they work, regardless of whether those objects are related to each other by inheritance. "Object based" is when we cannot do that. It's basically a new (or not so new any more) term for "abstract data type" which is used when the abstract data type language supports obj.function(arg) syntactic sugar. If we take Wirth's Modula-2 or Pascal exactly as-is (two languages exemplifying abstract data typing support) and then add the "obj.function(arg)" sugar, they suddenly become "object based".
- draw_down 9y agoWell, if you're a fan of functional programming then the "bundles of state and behavior" are... bad.
- BuuQu9hu 9y agoWhat, currying doesn't bundle state and behavior?
- weatherlight 9y agoThen Erlang is the Ultimate OO language, amirite? ... Alan Key, who coined the term "Object Oriented Programing" identified the following his definition of "object oriented": "OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme LateBinding of all things." Alan Key though Java and C++ were abominations. However he may feel, THAT is the state of Object Oriented Programming today. Objects are instances of classes, which typically also determine their type. :/
- BuuQu9hu 9y agoThere's an entire branch of the Smalltalk family with no classes, just prototypes, with Self, Python, JS, etc. and there's another branch without prototypes or classes, with E, Monte, etc. You're not wrong that Erlang and Scheme are just as much about objects and message-passing as they are about actors. Kay may or may not agree with me, but I like to require a facet he mentioned in another discussion once: The uniform calling interface. This is the property of objects that you may send any message to any object. If you require this, then Java and C++ disqualify themselves neatly.