Re: identity...... Was: The wisdom of the object mentors
- From: "Mark Nicholls" <Nicholls.Mark@xxxxxxxxx>
- Date: 6 Jun 2006 05:14:44 -0700
Dmitry A. Kazakov wrote:
On 6 Jun 2006 02:35:34 -0700, Mark Nicholls wrote:
Dmitry A. Kazakov wrote:
On 5 Jun 2006 09:31:54 -0700, Mark Nicholls wrote:
sorry about the delay, got caught up doing other stuff.
Dmitry A. Kazakov wrote:
On 5 Jun 2006 02:20:35 -0700, Mark Nicholls wrote:
I'm not really interested in RM vs OO...to me they are to special
cases...but you have intrigued me with some stuff on identity....which
is something I've only recently managed to mildly formalise in my head.
I've dropped the database cross post, in order not to become involved
in the rather harsh attacks on Mr Martin.
Dmitry A. Kazakov wrote:
On 1 Jun 2006 02:58:43 -0700, Erwin wrote:
Note further that the OO crowd always uses the term with respect to one
single thing ("the identity of an object").
This is not true. As for identity of objects there are many of. For
example, polymorphic objects have the identity of its specific type.
not with this....for me an object has 1 identity.
Can you give me an example.
You are asking difficult questions, Mark!
I would think of identity as a function that returns values from some set,
on which equality "=" is defined:
id : Object -> Identity
This allows you to invent an "equality" on values of Object as
"=" : Object x Object -> Boolean
function "=" (X, Y : Object) return Boolean is
begin
return id (X) = id (Y);
end "=";
how is '=' defined in the space of identities?
Nowise. Identity cannot be reduced to anything else. It ends at "=". You
may not ask how "=" is defined. It is a black box.
OK....so (to you) an identity is an equivance class on a relation '='?
Maybe. But this assumes that you can identify objects in some alternative
way. Which in general is untrue.
Examples:
1. Self-identify. Let values of Object have "=" defined. Then self-identity
is a function that returns the object value.
doesn't this exampe make your definition of '=' self referential?
No. It is just so that identity yields value. If values are comparable then
objects have identity of these values.
2. Referential identity. Let there be a pointer type defined for Object and
the pointers are comparable (and you know some other things about the
language, which are irrelevant here). Then (in C++ notation) "&" that
yields Object pointer is identity.
3. Type identity. typeof (Object) is identity. Note that it is not required
that "different" objects had different identity. For typeof all objects
will have the same. You will not be able to identify them. So typeof is
interesting for polymorphic objects only.
4. Timestamp.
5. Association / Member of. Consider container iterator. I'd say that the
iterator, index, key, etc + the container is an identity of an element in
the container. 2 is a case of 5.
6. Name identity. The language defines some naming for objects and names
are comparable.
Important is that the words "different"/"same" are illegal words. You can
ask if "=" would return true. But that would imply nothing in the language.
It is OOA/D issue to give "=" any meaning. This meaning is beyond the
language in the domain space.
basically to you an objects identity is some mechanism in order to
identify it....externally....i.e. bound up with '=='....
to me identity is some internal mapping from objects to
values.....values being immutable (i.e. of constant
behaviour)....objects not so....i.e. it is part of an encapsulated
construction that implements the specified behaviour.
Isn't it same? OK formally it is only the case 1.
I'm not really worried about '==', and how to identify an object
externally.
There is nothing internally either. Private interfaces are still
interfaces. You might internally have more identities than externally, but
that changes nothing.
To me in C++ terms identity is 'this' (though only to access private
state)
i.e. it is internal
there is a 1:1 mapping between object and identity.
'this' is just a polymorphic pointer.
ahhh....I don't live (conceptually yet) in a world of implementation
inheritance, to me it is simply a mechanism for creating
implementations......so lets leave the polymorphism to one side.
yes it is a pointer......yes its 'value' is unique to the object.
It is a referential identity of a
class instance.
yep
It is even not required to have.
I need a unique mapping to my value...this gives me that mapping.....it
is my identity.
In general case you don't
have 'this', because the class might be unknown.
you need to give me an example....to me the class is always 'known'
You can loose class
identity upon dispatch. You shall loose it if you deal with int, Boolean
etc classes.
you'll have to demonstrate that.
But that is just because I wished to reserve values for the problem space.
problem space is a bit real world for me.
Yes
If we'd lifted that, we could say that anything of 1-6, together is a
value-2. For example, let us take int. It has "=" defined on values-1
(integers). It is also has "=" defined on int* (pointer to int). Then an
int object also has the type int. Then we could say that value-2 of int
object is a tuple (integer x int* x type). For example an int object could
have value-2: (123, 0x000ff02a, int).
? not with this ?
to me you seem to be doing something like showing it's type rather than
it's identity......type to me being sets of propositions that are true
for it.
Does this not include identity? To me it does.
types are defined in the language....that language only includes the
published methods. So the identity of objects in your universe are not
'visible', your universe itself probably has an identity.
I am not disagreeing with what you are saying, just that I wouldn't
call it identity.
Same = "any
possible program in which X is swapped with Y cannot detect any
difference." If you *know* that they are same (God spoke to you (:-)), then
just tell others, i.e. define "=", use same names etc.
Computational inability to distinguish values does not imply anything about
the values. Values and programs live in different worlds. Is there a
difference between red 123 and yellow 123? I don't want the language to
deal with such questions.
not with this, so let me do the obvious.
bool IsRed123(string y)
{
return (y == "red 123");
}
if I pass "red 123" it says true, "yellow 123" false.
What about "reddish 123"? (:-))
Thus I have a program that distinguishes between them....so they are
different.
That program distinguishes strings, it does not colored numbers! Where you
know from that "red 123" denotes red 123?
If I have a language that spans the notion of "colour" and numbers,
then I (naively) should be able to distinguish between them.
I still think I must have missed the point.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- Follow-Ups:
- Re: identity...... Was: The wisdom of the object mentors
- From: Dmitry A. Kazakov
- Re: identity...... Was: The wisdom of the object mentors
- References:
- identity...... Was: The wisdom of the object mentors
- From: Mark Nicholls
- Re: identity...... Was: The wisdom of the object mentors
- From: Dmitry A. Kazakov
- Re: identity...... Was: The wisdom of the object mentors
- From: Mark Nicholls
- Re: identity...... Was: The wisdom of the object mentors
- From: Dmitry A. Kazakov
- Re: identity...... Was: The wisdom of the object mentors
- From: Mark Nicholls
- Re: identity...... Was: The wisdom of the object mentors
- From: Dmitry A. Kazakov
- identity...... Was: The wisdom of the object mentors
- Prev by Date: Re: Difference between Design and Architecture
- Next by Date: Re: identity...... Was: The wisdom of the object mentors
- Previous by thread: Re: identity...... Was: The wisdom of the object mentors
- Next by thread: Re: identity...... Was: The wisdom of the object mentors
- Index(es):
Relevant Pages
|