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 条
[31]   A Programming Model for Concurrent Object-Oriented Programs [J].
Jacobs, Bart ;
Piessens, Frank ;
Smans, Jan ;
Rustan, K. ;
Leino, M. ;
Schulte, Wolfram .
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2008, 31 (01)
[32]   MODULA-2 AND OBJECT-ORIENTED PROGRAMMING [J].
WIRTH, N .
MICROPROCESSORS AND MICROSYSTEMS, 1990, 14 (03) :149-152
[33]   SIMULA and 40 years of object-oriented programming [J].
Kindler, Eugene .
EUROPEAN SIMULATION AND MODELLING CONFERENCE 2007, 2007, :20-23
[34]   Implementing Interactive Programming Tutorials in Object-Oriented Programming Education [J].
Dennis, Brandon ;
Kuo, Rita ;
Ramyaa, Ramyaa .
2023 IEEE INTERNATIONAL CONFERENCE ON ADVANCED LEARNING TECHNOLOGIES, ICALT, 2023, :180-181
[35]   Object-oriented concept analysis for software imodularisation [J].
Kim, H. H. ;
Bae, D. -H. .
IET SOFTWARE, 2008, 2 (02) :134-148
[36]   Object-Oriented Programming Hardware/Software Supports and Comparison [J].
Li, Junyi ;
Zhang, Yuhua ;
Li, Zhenkun ;
Fong, Anthony S. .
PROCEEDINGS OF THE 2ND INTERNATIONAL CONFERENCE ON COMPUTER AND INFORMATION APPLICATIONS (ICCIA 2012), 2012, :483-486
[37]   Nubes: Object-Oriented Programming for Stateful Serverless Functions [J].
Marek, Kinga Anna ;
De Martini, Luca ;
Margara, Alessandro .
PROCEEDINGS OF THE 2023 9TH INTERNATIONAL WORKSHOP ON SERVERLESS COMPUTING, WOSC 2023, 2023, :30-35
[38]   A new algorithm for complex faults and object-oriented programming [J].
Chen, Q ;
Liu, YT .
ENGINEERING INTELLIGENT SYSTEMS FOR ELECTRICAL ENGINEERING AND COMMUNICATIONS, 2004, 12 (02) :107-110
[39]   Competency Development in the Object-oriented Programming Style Education [J].
Molloy, Muharem ;
Stoitsov, Gencho .
TEM JOURNAL-TECHNOLOGY EDUCATION MANAGEMENT INFORMATICS, 2021, 10 (04) :1938-1944
[40]   Improving modularity in object-oriented finite element programming [J].
DuboisPelerin, Y ;
Pegon, P .
COMMUNICATIONS IN NUMERICAL METHODS IN ENGINEERING, 1997, 13 (03) :193-198