![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've known for quite some time that better minds than mine have gone astray in the attempt to overcome the object relational mismatch. *Just last week, I ran across an article that outlines the O-R mapping problem better thanI ever could. The article is called "The Vietnam of Computer Science", and here's a pointer: http://blogs.tedneward.com/2006/06/2...mputer+Science... The article devotes rather too much time to exploring the analogy between the Vietnam war and ORM attempts. *And as the article admits, all analogies eventually fail. *Leaving that aside, I think the survey of problems encountered in crossing the divide is excellent. I want to draw particular *attention to a heading entitled "Entity Identity Issues". *Reading this section gave me a better understanding of the disconnect between me and Brian Seltzer over matters concerning entity and identity. *My own view of identity is colored by my own experience. *And that experience includes some practical work with relational databases, preceded by a little formal learning in that area and 20 years of work asa programmer. *Unfortunately, none of that work included object oriented programming. Anyway, my view of identity (or of identification, if you prefer) is thatan object's state is all we have to go on as the basis for identification. *In particular, an object's location (as specified by a pointer) or its trajectory (a history of pointers over time) are unavailable for purposesof identification. *This view of identity fits pretty comfortably into the relional model, but it runs afoul of object oriented thinking at least two important ways. *Frst, if an object can conceal part of its state (encapsulation), *then it necessarily can conceal some of what needs tobe known to identify it. *Second, if two objects *are identical in state, then they are the same object, even if they differ in location (at the same point in time). *I'll call this the "Doppelganger effect". |
|
When I see an SQL table with two different rows in one table that cannot be distinguished by their contents, my reaction is that the database designer made a mistake. *Failing in that, the database updaters should have been more careful. *Cases where duplication is intentional and carries significant information strike me as a misuse of SQL, and a misunderstanding of the relational model. The above doesn't pretend to explain Brian's view. * But I think it sheds a little light on why I see things the way I do. Again, I recommend the article cited above. |
#3
| |||
| |||
|
|
Again, I recommend the article cited above. |
#4
| |||
| |||
|
|
On Jul 20, 11:51 am, "Walter Mitty" <wami... (AT) verizon (DOT) net> wrote: I've known for quite some time that better minds than mine have gone astray in the attempt to overcome the object relational mismatch. ... |
#5
| |||
| |||
|
|
First, it doesn't matter if objects can conceal part of their states provided that the references to those objects can be used to distinguish between them, and second, if two objects are identical in state, then they cannot differ in location, for that would constitute a difference in state. |
#6
| |||
| |||
|
|
Anyway, my view of identity (or of identification, if you prefer) is that an object's state is all we have to go on as the basis for identification. In particular, an object's location (as specified by a pointer) or its trajectory (a history of pointers over time) are unavailable for purposes of identification. This view of identity fits pretty comfortably into the relional model, but it runs afoul of object oriented thinking at least two important ways. Frst, if an object can conceal part of its state (encapsulation), then it necessarily can conceal some of what needs to be known to identify it. Second, if two objects are identical in state, then they are the same object, even if they differ in location (at the same point in time). I'll call this the "Doppelganger effect". |
#7
| |||
| |||
|
|
On Jul 20, 11:51 pm, "Walter Mitty" <wami... (AT) verizon (DOT) net> wrote: Anyway, my view of identity (or of identification, if you prefer) is that an object's state is all we have to go on as the basis for identification. In particular, an object's location (as specified by a pointer) or its trajectory (a history of pointers over time) are unavailable for purposes of identification. This view of identity fits pretty comfortably into the relional model, but it runs afoul of object oriented thinking at least two important ways. Frst, if an object can conceal part of its state (encapsulation), then it necessarily can conceal some of what needs to be known to identify it. Second, if two objects are identical in state, then they are the same object, even if they differ in location (at the same point in time). I'll call this the "Doppelganger effect". I find that confusing because it's not clear when you're talking about your view of identity versus the OO one. |
|
In OO, object identity is usually regarded as determined by object location and is independent of object state. That of course is very different to your first sentence above where you say you prefer to use the object's state as the basis for identification. |
|
However in the context of composing complex state machines out of simpler ones it is entirely appropriate to identify state machines independently of their current state. More to the point it wouldn't make sense to do otherwise. For example two stack objects (i.e. simple state machines that support push and pop operations) used for entirely different purposes within a containing state machine may occasionally have the same state. It wouldn't make sense to say there is only one stack object whenever that happens. In fact the containing state machine will normally specify exactly which stack object a given operation is to be performed on. That wouldn't be feasible if object identity was determined by state not location. I find it hard to see how one could define "object" such that object identity is determined by state not location. You appear to be thinking about eternal, abstract mathematical values, but it doesn't make much sense to say that values have state (because that suggests a value can change) or location (as though a value exists in time and space). |
#8
| |||
| |||
|
|
On Jul 21, 1:47 am, Brian <br... (AT) selzer-software (DOT) com> wrote: First, it doesn't matter if objects can conceal part of their states provided that the references to those objects can be used to distinguish between them, and second, if two objects are identical in state, then they cannot differ in location, for that would constitute a difference in state. When you say 'object' do you mean in the OO sense? Usually the OO community use 'object' to mean an identifiable state machine located at some address and don't regard the location to be part of its state. Furthermore usually the identity of an object is determined *only* by its location and has nothing at all to do with its current state. |
#9
| |||||
| |||||
|
|
"David BL" <davi... (AT) iinet (DOT) net.au> wrote in message In OO, object identity is usually regarded as determined by object location and is independent of object state. That of course is very different to your first sentence above where you say you prefer to use the object's state as the basis for identification. Thanks for clearing that up. I should clear up that I'm thinking about storing information about "entities" in an SQL database, and not about storing that information inside objects in an object world. Some database designers attempt to copy the OO paradigm and try to assign each object (what I refer to as an "entity") an OID. The OID is usually the first column in its table, and is generally the primary key. Foreign key references to an OID are generally used just as if they were pointers in a world that's based on pointers. |
|
I had understood that an object's identity was independent of its state, but had failed to appreciate that an object's identity was determined by its location and nothing else. Your response helps in that regard. That could make defragmenting an object space into a royal pain. You have to locate and update all the pointers, or else you invalidate the pointers you don't update. You can build a garbage collector that doesn't defragment, but I don't like where that road leads very much. |
|
However in the context of composing complex state machines out of simpler ones it is entirely appropriate to identify state machines independently of their current state. More to the point it wouldn't make sense to do otherwise. For example two stack objects (i.e. simple state machines that support push and pop operations) used for entirely different purposes within a containing state machine may occasionally have the same state. It wouldn't make sense to say there is only one stack object whenever that happens. In fact the containing state machine will normally specify exactly which stack object a given operation is to be performed on. That wouldn't be feasible if object identity was determined by state not location. I find it hard to see how one could define "object" such that object identity is determined by state not location. You appear to be thinking about eternal, abstract mathematical values, but it doesn't make much sense to say that values have state (because that suggests a value can change) or location (as though a value exists in time and space). Other people in other discussions have elaborated at great length about the distinction between a value and a variable. A location, in the sense that you and I are using that word, is a location in memory. |
|
The contents of memory are variable. At the moment of retrieval, the contents provide a value. |
|
I don';t think it matters whether the memory space is in RAM or on disk. And the address provided by apointer can go through one or more mapping operations before finally resolving down to a physical address. |
#10
| |||
| |||
|
|
I have no idea why an OO programmer would want to pretend that employees, companies, departments, teachers or courses are state machines running on their computer! It's a ridiculous suggestion. |
![]() |
| Thread Tools | |
| Display Modes | |
| |