首页> 外文期刊>IEEE Transactions on Software Engineering >Representation inheritance: a safe form of 'White box' code inheritance
【24h】

Representation inheritance: a safe form of 'White box' code inheritance

机译:表示形式继承:“白盒”代码继承的一种安全形式

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

摘要

There are two approaches to using code inheritance for defining new component implementations in terms of existing implementations. Black box code inheritance allows subclasses to reuse superclass implementations as-is, without direct access to their internals. Alternatively, white box code inheritance allows subclasses to have direct access to superclass implementation details, which may be necessary for the efficiency of some subclass operations and to prevent unnecessary duplication of code. Unfortunately, white box code inheritance violates the protection that encapsulation affords superclasses, opening up the possibility of a subclass interfering with the correct operation of its superclass methods. Representation inheritance is proposed as a restricted form of white box code inheritance where subclasses have direct access to superclass implementation details, but are required to respect the representation invariant(s) and abstraction relation(s) of their ancestor(s). This preserves the protection that encapsulation provides, while allowing the freedom of access that component implementers sometimes desire.
机译:有两种方法可以使用代码继承来根据现有实现定义新的组件实现。黑盒代码继承允许子类按原样重用超类实现,而无需直接访问其内部。或者,白盒代码继承允许子类直接访问超类实现细节,这对于提高某些子类操作的效率并防止不必要的代码重复可能是必需的。不幸的是,白盒代码继承违反了封装提供超类的保护,从而打开了子类干扰其超类方法的正确操作的可能性。表示继承被提议为白盒代码继承的一种受限形式,其中子类可以直接访问超类实现的详细信息,但必须尊重其祖先的表示不变式和抽象关系。这保留了封装提供的保护,同时允许组件实现者有时希望访问的自由。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号