Comprehensibility of feature dependency in configurable system using #ifdef.

 

Author : Djan Santos, Márcio Ribeiro and Cláudio Sant'Anna

Abstract :


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.

 

Study 2

Procedure:

1 - The participants chooses the language she or he prefers.
2 - We explained the goal of the web-based study and our research goals. We also informed the participants about the time estimated to finish the web-based study, and then, asked the respondents for their informed consent.
3 - Each participant had to understand and realize the mental execution of two programs. Each participant also had to execute three tasks concerning each program. The participants were not allowed to proceed to the next task until they correctly answered the task in progress.
4 - After the question, there is a field and a button for the participant to enter his or her answer.
5 - After answering the three tasks of one of the programs in Domain 1, participants were redirected to one of the two programs in Domain 2.
6 - Finally, when a participant finished all the tasks, the web-based study asked her or him some questions to obtain qualitative feedback on how she or he performed the tasks. We have also asked participants about their profiles.

link to access the web-based study (new answers not be considered)
Source codes of our experiment:
Rows = Participants,
Column = Domains,
Four squares: programs with and without feature dependency.

SOURCE CODES OF PROGRAMS

Latin Square 2 x2:

Domain 1 - Product control program
Domain 2 - Vaccine control program
Developer 1 with feature dependency. without feature dependency.
Developer 2 without feature dependency. with feature dependency.

TASKS OF PROGRAMS

Tasks

with feature dependency.

without feature dependency.

Domain 1- Product control program Task 1 Task 1
Task 2 Task 2
Task 3 Task 3
Domain 2 - Vaccine control program Task 1 Task 1
Task 2 Task 2
Task 3 Task 3

TASKS AND SOURCE CODES OF PROGRAMS

Domain 1- Product control program Task + source code Task + source code
Domain 2 - Vaccine control program Task + source code Task + source code