The Concept of Class Invariant in Object-oriented Programming

被引:0
|
作者
Meyer, Bertrand [1 ,2 ]
Arkadova, Alisa [3 ]
Kogtenkov, Alexander [1 ,2 ]
机构
[1] Constructor Inst, Schaffhausen, Switzerland
[2] Eiffel Software, 5949 Hollister Ave,Suite B Santa Barbara, Santa Barbara, CA 93117 USA
[3] Univ Toulouse, Siege Social 41 Allees Jules Guesde CS 61321, F-31013 Toulouse 6, France
关键词
Object-oriented programming; program verification; invariants; VERIFICATION;
D O I
10.1145/3626201
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Class invariants-consistency constraints preserved by every operation on objects of a given type-are fundamental to building, understanding, and verifying object-oriented programs. For verification, however, they raise difficulties, which have not yet received a generally accepted solution. The present work introduces a proof rule meant to address these issues and allow verification tools to benefit from invariants. It clarifies the notion of invariant and identifies the three associated problems: callbacks, furtive access, and reference leak. As an example, the 2016 Ethereum DAO bug, in which $50 million was stolen, resulted from a callback invalidating an invariant. The discussion starts with a simplified model of computation and an associated proof rule, demonstrating its soundness. It then removes one by one the three simplifying assumptions, each removal raising one of the three issues and leading to a corresponding adaptation to the proof rule. The final version of the rule can tackle tricky examples, including "challenge problems" listed in the literature.
引用
收藏
页数:38
相关论文
共 50 条
  • [1] OBJECT-ORIENTED PROGRAMMING WITHOUT AN OBJECT-ORIENTED LANGUAGE
    BOOCH, G
    SEIDEWITZ, E
    START, M
    FIRESMITH, D
    SIGPLAN NOTICES, 1986, 21 (11): : 508 - 508
  • [2] OBJECT-ORIENTED PROGRAMMING
    BAINES, R
    ELECTRONICS & WIRELESS WORLD, 1989, 95 (1638): : 370 - 374
  • [3] OBJECT-ORIENTED PROGRAMMING
    ANDERSON, B
    MICROPROCESSORS AND MICROSYSTEMS, 1988, 12 (08) : 433 - 442
  • [4] Object-Oriented Programming
    Barth, G.
    Welsch, C.
    IT - Information Technology, 1988, 30 (06): : 404 - 421
  • [5] OBJECT-ORIENTED PROGRAMMING
    TELLO, ER
    DR DOBBS JOURNAL, 1987, 12 (03): : 126 - &
  • [6] OBJECT-ORIENTED PROGRAMMING
    TELLO, ER
    DR DOBBS JOURNAL, 1987, 12 (11): : 130 - &
  • [7] The Object-oriented Programming Teaching Around Class as the Center
    Gao, Yue
    Li, Bin
    Zhang, Shuying
    PROCEEDINGS OF THE 2013 THE INTERNATIONAL CONFERENCE ON EDUCATION TECHNOLOGY AND INFORMATION SYSTEM (ICETIS 2013), 2013, 65 : 1043 - 1046
  • [8] OBJECT-ORIENTED PROGRAMMING
    POUNTAIN, D
    BYTE, 1990, 15 (02): : 257 - &
  • [9] Object-oriented programming
    Hirshfield, S
    Ege, RK
    ACM COMPUTING SURVEYS, 1996, 28 (01) : 253 - 255
  • [10] OBJECT-ORIENTED PROGRAMMING
    TENDYKE, RP
    KUNZ, JC
    IBM SYSTEMS JOURNAL, 1989, 28 (03) : 465 - 478