An experiment on how Feature dependent variables affect program comprehensibility
Authors
Djan Santos, Cláudio Sant'Anna and Márcio Ribeiro
Abstract
Background: #ifdefs allow developers to define source code related to features that should or should not be compiled. A feature dependency occurs in a configurable system when source code snippets of different features share code elements, such as variables. Variables that produce feature dependency are called dependent variables. The dependency between two features may include just one dependent variable or more than one. It is reasonable to suspect that a high number of dependent variables and their use make the analysis of variability scenarios more complex. In fact, previous studies show that #ifdefs may affect comprehensibility, especially when their use implies feature dependency.
Aims: In this sense, the main goal of our experiment is to evaluate if the comprehensibility of configurable system source code varies according to the number of dependent variables. Testing this hypothesis is important so that we can recommend practitioners and researchers the extent to which writing #ifdef code with dependencies is harmful.
Method: To minimize this knowledge gap, we executed a controlled experiment with 12 participants who analyzed programs trying to specify their output. We quantified comprehensibility using metrics based on time and attempts to answer tasks correctly, participants' visual effort, and participants' heart rate.
Results: Our results indicate that the higher the number of dependent variables the more difficult it was to understand programs with feature dependency.
Conclusions: In practice, our results indicate that comprehensibility is more negatively affected in programs with higher number of dependent variables and when these variables are defined at a point far from the points where they are used.
Procedure
- We cleaned all material and equipment with alcohol gel and asked the participant to fill out a consent form
- The participant put on the smartwatch
- Calibrate eye-tracking and smartwatch devices
- We asked her or him to watch a two minute full-screen video of a fish swimming in an aquarium
- Perform the task in order based in Latin square group
Source Codes of Our Experiment
Latin Square 2 x 2: Rows = Participants, Column = Domains, Four squares: programs with and without feature dependency.
| Developer | Domain | |
|---|---|---|
| Domain 1: sale of property | Domain 2: grade calculation | |
| Developer 1 | 4DV (Program 1) | 2DV (Program 3) |
| Developer 2 | 2DV (Program 2) | 4DV (Program 4) |
Legend: 4DV (4 Dependent Variables), 2DV (2 Dependent Variables)
Tasks of Programs
| Tasks | With more dependent variable | With fewer dependent variable |
|---|---|---|
| Domain 1 - sale of property | Task 1, Task 2 and Task 3 | Task 1, Task 2 and Task 3 |
| Domain 2 - grade calculation | Task 1, Task 2 and Task 3 | Task 1, Task 2 and Task 3 |
Quantitative Collected Data
| Quantitative collected data | Script R |
|---|---|
| Individual time to specify the output | Time.R |
| Number of attempts needed until correct answer | Attempts.R |
| Individual number of fixations | Fixations.R |
| Number of HRV | HRV.r |
AOI of Programs
| Domain 1: sale of property | Domain 2: grade calculation |
|---|---|
| Program 1 and Program 2 | Program 3 and Program 4 |
Programs Highlighting Variable Definitions and Variable Usages
| Domain 1: sale of property | Domain 2: grade calculation |
|---|---|
| Program 1 and Program 2 | Program 3 and Program 4 |