Affiliation:
1. Department of Computer Science, Iowa State University, 226 Atanasoff Hall, Ames, IA
Abstract
A major problem for object-oriented frameworks and class libraries is how to provide enough information about a superclass, so programmers can safely create new subclasses without giving away the superclass's code. Code inherited from the superclass can call down to methods of the subclass, which may cause nontermination or unexpected behavior. We describe a reasoning technique that allows programmers, who have no access to the code of the superclass, to determine both how to safely override the superclass's methods and when it is safe to call them. The technique consists of a set of rules and some new forms of specification. Part of the specification would be generated automatically by a tool, a prototype of which is planned for the formal specification language JML. We give an example to show the kinds of problems caused by method overrides and how our technique can be used to avoid them. We also argue why the technique is sound and give guidelines for library providers and programmers that greatly simplify reasoning about how to avoid problems caused by method overrides.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
16 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Fragile base-class problem, problem?;Empirical Software Engineering;2016-08-08
2. The safety of dynamic mixin composition;Proceedings of the 30th Annual ACM Symposium on Applied Computing;2015-04-13
3. Observable interface behaviour and inheritance;Mathematical Structures in Computer Science;2014-11-13
4. Reconciling exhaustive pattern matching with objects;ACM SIGPLAN Notices;2013-06-23
5. MRI: Modular reasoning about interference in incremental programming;Journal of Functional Programming;2012-10-11