Complexity of In-Code Variability: Emergence of Detachable Decorators
摘要
This paper presents a study on how selected approaches to expressing variability in code affect code complexity. To evaluate and compare the complexity of essential aspects of different approaches to in-code variability management, we designed five prominent cases of how variability is expressed in code: using decorators, using decorators without variability configuration expressions, using wrappers, using decorators with additional unwanted dead code constructs not being included for illegal decorators, and with no variability expressed in code at all. To measure code complexity in these cases, we used a framework for evaluating TypeScript code that we implemented in Java. Our framework is capable of assessing 15 metrics, comprising several variants of the LOC, Halstead, cyclomatic complexity, and cyclomatic density metrics. Decorators are detachable because they are decorating particular code construct with a predefined naming convention and no effects on code. The study was conducted on a software product line aimed at graphical applications we developed for evaluation purposes. We came to a range of interesting findings, such as that the detachable decorator version of introduced annotations is significantly less complex than other ways of expressing variability in code, annotations in comments (as in pure::variants), and tags (as in frame technology) do not directly affect the complexity of business functionality, decorators can be entirely separated from business logic, etc.