Towards Dynamic Software Product Lines: Unifying Design and Runtime Adaptations

In the recent years, we have witnessed major advances in mobile computing. Modern devices are equipped with a variety of sensors and network interfaces that make them quite versatile. In order to take advantage of all the hardware capabilities and provide a better user experience, software has to be context aware, i.e. it has to monitor the events and information coming from its environment and react accordingly. At the same time, we notice that an important number of such mobile applications share several characteristics regarding its architecture, communication, storage and interfaces. This leads us to consider that context-aware systems can also benefit from the Software Product Line (SPL) paradigm. SPLs were defined to take advantage of commonalities through the definition of reusable artifacts, in order to automate the derivation of multiple products. Nevertheless, SPLs are limited regarding the runtime modifications implied by context awareness. This dissertation investigates on Dynamic Software Product Lines (DSPL). A DSPL extends a classic SPLs by providing mechanisms to adapt products at runtime to cope with dynamic changes imposed by context awareness. Our main goal is to unify design and runtime adaptations under the same definition through high-level artifacts. Such artifacts can then be used to implement DSPLs by defining the processes required to map them into concrete products at design time and at runtime. Concretely, as the first contribution of this dissertation, we introduce both: a simple - yet complete - variability model, and a composition model that realizes variability. With the variability model we aim at defining a family of products and at identifying commonalities and variabilities along those products using variants. The composition model on the other side, is based on ideas from Aspect Oriented Software Development (AOSD). We use the model to divide the products in several modules called aspect models that are used to construct platform independent representations of variability. Each aspect model is formed by three parts: the architecture model which represents parts of a system to be added, the advice that contains a set of changes to the core application and finally, the pointcut that identifies the places where the modifications are performed. As a second contribution, we propose two processes of product derivation: design weaving and runtime weaving. Design weaving aims at building a single product. Runtime weaving aims at adapting a product being executed. Both processes use the same variability and aspect models. We thus allow developers to reuse the same artifacts used for building a software product to adapt it dynamically among various configurations. For the design weaving, we base ourselves on a model driven approach where transformations and code generation are employed to obtain source code from a set of models. For the runtime weaving, we use FraSCAti, a service and component based platform with dynamic properties, to execute reconfigurations during the execution of products. We also use a context manager to process events coming from the environment and make decisions about the adaptation. To validate our approach we define and implement a DSPL. Concretely, this research is part of the FUI CAPPUCINO project, which aims at building mobile applications for ubiquitous environments. We have implemented a DSPL for a retail case study. We successfully cover the whole cycle of design derivation and adaptation of software products. The scenario demonstrates the versatility of our approach and in particular the unification achieved through the aspect models used at design time as well as at runtime.