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 条
[41]   A COMPARISON OF OBJECT-ORIENTED PROGRAMMING IN 4 MODEM LANGUAGES [J].
HENDERSON, R ;
ZORN, B .
SOFTWARE-PRACTICE & EXPERIENCE, 1994, 24 (11) :1077-1095
[42]   A reliable and flexible type system for object-oriented programming [J].
Dodani, M ;
Tsai, CS .
OBJECT ORIENTED SYSTEMS, 1996, 3 (02) :87-121
[43]   Physics 0.01: Object-oriented programming for exact diagonalization [J].
Chung, MH .
INTERNATIONAL JOURNAL OF MODERN PHYSICS C, 2004, 15 (01) :185-192
[44]   An object-oriented programming paradigm based on Ada 95 [J].
Loeper, H ;
Khattab, A ;
Neubert, P ;
El-Gabali, M .
KUWAIT JOURNAL OF SCIENCE & ENGINEERING, 1998, 25 (02) :275-296
[45]   COLOBOT GAME AS LEARNING TOOL FOR OBJECT-ORIENTED PROGRAMMING [J].
Panczyk, Beata ;
Panczyk, Maciej .
EDULEARN15: 7TH INTERNATIONAL CONFERENCE ON EDUCATION AND NEW LEARNING TECHNOLOGIES, 2015, :114-122
[46]   Object-oriented programming of distributed iterative equation solvers [J].
Mackie, Robert Ian .
COMPUTERS & STRUCTURES, 2008, 86 (06) :511-519
[47]   Experiences in Bridging from Functional to Object-Oriented Programming [J].
Santos, Igor Moreno ;
Hauswirth, Matthias ;
Nystrom, Nathaniel .
SPLASH-E'19: PROCEEDINGS OF THE 2019 ACM SIGPLAN SYMPOSIUM ON SPLASH-E, 2019, :36-40
[48]   Abstract Interpretation and Object-oriented Programming: Quo Vadis? [J].
Logozzo, Francesco ;
Cortesi, Agostino .
ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 131 :75-84
[49]   Introduction to Automatic Differentiation and MATLAB Object-Oriented Programming [J].
Neidinger, Richard D. .
SIAM REVIEW, 2010, 52 (03) :545-563
[50]   Science Code .Net: Object-oriented programming for science [J].
Chung, Myung-Hoon .
SCIENCE OF COMPUTER PROGRAMMING, 2008, 71 (03) :242-247