Conditional compilation is often used to implement variability in configurable systems.
This technique relies on #ifdefs to delimit feature code. Previous studies have shown
that #ifdefs may hinder code comprehensibility. However, they did not explicitly take
feature dependencies into account. Feature dependency occurs when different
features refer to the same program element, such as a variable. Comprehensibility may
be even more affected in the presence of feature dependency, as the developer must
reason about different scenarios affecting the same variable. Aim: Our goal is to
understand how feature dependency affects the comprehensibility of configurable
system source code. Method: We conducted two complementary empirical studies. In
Study 1, we carried out an experiment in which 30 developers debugged programs
with different types of feature dependency. Each program included a different type of
feature dependency: global, intraprocedural or interprocedural. We used an eyetracking device to record developers' gaze movements while they debugged programs.
Study 1, however, has two main limitations. Firstly, its programs contain only one type
of feature dependency each, while, in real systems, a same program file usually
includes more than one type of feature dependency. Secondly, Study 1 does not
compare programs with and without feature dependency. In Study 1, we did not
compare pieces of source code with and without feature dependency. To minimize
those limitations, in this paper, we complement Study 1 by means of Study 2. Forty-six
developers responded to a web-based study. They executed tasks in which they had to
analyze programs containing #ifdef with and without feature dependency. Each
program with feature dependency contained all the three types of features dependency
as frequently occurs in real configurable systems. Results: In Study 1, debugging
programs with #ifdef and global or interprocedural dependency required more time and
higher visual effort than intraprocedural dependency. Study 2, analyzing programs
containing #ifdef and feature dependency required more time than programs
containing #ifdef but without feature dependency. Conclusion: Our study showed that
#ifdefs affect comprehensibility of configurable systems in different degrees depending
on the presence of feature dependency or type of feature dependency
Study 1
The artifacts used in study 1 are available here.
|