Data Persistence in Eiffel
Total Page:16
File Type:pdf, Size:1020Kb
University of Kentucky UKnowledge Theses and Dissertations--Computer Science Computer Science 2016 Data Persistence in Eiffel Jimmy J. Johnson University of Kentucky, [email protected] Digital Object Identifier: https://doi.org/10.13023/ETD.2016.444 Right click to open a feedback form in a new tab to let us know how this document benefits ou.y Recommended Citation Johnson, Jimmy J., "Data Persistence in Eiffel" (2016). Theses and Dissertations--Computer Science. 51. https://uknowledge.uky.edu/cs_etds/51 This Doctoral Dissertation is brought to you for free and open access by the Computer Science at UKnowledge. It has been accepted for inclusion in Theses and Dissertations--Computer Science by an authorized administrator of UKnowledge. For more information, please contact [email protected]. STUDENT AGREEMENT: I represent that my thesis or dissertation and abstract are my original work. Proper attribution has been given to all outside sources. I understand that I am solely responsible for obtaining any needed copyright permissions. I have obtained needed written permission statement(s) from the owner(s) of each third-party copyrighted matter to be included in my work, allowing electronic distribution (if such use is not permitted by the fair use doctrine) which will be submitted to UKnowledge as Additional File. I hereby grant to The University of Kentucky and its agents the irrevocable, non-exclusive, and royalty-free license to archive and make accessible my work in whole or in part in all forms of media, now or hereafter known. I agree that the document mentioned above may be made available immediately for worldwide access unless an embargo applies. I retain all other ownership rights to the copyright of my work. I also retain the right to use in future works (such as articles or books) all or part of my work. I understand that I am free to register the copyright to my work. REVIEW, APPROVAL AND ACCEPTANCE The document mentioned above has been reviewed and accepted by the student’s advisor, on behalf of the advisory committee, and by the Director of Graduate Studies (DGS), on behalf of the program; we verify that this is the final, approved version of the student’s thesis including all changes required by the advisory committee. The undersigned agree to abide by the statements above. Jimmy J. Johnson, Student Dr. Raphael A. Finkel, Major Professor Dr. Miroslaw Truszczyński, Director of Graduate Studies Data Persistence in Eiffel DISSERTATION A dissertation submitted in partial fulfillment of the require- ments for the degree of Doctor of Philosophy in the College of Engineering at the University of Kentucky By Jimmy J. Johnson Lexington, Kentucky Director: Dr. Raphael A. Finkel Professor of Computer Science Lexington, Kentucky 2016 Copyright © Jimmy J. Johnson 2016 Abstract of Dissertation Data Persistence in Eiffel This dissertation describes an extension to the Eiffel programming language that provides automatic object persistence (the ability of programs to store objects and later recreate those ob- jects in a subsequent execution of a program). The mechanism is orthogonal to other aspects of the Eiffel language. The mechanism serves four main purposes: 1) it gives Eiffel programmers a needed service, filling a gap between serialization, which provides limited persistence functions and database-mapping, which is cumbersome to use; 2) it greatly reduces the coding burden in- curred by the programmer when objects must persist, allowing the programmer to focus instead on the business model; 3) it provides a platform for testing the benefits of orthogonal persistence in Eiffel, and 4) it furnishes a model for orthogonal persistence in other object-oriented lan- guages. During my research, I created a prototype implementation of the persistence mechanism using it effectively in several programs. Performance measurements showed acceptable perfor- mance with some increase in program memory usage. The prototype gives the programmer the ability to add automatic persistence to existing code with the addition of only a few lines of code. The size of this additional code remains constant regardless of the total number of lines of code in the project. Eiffel syntax remains unchanged and nonpersistent Eiffel code runs as is while incur- ring only a very small speed penalty. KEYWORDS: data persistence, orthogonal persistence, persistent programming language, object-oriented programming, Eiffel Jimmy J. Johnson November 9, 2016 Date Data Persistence in Eiffel By Jimmy J. Johnson Dr. Raphael A. Finkel Director of Dissertation Dr. Miroslaw Truszczyński Director of Graduate Studies November 9, 2016 Acknowledgements I would like to express my special appreciation to my advisor Dr. Raphael Finkel. His advice and encouragement have been invaluable. He put up with my zealousness for the Eiffel programming language and supported my use of it as a platform for this research. I greatly ap- preciate his dedication to my work and for the opportunity to study under him. I also want to thank Dr. Jerzy Jaromczyk, Dr. Miroslaw Truszczyński , and Dr. Victor Marek for their guidance, instruction, and encouragement during my studies and research. I want to thank Dr. Bertrand Meyer for his support as I began my graduate studies. Without him, I would not have had such a wonderful language in which to work, and this project may not have materialized. Mrs. Annie Meyer at Eiffel Software also provided much encour- agement as she liaised between Eiffel Software’s technical support team and me. Others at Eiffel Software and at ETH Zurich have been a great help as well and deserve my thanks. Emmanuel Stapf, Jocylyn Fiat, and Alexander Kogtenkov provided help with the Eiffel compiler and many other technical issues for which I am very grateful. Roman Schmock- er’s help with the Eiffel runtime was indispensable. Finally, I wish to thank my wife for tolerating my late-night research and programming and for mostly ignoring the ensuing grumpiness the next morning. She held the fort down, allow- ing me to focus on this research. iii Table of Contents Acknowledgements ......................................................................................................................... iii Table of Contents ............................................................................................................................ iv List of Tables .................................................................................................................................. vi List of Figures ................................................................................................................................ vii Chapter 1 Introduction ................................................................................................................ 1 1.1 Terminology ..................................................................................................................... 3 1.2 “Eiffel: The Language” ................................................................................................... 4 1.2.1 Eiffel terminology ................................................................................................ 4 1.2.2 A sample system .................................................................................................. 6 1.2.3 Classes.................................................................................................................. 6 1.2.4 Eiffel initialization rules....................................................................................... 8 1.2.5 Reference and value semantics ............................................................................ 8 1.2.6 Tuples ................................................................................................................. 10 1.2.7 Once features ..................................................................................................... 10 1.2.8 Design by Contract® ........................................................................................... 11 1.2.9 Void-safe Eiffel .................................................................................................. 13 1.2.10 Feature renaming ............................................................................................... 13 1.3 The persistence problem ................................................................................................. 14 1.3.1 Serialization ....................................................................................................... 15 1.3.2 Database mapping .............................................................................................. 16 1.4 Summary ........................................................................................................................ 17 1.5 Roadmap ........................................................................................................................ 18 Chapter 2 Interface and semantics ............................................................................................. 19 2.1 Interface classes.............................................................................................................. 19 2.2 Persistent and persistable ............................................................................................... 20 2.3 Example system.............................................................................................................. 21 2.3.1 Access to persistence and initialization ............................................................