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] 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
  • [2] A VISUAL ENVIRONMENT ORGANIZING THE CLASS HIERARCHY FOR OBJECT-ORIENTED PROGRAMMING
    HAGINIWA, T
    NAGATA, M
    IEICE TRANSACTIONS ON INFORMATION AND SYSTEMS, 1995, E78D (09) : 1150 - 1155
  • [3] Teaching of Object-Oriented Programming
    Fojtik, Rostislav
    DIVAI 2018: 12TH INTERNATIONAL SCIENTIFIC CONFERENCE ON DISTANCE LEARNING IN APPLIED INFORMATICS, 2018, : 273 - 282
  • [4] A proof outline logic for object-oriented programming
    Pierik, C
    de Boer, FS
    THEORETICAL COMPUTER SCIENCE, 2005, 343 (03) : 413 - 442
  • [5] Object-Oriented Programming, Functional Programming and R
    Chambers, John M.
    STATISTICAL SCIENCE, 2014, 29 (02) : 167 - 180
  • [6] An Object-Oriented class design for the Generalized Finite Element Method programming
    Piedade Neto, Dorival
    Costa Ferreira, Manoel Denis
    Baroncini Proenca, Sergio Persival
    LATIN AMERICAN JOURNAL OF SOLIDS AND STRUCTURES, 2013, 10 (06): : 1267 - 1291
  • [7] What Object-Oriented Programming Was Supposed to Be Two Grumpy Old Guys' Take on Object-Oriented Programming
    Madsen, Ole Lehrmann
    Moller-Pedersen, Birger
    PROCEEDINGS OF THE 2022 ACM SIGPLAN INTERNATIONAL SYMPOSIUM ON NEW IDEAS, NEW PARADIGMS, AND REFLECTIONS ON PROGRAMMING AND SOFTWARE, ONWARD! 2022, 2022, : 220 - 239
  • [8] An operational semantics for object-oriented concepts based on the class hierarchy
    Colvin, Robert J.
    FORMAL ASPECTS OF COMPUTING, 2014, 26 (03) : 491 - 535
  • [9] Redesigning an Object-Oriented Programming Course
    Kaila, Erkki
    Kurvinen, Einari
    Lokkila, Erno
    Laakso, Mikko-Jussi
    ACM TRANSACTIONS ON COMPUTING EDUCATION, 2016, 16 (04):
  • [10] Understanding object-oriented programming concepts
    Klump, R
    2001 POWER ENGINEERING SOCIETY SUMMER MEETING, VOLS 1-3, CONFERENCE PROCEEDINGS, 2001, : 1070 - 1074