4 ms·
I disagree. Encapsulation is the only universal property of object oriented abstraction (see Will Cook's papers on OO vs ADTs). Identity is merely a property o
by naasking 10y ago
I disagree. Encapsulation is the only universal property of object oriented abstraction (see Will Cook's papers on OO vs ADTs).
Identity is merely a property of some objects, not all objects.
- ratmice 10y agoI don't really agree as well, Modula-3 (although i'm not terribly familiar with the language) has partial revelation (a rather nuanced form of encapsulation), and branding where structural transparency does not preclude nominal identity... I tend to view the whole thing as a false dichotomy.
- naasking 10y agoI'm not sure what you're disagreeing with specifically. "Partial revelation" sounds like a feature of ADTs they mixed into objects, which all modern OO languages have done, so I'm not sure what you think is the relevance to objects specifically.
- ratmice 10y agoI was kind of disagreeing with 2 things: that encapsulation must be all encompassing, and that identity is not meaningful or useful for transparent immutable data...
- naasking 10y ago> that encapsulation must be all encompassing If we're trying to characterize "objects" in its purest sense, it must have some all-encompassing property. Mixing in other properties for pragmatic reasons doesn't seem relevant here. > that identity is not meaningful or useful for transparent immutable data No one claimed it wasn't useful, simply that it's not necessary to have objects.
- ratmice 10y ago>No one claimed it wasn't useful, simply that it's not necessary to have objects. "Immutable data structures necessarily don't have identity (well, to say identity isn't meaningful because aliases can simply be seen as copies)." I read saying that it is necessariy for them not to have identity, and that giving them identity isn't useful or meaningful. If it said "don't necessarily" instead of necessarily don't, I would agree
- seanmcdirmid 10y agoMy point here was whether they had identities or not wasn't meaningful, since they are (well, should be) purely judged by their value. I didn't make any value judgements about the usefulness of immutable data structures.
- ratmice 10y agoExactly what I thought you were saying, and disagree with. I consider it fine to say "Objects require identity", without identity a fully encapsulated object is nothing more than an anonymous black hole. When you turn this around to "Only objects require identity", or "identity is not meaningful for data", a hash code is one example of data which could benefit from identity, since you do not want to mix hash codes made by different hash functions. The positive integers 0,1,2... differentiated between the set of nonnegative integers are another simple to preclude identity from data, is to preclude the ability to differentiate these on anything but the value level. surely a simplification, but by no means necessary.
- seanmcdirmid 10y agoHash functions on values don't depend on identity and collisions are accepted as part of hash's definition. A GUID (and MD 5 hashes) for all practical purposes are identities. Identities really mess up equational reasoning which is why they are basically missing from pure functional languages like Haskell. A lot of clever solutions like FRP involve solving what are otherwise straightforward problems without resorting to the use of identity.
- seanmcdirmid 10y agoI disagree with that and that particular paper. We must think of objects from a design perspective, not a technical one, and the one thing that distinguishes objects is their ability to be "things" rather than just constructs. 42 is not an object because the value can reproduced easily. John Smith, on the other hand, is not just a value, but has a name and an identity, is not exactly the same person everyday, and so on. 42 can be used in equational reasoning (it never lies) while John Smith cannot. John Smith, on the other hand, can be attributed with semi-autonomous behavior while such notion isn't meaningful for 42.
- naasking 10y ago> We must think of objects from a design perspective, not a technical one Why? Why should objects exclusively get this distinction when every other programming language paradigm is analyzed technically? > 42 is not an object because the value can reproduced easily. So? What's the point of making "object" synonymous with "identity" when we already have the term "identity" to designate the relevant property? Survey a bunch of programmers and ask if they agree with the phrase "objects respond to messages, and the only way to interact with an object is to send it messages". I'd wager a majority would agree with this statement. Which means procedural abstraction/encapsulation, wherein no details about object internals can leak to clients, is the only meaningful property of objects. 42 can then take on many representations, as long as they all respond to the same messages.
- seanmcdirmid 10y ago> Why? Why should objects exclusively get this distinction when every other programming language paradigm is analyzed technically? Who is analyzing? I definitely don't analyze other paradigms technically. You should know me better than that. I'd rather all paradigms be analyzed based on how they are used to write programs and how they influence program designs. The technical details are just details. > What's the point of making "object" synonymous with "identity" when we already have the term "identity" to designate the relevant property? Again, it is how you design your programs: are you relying heavily on equational reasoning, or have you divided things into a bunch of nouns with behavior. > "objects respond to messages, and the only way to interact with an object is to send it messages". They might indeed, but it is a vacuous statement to begin with. It is extremely sad how little design is considered in programming languages. That an entire paradigm could be boiled down to such a true but useless statement.