Abstraction and specification in program development
Abstraction and specification in program development
Systematic software development using VDM (2nd ed.)
Systematic software development using VDM (2nd ed.)
Eiffel: the language
DOOD '95 Proceedings of the Fourth International Conference on Deductive and Object-Oriented Databases
PROCOMET '98 Proceedings of the IFIP TC2/WG2.2,2.3 International Conference on Programming Concepts and Methods
Proof of correctness of data representation
Language Hierarchies and Interfaces, International Summer School
OOPSLA '04 Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications
The DaCapo benchmarks: java benchmarking development and analysis
Proceedings of the 21st annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications
Feedback-Directed Random Test Generation
ICSE '07 Proceedings of the 29th international conference on Software Engineering
Finding bugs efficiently with a SAT solver
Proceedings of the the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineering
Declarative object identity using relation types
ECOOP'07 Proceedings of the 21st European conference on Object-Oriented Programming
Proceedings of the 24th ACM SIGPLAN conference companion on Object oriented programming systems languages and applications
JEqualityGen: generating equality and hashing methods
GPCE '10 Proceedings of the ninth international conference on Generative programming and component engineering
Synthesizing iterators from abstraction functions
Proceedings of the 11th International Conference on Generative Programming and Component Engineering
Hi-index | 0.00 |
In an object-oriented language such as Java, every class requires implementations of two special methods, one for determining equality and one for computing hash codes. Although the specification of these methods is usually straightforward, they can be hard to code (due to subclassing, delegation, cyclic references, and other factors) and often harbor subtle faults. A technique is presented that simplifies this task. Instead of writing code for the methods, the programmer gives, as a brief annotation, an abstraction function that defines an abstract view of an object's representation, and sometimes an additional observer in the form of an iterator method. Equality and hash codes are then computed in library code that uses reflection to read the annotations. Experiments on a variety of programs suggest that, in comparison to writing the methods by hand, our technique requires less text from the programmer and results in methods that are more often correct.