Objects are not ADTs (*) [editor's note: Links to "On Understanding Data Abstraction, Revisited" - Cook]. (So in C# String and Int32 are not ADTs.)
With that out of the way, an abstract data type "has a public name, a hidden representation, and operations to create, combine and observe values of the abstraction". (Quoting from the linked paper.)
(*) Briefly, Cook explains that:
Objects cannot inspect the hidden representation of other objects, unlike members of an ADT. That implies that values of an ADT may be
implemented efficiently, even for operations that require inspection
of multiple abstract values.
Objects behave like a characteristic function over the values of a type, rather than as an algebra. Objects use procedural abstraction rather than type abstraction
- ADTs usually have a unique implementation in a program. When one's language has modules, it's possible to have multiple implementations of an ADT, but they can't usually interoperate.
My problem is with the second bullet point.I think that in the paper linked, it just happens to be the case that for the specific example of a set used in Cook's paper, an object can be viewed as a characteristic function. I don't think that objects, in general can be viewed as characteristic functions.
Also, in the paper Aldritch (The power of interoperability: Why objects are inevitable) suggests
Cook’s definition essentially identifies dynamic dispatch as the most important characteristic of object
agreeing with this and with Alan Kay when he said
OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.
However, in these set of lecture slides it suggests that Java classes are ADTs while Java interfaces are objects - and indeed using interfaces "objects" can inter-operate (one of the key features of OOP as given in one of the bullet points above).
My questions are
Am I correct to say that characteristic functions are not a key feature of objects and that Frank Shearar is mistaken
Are data that talk to each other through Java interfaces examples of objects even though they don't use dynamic dispatch? Why? (my understanding is that dynamic dispatch is more flexible, and that interfaces are a step towards objective-C/smalltalk/erlang style messaging)
Is the idea of dependency inversion principle related to the distinction between ADTs and objects? (see the wikipedia page or google "The Talking Objects: A Tale About Message-Oriented Programming". Although I'm new to the concept, I understand that it involves adding interfaces between "layers" of a program (see wikipedia page diagram)
Please provide any other examples/clarifications of the distinction between objects and ADTs, if you want.