Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
service
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
Freenet DSL
Who's Online
12 user(s) are online (9 user(s) are browsing encyclopedia)

Members: 0
Guests: 12

more...
partner

Identity (object-oriented programming)

An identity in object-oriented programming, object-oriented design and object-oriented analysis describes the property of object (computer science)s that distinguishes them from other objects. This is closely related to the philosophical concept of identity.

= Identity and references =

A reference (computer science) can be used to refer to an object with a specific identity. A reference contains the information that is necessary for the identity property to be realized in the programming language, and allows access to the object with the identity. A type of a target of a reference is a role.

Object identity is often not useful, if referential transparency is assumed, because identity is a property that an object may contain aspects that are not visible in its interface. Thus, objects need to be identified in the interface with a mechanism that is distinct from the methods used to access the object s state in its interface. With referential transparency, the value of the state of the object would be identical or isomorphic with the values accessible from the object s interface. There would be no difference between the object s interface and its implementation, and the identity property would provide no useful additional information.

= Identity and location =

Identity is closely associated with the location that objects are stored in. Some programming languages implement object identity by using the location of the object in computer memory as the mechanism for realizing object identity. However, objects can move from one place to another without change to their identity, and can be stored in places other than computer memory, so this does not fully characterize object identity.

= Consequences of identity =

Identity of objects allows objects to be treated as black boxes. The object need not expose its internal structure. It can still be referred to, and its other properties can be accessed via its external behaviour associated with the identity. The identity provides a mechanism for referring to such parts of the object that are not exposed in the interface. Thus, identity is the basis for polymorphism (computer science) in object-oriented programming.

Identity allows comparison of references. Two references can be compared whether they are equal or not. Due to the identity property, this comparison has special properties. If the comparison of references indicates that the references are equal, then it s clear that the two objects pointed by the references are the same object. If the references do not compare equal, then it s not necessarily guaranteed that the identity of the objects behind those references is different. The object identity of two objects of the same type is same, if every change to either object is also a change to the other object.

= Identity and object-oriented conceptual model =

Identity allows the construction of a platonic ideal world, the ontology (computer science) or conceptual model, that is often used as basis of object-oriented thinking. The conceptual model describes the client side view to a domain, terminology or an API. This world contains point-like objects as instances, properties of the objects and links between those objects. The objects in the world can be grouped to form class (computer science)es. The properties of the objects can be grouped to form role (object-oriented programming)s. The links can be grouped to form association (object-oriented programming)s. All locations in the world together with the links between the locations form the structure of the world. These groups are types of the corresponding instances of the world.

= See also =

  • Meyer: Object-oriented software construction, second edition