e.g., what things have identity: objects, or interfaces?
OODBTG Reference Model
Each object has a unique, immutable "identity" which providesa means to denote or refer to the object independent of its state or behavior.The definition of identity includes the concepts of identity compare operation,logical identifiers, object identifiers, and object creation.
The identity concept can be described in terms of a primitive "identitycompare operation" "==" such that, if X and Y are the sameobject, X == Y. Some consequences of identity compare are:
o h(X) and h(Y) have the same result for any operation h(), where
h() has no "side effects" (i.e., h() is not a state-changingmethod), and
o the mathematical set {X, Y} has cardinality 1.
An abstract representation of object identity is by means of a "logicalidentifier" ("LID"), which is an implementation-free tokenthat is uniquely associated with a specific object. The term "objectidentifier" ("OID") refers to a specific implementationof a logical identifier. OIDs are normally system-generated, with a fixedformat, and are not changeable by the user. In models which consider literalsor extensional sets to be objects, such objects have LIDs but possiblynot OIDs.
An LID is meaningful within some limited scope which we shall call an"object space". Object creation occurs within an object space.Each creation event results in a LID that identifies the created objectuniquely within that space. The creation event creates a representationof the object in the space.
An LID is unique within a particular object space. If X and Y are objectswithin an object space, X == Y if X and Y have the same LID. In many implementations,simple comparison of OID and literal representations is used as the basisfor "==". An LID from one object space is not a valid LID inanother object space. Identity comparison between LIDs only makes sensewhen they are defined in the same object space. Object identifiers arehandled differently in different systems when objects are exported, imported,replicated, versioned, or distributed.
OMG Core Object Model
4.2.2 Object Identity and Object Identifiers
Each object has a unique identity that is distinct from and independentof any of its characteristics. Characteristics can vary over time whereasidentity is constant.
In the Core Model, each object has an identifier that providesa means to denote or refer to the object. This identifier is called anOID3. OIDs label (or refer to) objects.The set of all OIDs is denoted as Obj.
The Core Object Model does not require systems to support a comparisonoperation for OIDs. In other words, you may not be able to ask if two OIDsrefer to the same object. However, if two OIDs, A and B, refer to the sameobject, then invoking an operation with A as an argument is the same asinvoking that operation with B in place of A.
The implementation of OIDs is not within the realm of the Object Model.The Object Model does not specify if OIDs are fixed length or varying insize. For example, there is no assumption that OIDs are 32, 64, or 128-bitstrings. Furthermore, the Model does not care about the internal structureof an OID. For example, it does not state that the location of the objectis encoded within an OID in some way known to the system or its users.OIDs are opaque as far as the Object Model is concerned.
3 OIDs in the Object Model denote the same conceptas object references in CORBA.
OMG CORBA IDL
An object reference is used to refer to a CORBA object. While the objectreference itself can be duplicated there are no operations supporting copyingor comparing CORBA object implementations. This is outside the scope ofthe CORBA specification.
ODMG
All denotable objects have an identity. For literals this identity is"typically the bit pattern that encodes its value". For objects,identity "uniquely distinguishes the object from all other objectswithin the domain in which the object was created" and is independentof any state of the object.
Operation Equal? is defined for type Denotable_Object.
In order to copy objects, copy operations must be defined as part ofthe object's type. For Collection object types, the copy operation is ashallow copy - returning a new collection with the same elements as thecopied collection. For object type Structure, the copy operation is alsoa shallow copy.
Literals are copied by assignment. "Assignment of an object oftype Structured_Literal, or any of its subtypes, to another object willcreate a (logical) copy of the literal" (p.36).
EXPRESS
The specification of an entity data type in the EXPRESS language describesa domain. The individual members of the domain are assumed to be distinguishedby some associated identifier which is unique. EXPRESS does not specifythe content or representation of these identifiers. [ISO DIS-10303:11]
The language supports two notions of equality, identity equality anddeep equality. Most operations in the language make use of the latter ratherthan the former. For example, set uniqueness is based on deep [un]equality,and assignment and parameter binding are based on deep copying. It is likelythat future versions of EXPRESS will provide more operations based on identity.
Instances of the primitive data types and of the aggregate data typesdo not have identifiers.
Open Distributed Processing
The RM-ODP Descriptive model recognizes the notion of identity (andall naming actions in general) only relative to a given naming context.A naming context is defined as a relation between a set of names and aset of entities, whereby the set of names belongs to a single name space.An identifier is defined as an unambiguous name of an entity in such acontext.
As an object is a model of an entity, and an object is distinct fromany other object, it follows that every object has a unique identity (theidentity of a naming context and of the object within that context). Althoughnaming is explicitly defined only for entities, RM-ODP refers in additionto action identities [it may also be possible to consider an action asan entity because an action is a thing of interest, and an entity is definedas any concrete or abstract thing of interest]. As an interface is a setof (inter)actions, it has an identity; there exists also a reference inRM-ODP to a unique interface. As behavior is a collection of actions, italso has an identity.
Establishing object equality by comparing their properties (e.g., behaviors)is possible only at some abstraction level whereby details irrelevant forthis level are suppressed.
Management Information Model
The process of defining managed object classes requires the assignmentof globally unique identifiers, known as object identifiers, to variousaspects of the managed object class, such as managed object class name,attribute types, etc. The values of these identifiers are used in managementprotocols to uniquely identify aspects of managed objects and their associatedattributes, operations, and notifications. It is therefore a necessaryprecursor to the development of a managed object class definition thatthe standards body or organization concerned should identify or establisha suitable registration mechanism that is capable of issuing object identifiervalues for its use...Once an item of management information has been assignedan object identifier value, it is a requirement that any revision of thedefinition of that item shall not alter the semantics of the information...Allobject identifier values registered in systems management Recommendations/Standardsare allocated under the arc (joint-iso-ccitt ms(9))
[Part 4]
A managed object of one class can contain managed objects of the sameor different classes. This relationship is called containment. This containmentrelationship is a relationship between managed object instances, not classes.A managed object is contained within one and only one containing managedobject. Containing managed objects may themselves be contained in anothermanaged object...The containment relationship is used for naming managedobjects. Names are designed to be unambiguous in a specified context; formanagement this context is determined by the containing object... The nameof an object that is unambiguous in a local naming context, may not beso in some larger naming context... The top level of the naming tree isreferred to as root which is a null object (i.e., an object with no associatedproperties) that always exists....Supported name bindings are not a propertyof the object class as a whole, and individual instances of the same objectclass may use different name bindings. ...Each managed object class thatcan be instantiated must include at least one attribute suitable for ...unambiguouslyidentifying a single managed object within the scope of its superior object...Such an attribute must be part of a mandatory package, it must be testablefor equality and its semantics must permit its value to remain fixed forthe lifetime of each managed object that uses it for naming. When a managedobject is deleted, the value assigned to its naming attribute becomes availablefor reuse, to identify subsequent managed objects created within the samesuperior object. [Part 1]
SQL3
By default, testing corresponding attribute values for equality servesto test for the equality of two ADT instances. Alternatively, the specificationof an ADT supports declaration of a function to be used to determine equalityof two ADT instances.
Two values are said to be not distinct if either: both are the nullvalue, or they compare equal according to [the SQL3] "< comparisonpredicate >". Otherwise they are distinct. Two rows (or partialrows) are distinct if at least one of their pairs of respective valuesis distinct. Otherwise they are not distinct. The result of evaluatingwhether or not two values or two rows are distinct is never unknown.
Matisse
Matisse supports the principle that first class objects are identicalif their OIDs are equal. They are equal if their attributes have the samevalues.
The following caveats apply:
Matisse supports media fault tolerance through object replication acrossmultiple disk drives. In this case, replicated objects are identical.
On the other hand, if the user makes a copy of an object, it will receivea new OID but retain the same attribute values. In this case there is equality,but not identity.
C++
C++ supports both value and reference semantics (and supports both variablesthat "contain" objects, and variables that contain pointers orreferences to objects). In reference semantics, assignment essentiallycopies a pointer (or reference) to the object. In value semantics, assignmentcopies the value itself. In C++, the assignment operator can be used tocopy the object itself, or a reference to the object can be created, andthen copied. (The C++ assignment operator itself can be overridden, butthe default meaning is to copy the object itself). By contrast, Smalltalkeffectively always uses reference semantics for assignment, using alternativeoperations (shallowCopy, deepCopy) for value semantics. [Str92] describesthe implementation of cloning, shallow copy, and deep copy operations inC++ using the basic facilities.
OOCOBOL
OO COBOL defines the concepts of object reference and objectidentifier. In OO COBOL, an object reference is a value thatuniquely identifies an object for the lifetime of the object. No two objectshave the same object reference, and every object has at least one objectreference. Note that it is permitted to have more than one object referencefor any given object, provided the requirements of the specification arefully met, but it is sufficient and in general expected that a given objectwill have precisely one object reference.
In OO COBOL, an object identifier is an identifier (essentiallya data item name) that identifies an object. It may be declared in theData Division as a data item declared with USAGE IS OBJECT REFERENCE, orin the Environment Division. There are also three predefined object identifiers,SELF, SUPER, and NULL. SELF and SUPER both reference the object of thecurrently executing method, and are used in invoking other methods associatedwith that object from within that method. If SUPER is used, method bindingwill ignore all methods defined in the same class as the executing method,and all methods defined in any class which inherits from that method.
The CBL-NULL class is a predefined class. There are no instances ofthis class. The NULL object is the CBL-NULL class object. A reference tothe NULL object is placed in every data item declared with USAGE IS OBJECTREFERENCE when storage for that data item is allocated, except when thatdata item is declared as a redefinition of another data item. Invokingany method on the NULL object causes the exception EC-OO-NULL to be raised.
Object identifiers may be compared for equality or inequality. Two objectidentifiers are equal if the objects referred to by those identifiers arethe same object.
Smalltalk
Smalltalk provides unique identity for all objects. Objects can be testedfor equivalence (Are the objects being compared the same object?) and equality(every object may implement its own definition of equality).
Copying of objects can be performed as a deep copy (object's structureand the objects pointed to by its variables are copied) or shallow copy(objects pointed to by variables, their variables are not copied, but areshared with the original object).
Eiffel
All Eiffel objects are given an immutable, unique identity.
Objects can be copied using the operation `copy' from class ANY. Thisform of copy copies all fields from one object onto another. Both the sourceand target objects must be non void. The copy operation can be redefinedin subclasses to conform to local behavior. There is also a `frozen' versionthat cannot be redefined called `standard_copy'.
A copy can occur in two forms: shallow or deep copy. A shallow copywill copy the objects fields including the current contents of those fields.If the content is a reference to another object, no attempt is made torecursively copy the objects attached to the reference.
A deep copy, on the other, hand will recursively copy the entire objectstructure beginning with the source object. This is performed using theoperation `deep_copy'.
Objects can also be `cloned'. i.e., A clone will return a new objectthat is field by field equivalent to another. For example, the operation:
x := clone (y)
will attach a new object to x that is a clone of y. X, in this case,does not need to be attached to an object before the clone, as in a copyoperation. There is also a deep_clone operation that will recursively clonethe entire object structure of y.
Clone is generally defined in terms of copy and so its definition isfrozen and cannot be redefined.
The field-by-field equality of two objects attached to entities x andy can be determined by the expression:
equal (x, y)
The standard version of this expression (as defined in ANY) has a numberof rules that determine the result [1]:
1. If both x and y are Void then the result is true. If one is Voidand the other is not then the result is false.
2. If both x and y are bit sequences then equality is determined bybit-by-bit equality. Cases 3 to 6 assume x and y are not bit sequences.
3. If y is not the same type as x or a descendant type then the resultis false. Cases 4 to 6 assume y conforms to x.
4. If y is a simple type (character, integer, boolean real, double orpointer) then the result is true if both objects have the same value. Afterpossible coercion of the heavier type.
5. If x and y are special (strings or arrays) then the value is trueif the sequences of values have the same length and each field is (recursively)identical.
6. If x and y have the same fields and each field is identical. i.e.,every corresponding reference field of x and y points to the same objectand every object field of y is recursively equal to the corresponding fieldof x.
There is also a deep_equal that will recursively test the equality ofeach reference field of x and y in case 6.
Emerald
In Emerald, each object has unique identity. The representation of thisidentity depends on the object's implementation (see entry under 9.6other for a description of Emerald's object implementation styles).To support remote referencing and mobility in a distributed system, objectreferences must be location independent. Direct objects are compiledinline or allocated directly in invocation records, and hence can be referencedby offset within the object or data structure. All other objects are referencedby the address of a node-local object descriptor. The object descriptorcontains the object's unique ID, a location hint if the object is remote,and a pointer to its data area, process, and code if the object is locallyresident. An object descriptor must exist on a node as long as any referencesto the corresponding object remain on that node. Object descriptors areheap-allocated and garbage collected.
Each node also has an object table that contains an entry forevery remotely referable object on that node. The object table is usedto determine if an object exists on a node, and if so to provide the addressof its object descriptor. [BHJL86]
Cecil
In Cecil, each object has unique identity.
SELF
Each SELF object has a unique identity which provides a means to referto the object independent of its state or behavior. SELF represents objectreferences using direct tagged pointers, rather than indirectly throughan object table. Cloning (shallow-copying) produces a new object with adistinct identity from its prototype.
System Object Model (SOM)
When a SOM object is created the SOM run-time returns a pointer to theobject. It is left to higher level abstractions which build on SOM to defineobject identity, equality and copy operations.
OLE Component Object Model
Object references (pointers) in Windows Objects are not references tothe object itself, as in C++, but rather are pointers to one of the object'sinterfaces. In fact, there is no specific way to identify a specific object(i.e., it is only possible to obtain references to interfaces, notwhole objects). Given a pointer to an interface, the user can access onlymember functions contained in that interface. The user can never have apointer to the whole object (because there is no direct user-visible conceptof "whole object"), so there is no direct access to data members,and no concept of "friend" as in C++. Through the IUnknowninterface, a user can obtain pointers to other interfaces that the objectalso supports, but this means obtaining a different pointer thatrefers (indirectly) to the same object. Each pointer to an interface pointsto a function table in the object, and each table contains only memberfunctions for a specific interface. Because a pointer to a Windows Objectalways points to a function table, such a pointer can also be used fromwithin programs written in languages other than C++, such as C or assemblycode.
Every interface is associated with an interface identifier, orIID. An IID is a special case of a universally unique identifier,or UUID. The universally unique identifier is also known as the globallyunique identifier, or GUID. GUIDs are 128-bit values created with aDEFINE_GUID macro. Every interface and object class uses a GUID for identification.As described in the OLE SDK, Microsoft will allocate one or more sets of256 GUIDs for a developer's exclusive use on request. Alternatively, auser with a network card can run a tool UUIDGEN.EXE that will provide aset of 256 GUIDs based on the time of day, the date, and a unique numbercontained in the network card [Bro94a].
OLE defines IIDs for every standard interface along with class identifiers(CLSID) for every standard object class. When a function is called thatasks for an IID or CLSID, what is actually passed is a referenceto an instance of the GUID structure that exists in the process space (usingthe reference types REFIID or REFCLSID). To compare two GUID, IID, or CLSIDvalues for equality, the functions IsEqualGUID, IsEqualIID,and IsEqualCLSID are used. In C++, an overloaded "=="operator can be used.
The QueryInterface function must always behave according to specificrules which, among other things, implement an indirect concept of objectidentity. First, any call to QueryInterface through any interfaceon a given object asking for a pointer to the IUnknown interfacealways returns an identical pointer value. This means that, given two arbitraryinterface pointers, it is possible to determine whether they belong tothe same object by asking each for an IUnknown pointer and comparingthe returned pointer values. If they match, both interface pointers referto the same object. Second, after an object is created, the interfacesit supports are static. If QueryInterface succeeded for a particularinterface at one point in the object's lifetime, an identical call to QueryInterfaceat a later time will also work. (This does not mean that the exact pointervalues returned will be identical, just that the interface is always available).The static set of available interfaces applies to a specific object, notan object class. That is, two objects of the same class might not bothsupport the same interfaces, but during the lifetime of each, the interfacesthey each support will remain static. Finally, as along as an object isin existence, all interface pointers obtained on that object must remainvalid, even if the Release function has been called through thosepointers.
Analysis and Design Methods
Note: 'Equality' and 'copy' do not appearto be used by any of the authors on analysis and design, except for Boochand Coleman et al. Meyer uses them in discussing language.
SA: All objects have identity, basedon values of primary identifier attributes. No concept of equality of objects."An identifier is a set of one or more attributes whose values uniquelydistinguish each instance of an object [class.]"
CA: "...[D]eferred to design isthe selection of actual identifications mechanisms... Every Object needssuch identifiers. ...each Object has an implicit identifier" in analysis.
RA: "Explicit object identifiersare not required in an object model. Each object has its own unique identity."
JA: "Each instance also has a uniqueidentity."
WD: Not used.
MD: See the separate matrix entryon the Eiffel language.
EA: Not used.
FA: "An object is thing that canbe distinctly identified." "[T]here can be many distinct objectswith the same attribute values."
In the data dictionary and the schemata"[t]he infix operator '= ='` is used to compare the identity of tworeferences to objects: Do the references refer to the same object or not?The infix operator '=' is used to compare the contents of two objects,by comparing their attributes for equality. If the equality of objectsdepends not only on their attributes, but on relationships in which theyare involved, a definition for the equality operator should be supplied."
OA: Not used.
BD: "Identity is that property ofan object that distinguishes it from all other objects." Equalityis determined in accordance with the possibilities provided by the implementationlanguage. The effect of copying is determined in accordance with the possibilitiesprovided by the implementation language. The relationship of assignmentto copying is discussed as a language and implementation issue.
HA: "Objects have identity"
NA: "The concept of a unique identitywhich distinguishes an object from all other objects, regardless of whethertheir internal structures and values coincide or not. All objects are createdwith a unique identity in an object oriented system, so the user need notworry about introducing access keys."features matrixintro page