The Python programming language features several functional constructs which can bring some benefits, e.g., fewer side effects, easier parallelization, or, in some cases, better comprehensibility due to concise code. This paper investigates the extent to which the addition/modification of certain functional constructs, i.e., lambdas, comprehensions, and map/reduce/filter functions, have higher chances to induce fixes than other changes, as well as how much this correlates with the complexity of the construct, and what is the survival time of such fix-inducing changes. To this aim, we analyze the change history of 200 open-source Python projects accounting for ≃630k commits. Results of the study show that: (i) changes to functional constructs have higher odds of inducing fixes than other changes, (ii) some functional constructs, such as lambdas and comprehensions, have higher odds of inducing fixes than others, (iii) the cyclomatic complexity of the functional construct is either not noteworthy or has a negligible effect, and (iv) the survival time of the fix-inducing changes varies among the involved functional constructs. The qualitative analysis performed on a statistically significant sample highlights different scenarios in which functional constructs have been fixed. Results of this study suggest better development support when using functional constructs during development, and prioritize code review and testing on certain areas of the source code.
The downside of functional constructs: a quantitative and qualitative analysis of their fix-inducing effects
Zampetti F.;Antoniol G.;Di Penta M.
2025-01-01
Abstract
The Python programming language features several functional constructs which can bring some benefits, e.g., fewer side effects, easier parallelization, or, in some cases, better comprehensibility due to concise code. This paper investigates the extent to which the addition/modification of certain functional constructs, i.e., lambdas, comprehensions, and map/reduce/filter functions, have higher chances to induce fixes than other changes, as well as how much this correlates with the complexity of the construct, and what is the survival time of such fix-inducing changes. To this aim, we analyze the change history of 200 open-source Python projects accounting for ≃630k commits. Results of the study show that: (i) changes to functional constructs have higher odds of inducing fixes than other changes, (ii) some functional constructs, such as lambdas and comprehensions, have higher odds of inducing fixes than others, (iii) the cyclomatic complexity of the functional construct is either not noteworthy or has a negligible effect, and (iv) the survival time of the fix-inducing changes varies among the involved functional constructs. The qualitative analysis performed on a statistically significant sample highlights different scenarios in which functional constructs have been fixed. Results of this study suggest better development support when using functional constructs during development, and prioritize code review and testing on certain areas of the source code.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.