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 条
  • [21] Towards an object-oriented programming system for education
    Perez-Schofield, J. Baltasar Garcia
    Ortin Soler, Francisco
    Garcia Rosello, Emilio
    Perez Cota, Manuel
    COMPUTER APPLICATIONS IN ENGINEERING EDUCATION, 2006, 14 (04) : 243 - 255
  • [22] Modelling mathematical structures and object-oriented programming
    Gainutdinova, T. Yu
    Denisova, M. Yu
    Riazanova, L. V.
    Shakirova, Z. F.
    Shirokova, O. A.
    DILEMAS CONTEMPORANEOS-EDUCACION POLITICA Y VALORES, 2019, 6
  • [23] PARALLEL OBJECT-ORIENTED PROGRAMMING WITH QPC++
    BOLES, D
    STRUCTURED PROGRAMMING, 1993, 14 (04): : 158 - 172
  • [24] Teaching Reform and Exploration on Object-Oriented Programming
    Yuan, Guowu
    Kong, Bing
    Ding, Haiyan
    Zhang, Jixian
    Zhao, Yang
    2016 INTERNATIONAL CONFERENCE ON COMPUTATIONAL SCIENCE & COMPUTATIONAL INTELLIGENCE (CSCI), 2016, : 356 - 359
  • [25] STRATEGY FOR INTEGRATING OBJECT-ORIENTED AND LOGIC PROGRAMMING
    BOSE, R
    KNOWLEDGE-BASED SYSTEMS, 1994, 7 (02) : 66 - 74
  • [26] Simulation and 40 Years of Object-Oriented Programming
    Kindler, Eugene
    PROCEEDINGS OF WORLD ACADEMY OF SCIENCE, ENGINEERING AND TECHNOLOGY, VOL 22, 2007, 22 : 492 - 496
  • [27] Block-Based Object-Oriented Programming
    Allen, Oliver
    Downs, Xavier
    Varoy, Elliot
    Luxton-Reilly, Andrew
    Giacaman, Nasser
    IEEE TRANSACTIONS ON LEARNING TECHNOLOGIES, 2022, 15 (04): : 439 - 453
  • [28] ISSUES IN THE DESIGN OF AN OBJECT-ORIENTED PROGRAMMING LANGUAGE
    GROGONO, P
    STRUCTURED PROGRAMMING, 1991, 12 (01): : 1 - 15
  • [29] A Programming Model for Concurrent Object-Oriented Programs
    Jacobs, Bart
    Piessens, Frank
    Smans, Jan
    Rustan, K.
    Leino, M.
    Schulte, Wolfram
    ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2008, 31 (01):
  • [30] Inheritance of behavior in logical object-oriented programming
    Ngomo, M
    Pecuchet, JP
    DrissiTalbi, A
    CARI'96 - PROCEEDINGS OF THE 3RD AFRICAN CONFERENCE ON RESEARCH IN COMPUTER SCIENCE, 1996, : 842 - 853