Concept model and realization of object orientied system with metaprogramming
https://doi.org/10.21869/2223-1536-2024-14-3-223-237
Abstract
The purpose of the research is to develop a conceptual model of an object oriented system and implement it using a functional language with metaprogramming support.
Methods. A conceptual model of an object oriented system was developed based on a dynamic object system with message passing and dynamic dispatch. The developed object oriented system includes functions for creating and deleting classes, creating and deleting object instances of a class, functions for working with object properties, functions for adding methods to a class and passing messages. Inheritance is also possible, when a child class will have the properties of the parent class and its own properties.
Results. The object oriented system was implemented using a set of macros and helper functions. The basic data structure was a hash table with key access capabilities, which was also implemented using macros. When a class is created, an instance constructor is automatically generated, setting the initial values of the object’s fields. Inheritance is implemented as the inclusion of fields of a parent class in a child object. Polymorphism is implemented as dynamic dispatch: when processing a message, a handler method is searched. The resulting object oriented system, together with the hash table module, occupies 97 lines.
Conclusion. As a result of the work, a conceptual model of an object oriented system was created and implemented, which includes the main functions of the object oriented programming paradigm. It has been shown that macros can be used to create a compact object oriented system without the need to add any new functions or capabilities to the functional language interpreter.
About the Author
A. A. ChaplyginRussian Federation
Aleksandr A. Chaplygin, Candidate of Sciences (Engeneering), Associate Professor of the Department of Software Engeneering
50 Let Oktyabrya Str. 94, Kursk 305040
References
1. Bloch J. Effective Java: Programming Language Guide. Available at: https://theswissbay.ch/pdf/Gentoomen%20Library/Programming/Java/Addison%20Wesley%20-%20Effective%20Java%20Programming%20Language%20Guide.pdf (accessed 11.06.2024).
2. Tsybulko D.M. Comparison of problem-oriented and object-oriented programming approaches. Matematicheskie metody v tekhnike i tekhnologiyakh – MMTT = Mathematical Methods in Engineering and Technology – MMTT. 2015;(7):278–280. (In Russ.) EDN WFEKVH
3. Sharykin R.E. Methodology of software development using a model of distributed object-oriented stochastic hybrid systems. Informatika = Informatics. 2022;19(1):88–95. https://doi.org/10.37661/1816-0301-2022-19-1-88-95. (In Russ.) EDN DIHJAV
4. Abelson H., Sussman G.J., Sussman J. Structure and Interpretation of Computer Programs. Cambridge, Massatchusetts: The MIT Press; 2004. 268 p.
5. Domkin V. Programming Algorithms in Lisp. Berkeley: Apress, Ins.; 2021. 377 p.
6. Tuesdays A. Lisp: The Little Giant. Sistemnyi administrator = System Administrator. 2016;(6):64–69. (In Russ.) EDN VZGXVD
7. Ershov A.P., Pokrovsky S.B. Evolution of programming languages. Problemy informatiki = Problems of Computer Science. 2017;2(35):70–79. (In Russ.) EDN ZOLFPJ
8. Romanov S.S. Key concepts and features of object-oriented programming. Tavricheskii nauchnyi obozrevatel’ = The Tauride Scientific Observer. 2016;(12):141–146. (In Russ.) EDN YFXCCN
9. Gamma E., Helm R., Johnson R., Vlissides J. Patterns of object oriented design. St. Petersburg: Piter; 2024. 448 p. (In Russ.)
10. Nystrom R. Crafting interpreters. Moscow: Nobel Press; 2024. 640 p.
11. Callaú O., Robbes R., Tanter É., Röthlisberger D. Chow (and why) developers use the dynamic features of programming languages: the case of smalltalk. Empirical Software Engineering. 2013;18(6):1156–1194. https://doi.org/10.1007/s10664-012-9203-2. EDN YOGDYK
12. Paul G. ANSI Common LISP. St. Petersburg: Simvol-Plyus; 2020. 448 p. (In Russ.)
13. Malov A.V., Rodionov S.V. Implementation of the simplified Bayes algorithm in the COMMON LISP functional programming environment. Izvestiya SPbSETU "LETI" = Proceedings of Saint Petersburg Electrotechnical University. 2015;(2):32–37. (In Russ.)
14. Saibel P. Practical use of Common Lisp. Moscow: DMK Press; 2017. 488 p. (In Russ.)
15. Kochan S. Programming in Objective-C. Moscow: ECOM Publishers; 2014. 550 p. (In Russ.)
16. Stroustrup B. C++ programming language. Short course. Moscow: Vil’yams; 2019. 320 p.
17. Kuvardin M.V. Comparison of data structures a linked list and an array of structures using examples in the C++ programming language. Nauchnye issledovaniya XXI veka = Scientific Research of the XXI Century. 2021;(2):69–72. (In Russ.) EDN TVPPBJ
18. Stephen F. Lott, Dusty F. Object Oriented Python. 4th ed. Moscow: Piter; 2024. 704 p. (In Russ.)
19. Shield G. Java. A complete guide. 12th ed. Moscow: Dialectics-Williams; 2023. 1344 p. (In Russ.)
20. Chaplygin A.A. Modeling of a functional programming language interpreter with metaprogramming capabilities. Izvestiya Yugo-Zapadnogo gosudarstvennogo universiteta. Seriya: Upravlenie, vychislitel’naya tekhnika, informatika. Meditsinskoe priborostroenie = Proceedings of the Southwest State University. Series: Control, Computer Engineering, Information Science. Medical Instruments Engineering. 2024;14(2):181–193. (In Russ.) https://doi.org/ 10.21869/2223-1536-2024-14-2-181-193
Review
For citations:
Chaplygin A.A. Concept model and realization of object orientied system with metaprogramming. Proceedings of the Southwest State University. Series: IT Management, Computer Science, Computer Engineering. Medical Equipment Engineering. 2024;14(3):223-237. (In Russ.) https://doi.org/10.21869/2223-1536-2024-14-3-223-237