Analysis and removal of code clones in software product lines
Sandro Schulze · Digitalen Hochschulbibliothek Sachsen-Anhalt (Universitäts- und Landesbibliothek Sachsen-Anhalt) · 2013
Software maintenance is the main driver of total costs in the lifecycle of long-living software systems.Code clones, that is, the replication of code fragments across the system, decrease maintainability: It increases the code size and hinders manual code change, inspection, and analysis.Intensive research has been spent in the last two decades to determine the nature of clones, specifically why and where they occur as well as whether they impair the maintenance of software systems.While recent studies expressed doubt on the general harmfulness of clones, it is commonly accepted that the awareness of existing code clones in software system is indispensable in any case.Recently, software product line engineering gained momentum since it provides a systematic approach for reuse amongst a set of similar programs, commonly referred to as software product lines (SPL).An SPL allows the programmer to manage a set of programs by describing variabilities and commonalities between them in terms of features.In this context, a feature is an increment in end-user visible functionality.As a result, a particular program can be derived by selecting the desired features and subsequently composing all corresponding assets.The goal of this thesis is to bridge the gap between both research areas, reengineering & maintenance (where code cloning belongs to) and software product lines.We argue, that SPLs evolve even more than single software systems and thus, maintenance becomes even more complex.Hence, it is important to figure out specialities of SPLs regarding software reengineering.In this thesis, we focus mainly on code clone analysis and removal.First, we present results from empirical studies that emphasize the existence of clones in SPLs.More specifically, we provide insights why clones occur in SPLs and point out differences between compositional and annotative SPLs.Second, we propose variant-preserving refactorings for compositional software product lines as mean for code clone removal.We present particular refactorings in a cataloguelike manner and demonstrate their applicability by means of a case study.