Academic Journal
Constrictor: Immutability as a Design Concept
العنوان: | Constrictor: Immutability as a Design Concept |
---|---|
المؤلفون: | Kinsbruner, Elad, Itzhaky, Shachar, Peleg, Hila |
المساهمون: | Elad Kinsbruner and Shachar Itzhaky and Hila Peleg |
بيانات النشر: | Schloss Dagstuhl – Leibniz-Zentrum für Informatik |
سنة النشر: | 2024 |
المجموعة: | DROPS - Dagstuhl Research Online Publication Server (Schloss Dagstuhl - Leibniz Center for Informatics ) |
مصطلحات موضوعية: | Immutability, Design Enforcement, SMT, Liskov Substitution Principle, Object-oriented Programming |
الوصف: | Many object-oriented applications in algorithm design rely on objects never changing during their lifetime. This is often tackled by marking object references as read-only, e.g., using the const keyword in C++. In other languages like Python or Java where such a concept does not exist, programmers rely on best practices that are entirely unenforced. While reliance on best practices is obviously too permissive, const-checking is too restrictive: it is possible for a method to mutate the internal state while still satisfying the property we expect from an "immutable" object in this setting. We would therefore like to enforce the immutability of an object’s abstract state. We check an object’s immutability through a view of its abstract state: for instances of an immutable class, the view does not change when running any of the class’s methods, even if some of the internal state does change. If all methods of a class are verified as non-mutating, we can deem the entire class view-immutable. We present an SMT-based algorithm to check view-immutability, and implement it in our linter/verifier, Constrictor. We evaluate Constrictor on 51 examples of immutability-related design violations. Our evaluation shows that Constrictor is effective at catching a variety of prototypical design violations, and does so in seconds. We also explore Constrictor with two real-world case studies. |
نوع الوثيقة: | article in journal/newspaper conference object |
وصف الملف: | application/pdf |
اللغة: | English |
Relation: | Is Part Of LIPIcs, Volume 313, 38th European Conference on Object-Oriented Programming (ECOOP 2024); https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ECOOP.2024.22 |
DOI: | 10.4230/LIPIcs.ECOOP.2024.22 |
الاتاحة: | https://doi.org/10.4230/LIPIcs.ECOOP.2024.22 https://nbn-resolving.org/urn:nbn:de:0030-drops-208715 https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.ECOOP.2024.22 |
Rights: | https://creativecommons.org/licenses/by/4.0/legalcode |
رقم الانضمام: | edsbas.2FF74195 |
قاعدة البيانات: | BASE |
DOI: | 10.4230/LIPIcs.ECOOP.2024.22 |
---|