2010 | OriginalPaper | Buchkapitel
Understanding the Impact of Collection Contracts on Design
verfasst von : Stephen Nelson, David J. Pearce, James Noble
Erschienen in: Objects, Models, Components, Patterns
Verlag: Springer Berlin Heidelberg
Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.
Wählen Sie Textabschnitte aus um mit Künstlicher Intelligenz passenden Patente zu finden. powered by
Markieren Sie Textabschnitte, um KI-gestützt weitere passende Inhalte zu finden. powered by
Java provides a specification for a user-defined general purpose equivalence operator for objects, but collections such as
Set
have more stringent requirements. This inconsistency breaks polymorphism: programmers must take care to follow
Set
’s contract rather than the more general
Object
contract if their object could enter a
Set
. We have dynamically profiled 30 Java applications to better understand the way programmers design their objects, to determine whether they program with collections in mind. Our results indicate that objects which enter collections behave very differently to objects which do not. Our findings should help developers understand the impact of design choices they make, and guide future language designers when adding support for collections and/or equality.