GENERATING MEMBERS of a SOFTWARE PRODUCT LINE USING COMBINATORY LOGIC by Armend Hoxha a Thesis Submitted to the Faculty of WORC
Total Page:16
File Type:pdf, Size:1020Kb
GENERATING MEMBERS OF A SOFTWARE PRODUCT LINE USING COMBINATORY LOGIC By Armend Hoxha A Thesis Submitted to the Faculty of WORCESTER POLYTECHNIC INSTITUTE in partial fulfillment of the requirements for the Degree of Master of Science in Computer Science May 2015 APPROVED BY: Dr. George T. Heineman, Advisor Dr. Kathi Fisler, Reader I. ABSTRACT A Product Line Family contains similar applications that differ only in the sets of sup- ported features from the family. To properly engineer these product lines, programmers design a common code base used by all members of the product line. The structure of this common code base is often an Object-Oriented (OO) framework, designed to contain the detailed domain-specific knowledge needed to implement these applications. However, these frameworks are often quite complex and implement detailed dynamic behavior with complex coordination among their classes. Extending an OO framework to realize a single product line instance is a unique exercise in OO programming. The ultimate goal is to develop a consistent approach, for managing all instances, which relies on configuration rather than programming. In this thesis, we show the novel application of Combinatory Logic to automatically syn- thesize correct product line members using higher-level code fragments specified by means of combinators. Using the same starting point of an OO framework, we show how to design a repository of combinators using FeatureIDE, an extensible framework for Feature-Oriented Software Development. We demonstrate a proof of concept using two different Java-based frameworks: a card solitaire framework and a multi-objective optimization algorithms framework. These case studies rely on LaunchPad, an Eclipse plugin developed at WPI that extends FeatureIDE. The broader impact of this work is that it enables framework designers to formally en- code the complex functional structure of an OO framework. Once this task is accomplished, then, generating product line instances becomes primarily a configuration process, which enables correct code to be generated by construction based on the combinatory logic. ii II. ACKNOWLEDGEMENTS When I initially got introduced to this research project, by Prof. George T. Heineman, I thought to myself "Is it really possible?". It turned out to be not only possible, but also one of the most interesting projects I've worked on so far. Therefore, I want to thank him, as my advisor, for his great support, who has helped me achieve this feat with his invaluable constant advice and encouragement. To be able to work on this project I needed to stand on the shoulders of giants. Besides my advisor, I want to thank Boris Düdder and Jakob Rehof from the Technical University of Dortmund in Germany, who, together with Prof. Heineman, have made all this work possible by providing the tools and ideas that I have experimented with. I also want to thank the reader of my thesis, Prof. Kathi Fisler, whose critiques helped me better shape this work. I am very grateful to USAID Kosovo, too, for helping me realize my dream by granting me a full scholarship. I should also thank American Councils for administering the program I was enrolled in and overseeing my overall progress over these two years of graduate studies at WPI. And, how can I forget? I want to thank my family for supporting me in every aspect of my life; in particular my father, who (while alive) has ingrained in me the urge for education; and my sister Mimoza, who has first introduced me to a computer (it was a turning point in my life) and has provided material and moral support throughout my studies in high-school and undergraduate school. And finally, the one who has been with me every single day, every step of the way, Divya. iii III. TABLE OF CONTENTS I. Abstract ................................................................................................................................................. ii II. Acknowledgements .............................................................................................................................. iii IV. List of figures ........................................................................................................................................ vi V. List of Tables ....................................................................................................................................... vii 1. Introduction and Motivation ................................................................................................................ 1 1.1. Grand Challenge ............................................................................................................................ 2 1.2. Requirements ................................................................................................................................ 3 1.3. Overview ....................................................................................................................................... 5 2. Design of Solution ................................................................................................................................. 6 2.1. Combinatory Logic Synthesis ........................................................................................................ 6 2.2. Inhabitation Problem .................................................................................................................... 9 2.3. Tool Support InhabConsoleClient ............................................................................................... 13 2.4. Tool Support LaunchPad Eclipse Plugin ...................................................................................... 17 2.5. Tool Support FeatureIDE ............................................................................................................. 18 3. Case Study ........................................................................................................................................... 23 3.1. FourteenOut Experience ............................................................................................................. 23 3.1.1. Native Java implementation ............................................................................................... 24 3.1.2. Native Lambda / Combinator implementation ................................................................... 34 3.1.3. Review of the LaunchPad repository implementation of Fourteen-Out ............................ 39 3.2. KombatSolitaire .......................................................................................................................... 44 3.3. KombatSolitaire Γ Repository ...................................................................................................... 45 3.4. MOEA Framework ....................................................................................................................... 50 3.4.1. Defining a new problem ...................................................................................................... 52 3.5. MOEA Framework Γ Repository .................................................................................................. 57 4. Related Work ...................................................................................................................................... 74 4.1. Product line literature on configuration ..................................................................................... 74 4.2. Documentation of OO frameworks ............................................................................................ 75 4.2.1. SourceForge (www.sourceforge.com) ................................................................................ 76 4.2.2. Github (www.github.com) .................................................................................................. 78 4.2.3. Google Code (https://code.google.com) ............................................................................ 79 5. Evaluation ........................................................................................................................................... 82 iv 5.1. Evaluation of KS and MOEA Γ Repositories ................................................................................. 82 5.2. Metrics for Combinators ............................................................................................................. 85 6. Conclusion and Future Work .............................................................................................................. 87 References .................................................................................................................................................. 89 v IV. LIST OF FIGURES Figure 1: Competing Visions for Extending OO Framework .................................................................... 4 Figure 2: Simple Sensor Example .................................................................................................................. 6 Figure 3: Enhanced Sensor Example with Intersection Types ...................................................................... 7 Figure 4: Adding ConApp combinator to sensor example ............................................................................ 8 Figure 5: Implementation of ConApp in Sensor Example ............................................................................. 8 Figure 6: Repository with Single Inhabitant Example ................................................................................