Jump to content

Identity (object-oriented programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Esap (talk | contribs) at 22:31, 15 December 2004 (separated this into separate page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

An identity in object-oriented programming and object-oriented design describes the property of objects that the object can be distinguished from other objects. This is closely related to the philosophical concept of identity.

Identity and references

A reference 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.

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, 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.

Identity and object-oriented conceptual model

Identity allows the construction of a platonic ideal world that is often used as basis of object-oriented thinking. This world contains point-like objects, properties of the objects and links between those objects. The objects in the world can be grouped to form classes. The properties of the objects can be grouped to form roles. The links can be grouped to form associations. These groups are types of the corresponding concepts of the world.

Formal definition

See also