Object-oriented languages define the identity of an object to be an address-based object identifier. The programmer may customize the notion of object identity by overriding the equals () and hashCode() methods following a specified contract. This customization often introduces latent errors, since the contract is unenforced and at times impossible to satisfy, and its implementation requires tedious and error-prone boilerplate code. Relation types are a programming model in which object identity is defined declaratively, obviating the need for equals () and hashCode() methods. This entails a stricter contract: identity never changes during an execution. We formalize the model as an adaptation of Featherweight Java, and implement it by extending Java with relation types. Experiments on a set of Java programs show that the majority of classes that override equals () can be refactored into relation types, and that most of the remainder are buggy or fragile. © Springer-Verlag Berlin Heidelberg 2007.
CITATION STYLE
Vaziri, M., Tip, F., Fink, S., & Dolby, J. (2007). Declarative object identity using relation types. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 4609 LNCS, pp. 54–78). Springer Verlag. https://doi.org/10.1007/978-3-540-73589-2_4
Mendeley helps you to discover research relevant for your work.