...
【24h】

Safely Creating Correct Subclasses without Seeing Superclass Code

机译:安全地创建正确的子类而不会看到超类代码

获取原文
获取原文并翻译 | 示例
           

摘要

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 the 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.
机译:面向对象的框架和类库的主要问题是如何提供有关超类的足够信息,以便程序员可以安全地创建新的子类而又不放弃超类的代码。从超类继承的代码可以调用子类的方法,这可能会导致未终止或意外行为。我们描述了一种推理技术,该技术允许无法访问超类代码的程序员确定如何安全地重写超类的方法以及何时可以安全地调用它们。该技术由一组规则和一些新形式的规范组成。该规范的一部分将由一个工具自动生成,该工具的原型计划用于正式规范语言JML。我们举一个例子来说明由方法重写引起的各种问题,以及如何使用我们的技术来避免这些问题。我们还争论了为什么该技术是合理的,并为库提供者和程序员提供了指南,这些指南大大简化了有关如何避免由方法重写引起的问题的推理。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号