首页> 外文会议>SIGCSE technical symposium on Computer science education >Implementing object equivalence in Java using the template method design pattern
【24h】

Implementing object equivalence in Java using the template method design pattern

机译:使用模板方法设计模式实现Java中的对象等价

获取原文

摘要

A standard practice in object-oriented programming is to implement an operation, called equals in Java, for testing the equality of two objects. The equals method should be defined for every new Java class, but because of the intricacies of inheritance, casting, and dynamic typing, equals is often quite difficult to write correctly. And unfortunately many textbooks present flawed implementations of this operation. In this paper, we present a semantically correct technique for testing object equivalence, a technique that simultaneously brings together important mathematical foundations (equivalence relations), practical programming issues (inheritance, casting, dynamic typing), and sound software design (design patterns) in a natural and compelling way. While Java is used to demonstrate how the semantic flaws are corrected and the design improved using our techniques, the design is general enough that it will be clear how the same ideas could easily be extended to other languages such as C++.
机译:面向对象编程的标准做法是实现一个在Java中称为equals的操作,以测试两个对象的平等。应为每个新的Java类定义等于方法,而是因为继承,铸造和动态打字的复杂性,等于通常很难正确写入。不幸的是,许多教科书存在对此操作的缺陷实现。在本文中,我们提出了一种用于测试对象等价的语义上正确的技术,这是一种同时将重要数学基础(等同关系),实际编程问题(继承,铸造,动态键入)和声音软件设计(设计模式)一起融合在一起的技术一种自然和引人注目的方式。虽然Java用于演示语义缺陷如何纠正和设计使用我们的技术改进,但是该设计足够一般,可以清楚地清楚同样的想法如何轻松扩展到C ++等其他语言。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号