[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ Skip to main content

Advertisement

Log in

The downside of functional constructs: a quantitative and qualitative analysis of their fix-inducing effects

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

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 \(\simeq 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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
£29.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price includes VAT (United Kingdom)

Instant access to the full article PDF.

Fig. 1
Fig. 2

Similar content being viewed by others

Data Availability

The replication package (Zampetti et al. 2024) comprises datasets extracted from a GitHub repository, which served as the basis for conducting diverse statistical analyses and constructing survival models in our study.

Notes

  1. https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Impure

  2. https://octoverse.github.com/2022/top-programming-languages

  3. https://mail.python.org/pipermail/python-dev/2006-February/060415.html

  4. https://developers.slashdot.org/story/13/08/25/2115204/interviews-guido-van-rossum-answers-your-questions

  5. \(\backslash b\) stands for matching word boundaries.

  6. https://github.com/saltstack/salt/commit/1a9f03a

  7. http://tinyurl.com/yp4w7f7k

  8. https://github.com/saltstack/salt/commit/8c418e0

  9. https://github.com/HIPS/autograd/commit/9224718

  10. https://github.com/pyload/pyload/commit/0b210a1

  11. http://tinyurl.com/yc2vzd2c

  12. https://github.com/getsentry/sentry/pull/29495

  13. https://github.com/saltstack/salt/issues/16638

  14. https://github.com/etuttle/salt/commit/bbae532

References

  • Ajami S, Woodbridge Y, Feitelson DG (2017) Syntax, predicates, idioms - what really affects code complexity? In: 2017 IEEE/ACM 25th International Conference on Program Comprehension (ICPC), pp 66–76. https://doi.org/10.1109/ICPC.2017.39

  • Alexandru CV, Merchante JJ, Panichella S, Proksch S, Gall HC, Robles G (2018) On the usage of pythonic idioms. In: Onward!. ACM, pp 1–11

  • Antoniol G, Ayari K, Di Penta M, Khomh F, Guéhéneuc YG (2008) Is it a bug or an enhancement?: a text-based approach to classify change requests. In: Proceedings of the 2008 conference of the centre for advanced studies on collaborative research. IBM, p 23

  • Anvik J, Murphy GC (2007) Determining implementation expertise from bug reports. In: Fourth international workshop on mining software repositories, MSR 2007 (ICSE Workshop), Minneapolis, MN, USA, May 19-20, 2007, Proceedings. IEEE Computer Society, p 2. https://doi.org/10.1109/MSR.2007.7

  • Bates D, Mächler M, Bolker B, Walker S (2015) Fitting linear mixed-effects models using lme4. J Stat Softw 67(1):1–48

    Article  Google Scholar 

  • Bavota G, Carluccio BD, De Lucia A, Di Penta M, Oliveto R, Strollo O (2012a) When does a refactoring induce bugs? an empirical study. In: Proceedings of the IEEE international working conference on source code analysis and manipulation, pp 104–113

  • Bavota G, Carluccio BD, De Lucia A, Di Penta M, Oliveto R, Strollo O (2012b) When does a refactoring induce bugs? an empirical study. In: 12th IEEE International working conference on source code analysis and manipulation, SCAM 2012, Riva del Garda, Italy, September 23-24, 2012, pp 104–113

  • Benjamini Y, Hochberg Y (1995) Controlling the false discovery rate: a practical and powerful approach to multiple testing. J Roy Stat Soc: Ser B (Methodol) 57(1):289–300

    Article  MathSciNet  Google Scholar 

  • Berger ED, Hollenbeck C, Maj P, Vitek O, Vitek J (2019) On the impact of programming languages on code quality: a reproduction study. ACM Transactions on Programming Languages and Systems (TOPLAS) 41(4):1–24

    Article  Google Scholar 

  • Bernardi ML, Canfora G, Di Lucca GA, Di Penta M, Distante D (2018) The relation between developers’ communication and fix-inducing changes: an empirical study. J Syst Softw 140:111–125. https://doi.org/10.1016/j.jss.2018.02.065

    Article  Google Scholar 

  • Bird C, Bachmann A, Aune E, Duffy J, Bernstein A, Filkov V, Devanbu PT (2009) Fair and balanced?: bias in bug-fix datasets. In: Proceedings of the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT international symposium on foundations of software engineering, 2009, Amsterdam, The Netherlands, August 24-28, 2009, pp 121–130

  • Bogachenkova V, Nguyen L, Ebert F, Serebrenik A, Castor F (2022) Evaluating atoms of confusion in the context of code reviews. In: 2022 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp 404–408. https://doi.org/10.1109/ICSME55016.2022.00048

  • Canfora G, Ceccarelli M, Cerulo L, Di Penta M (2011) How long does a bug survive? an empirical study. In: 18th Working conference on reverse engineering, WCRE 2011, Limerick, Ireland, October 17-20, 2011, pp 191–200. https://doi.org/10.1109/WCRE.2011.31

  • Cohen J (1960) A coefficient of agreement for nominal scales. Educ Psychol Meas

  • da Costa JAS, Gheyi R, Castor F, de Oliveira PRF, Ribeiro M, Fonseca B (2023) Seeing confusion through a new lens: on the impact of atoms of confusion on novices’ code comprehension. Empir Softw Eng 28(4):81

    Article  Google Scholar 

  • D’Ambros M, Lanza M, Robbes R (2012) Evaluating defect prediction approaches: a benchmark and an extensive comparison. Empir Softw Eng 17(4–5):531–577

    Article  Google Scholar 

  • de Oliveira B, Ribeiro M, da Costa JAS, Gheyi R, Amaral G, de Mello RM, Oliveira A, Garcia AF, Bonifácio R, Fonseca B (2020) Atoms of confusion: the eyes do not lie. In: 34th Brazilian symposium on software engineering, SBES 2020, Natal, Brazil, October 19-23, 2020. ACM, pp 243–252

  • Di Penta M, Bavota G, Zampetti F (2020) On the relationship between refactoring actions and bugs: a differentiated replication. In: ESEC/FSE ’20: 28th ACM Joint European software engineering conference and symposium on the foundations of software engineering, Virtual Event, USA, November 8-13, 2020, pp 556–567. https://doi.org/10.1145/3368089.3409695

  • Dolado J, Harman M, Otero M, Hu L (2003) An empirical investigation of the influence of a type of side effects on program comprehension. IEEE Trans Software Eng 29(7):665–670. https://doi.org/10.1109/TSE.2003.1214329

    Article  Google Scholar 

  • Falleri J, Ham H (2022) Gumtree pythonparser module https://github.com/GumTreeDiff/pythonparser (last access: 03/10/2022)

  • Falleri J, Morandat F, Blanc X, Martinez M, Monperrus M (2014) Fine-grained and accurate source code differencing. In: ACM/IEEE International conference on automated software engineering, ASE ’14, Vasteras, Sweden - September 15 - 19, 2014, pp 313–324. https://doi.org/10.1145/2642937.2642982

  • Ferzund J, Ahsan SN, Wotawa F (2009) Bug-inducing language constructs. In: 16th Working conference on reverse engineering, WCRE 2009, 13-16 October 2009, Lille, France, pp 155–159. https://doi.org/10.1109/WCRE.2009.40

  • Fisher RA (1922) On the interpretation of chi-square from contingency tables, and the calculation of p. J Roy Stat Soc 85(1):87–94

    Article  Google Scholar 

  • Franklin L, Gyori A, Lahoda J, Dig D (2013) LAMBDAFICATOR: from imperative to functional programming through automated refactoring. In: Notkin D, Cheng BHC, Pohl K (eds) 35th International conference on software engineering, ICSE ’13, San Francisco, CA, USA, May 18-26, 2013. IEEE Computer Society, pp 1287–1290

  • Fritz T, Murphy GC, Hill E (2007) Does a programmer’s activity indicate knowledge of code? In: Proceedings of the 6th joint meeting of the European software engineering conference and the ACM SIGSOFT International symposium on foundations of software engineering, 2007, Dubrovnik, Croatia, September 3-7, 2007. ACM, pp 341–350

  • Gerds TA (2023) prodlim: product-limit estimation for censored event history analysis. https://CRAN.R-project.org/package=prodlim, r package version 2023.08.28

  • Gopstein D, Iannacone J, Yan Y, DeLong L, Zhuang Y, Yeh MK, Cappos J (2017) Understanding misunderstandings in source code. In: Proceedings of the 2017 11th joint meeting on foundations of software engineering, ESEC/FSE 2017, Paderborn, Germany, Sept. 4-8, 2017. ACM, pp 129–139

  • Gopstein D, Zhou HH, Frankl P, Cappos J (2018) Prevalence of confusing code in software projects: atoms of confusion in the wild. In: Proceedings of the 15th international conference on mining software repositories, association for computing machinery, New York, USA, MSR ’18, pp 281–291. https://doi.org/10.1145/3196398.3196432

  • Graylin J, Hale JE, Smith RK, David H, Kraft NA, Charles W et al (2009) Cyclomatic complexity and lines of code: empirical evidence of a stable linear relationship. J Softw Eng Appl 2(03):137

    Article  Google Scholar 

  • Gyori A, Franklin L, Dig D, Lahoda J (2013) Crossing the gap from imperative to functional programming through refactoring. In: Meyer B, Baresi L, Mezini M (eds) Joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering, ESEC/FSE’13, Saint Petersburg, Russian Federation, August 18-26, 2013. ACM, pp 543–553

  • Hanenberg S, Mehlhorn N (2022) Two n-of-1 self-trials on readability differences between anonymous inner classes (aics) and lambda expressions (les) on Java code snippets. Empir Softw Eng 27(2):1–39

    Article  Google Scholar 

  • Herzig K, Just S, Zeller A (2015) It’s not a bug, it’s a feature: How misclassification impacts bug prediction. In: Software engineering & management 2015, Multikonferenz der GI-Fachbereiche Softwaretechnik (SWT) und Wirtschaftsinformatik (WI), FA WI-MAW, 17. März - 20. März 2015, Dresden, Germany, pp 103–104

  • Hoang T, Dam HK, Kamei Y, Lo D, Ubayashi N (2019) Deepjit: an end-to-end deep learning framework for just-in-time defect prediction. In: Proceedings of the 16th international conference on mining software repositories, MSR 2019, 26-27 May 2019, Montreal, Canada, pp 34–45. https://doi.org/10.1109/MSR.2019.00016

  • Huq SF, Sadiq AZ, Sakib K (2019) Understanding the effect of developer sentiment on fix-inducing changes: an exploratory study on github pull requests. In: 2019 26th Asia-Pacific Software Engineering Conference (APSEC), pp 514–521. https://doi.org/10.1109/APSEC48747.2019.00075

  • Kamei Y, Shihab E, Adams B, Hassan AE, Mockus A, Sinha A, Ubayashi N (2013) A large-scale empirical study of just-in-time quality assurance. IEEE Trans Software Eng 39(6):757–773. https://doi.org/10.1109/TSE.2012.70

    Article  Google Scholar 

  • Kamei Y, Fukushima T, McIntosh S, Yamashita K, Ubayashi N, Hassan AE (2016) Studying just-in-time defect prediction using cross-project models. Empir Softw Eng 21(5):2072–2106. https://doi.org/10.1007/s10664-015-9400-x

    Article  Google Scholar 

  • Kawrykow D, Robillard MP (2011) Non-essential changes in version histories. In: Proceedings of the 33rd International Conference on Software Engineering, ICSE 2011, Waikiki, Honolulu , HI, USA, May 21-28, 2011, pp 351–360. https://doi.org/10.1145/1985793.1985842

  • Kim S, Jr EJW, Zhang Y (2008) Classifying software changes: clean or buggy? IEEE Trans Software Eng 34(2):181–196

  • Langhout C, Aniche M (2021) Atoms of confusion in java. In: 29th IEEE/ACM International conference on program comprehension, ICPC 2021, Madrid, Spain, May 20-21, 2021. IEEE, pp 25–35

  • Lenarduzzi V, Lomio F, Huttunen H, Taibi D (2020) Are sonarqube rules inducing bugs? In: 27th IEEE International conference on software analysis, evolution and reengineering, SANER 2020, London, ON, Canada, February 18-21, 2020, pp 501–511. https://doi.org/10.1109/SANER48275.2020.9054821

  • Logilab and Pylint contributors (2023) Pylint. https://pylint.pycqa.org/

  • Lucas W, Bonifácio R, Canedo ED, Marcílio D, Lima F (2019) Does the introduction of lambda expressions improve the comprehension of Java programs? In: Proceedings of the XXXIII Brazilian symposium on software engineering, pp 187–196

  • McCabe T (1976) A complexity measure. IEEE Trans on Softw Eng (4):308–320

  • McIntosh S, Kamei Y (2018) Are fix-inducing changes a moving target? A longitudinal case study of just-in-time defect prediction. IEEE Trans Software Eng 44(5):412–428. https://doi.org/10.1109/TSE.2017.2693980

    Article  Google Scholar 

  • Medeiros F, Lima G, Amaral G, Apel S, Kästner C, Ribeiro M, Gheyi R (2019) An investigation of misunderstanding code patterns in c open-source software projects. Empir Softw Eng 24:1693–1726

    Article  Google Scholar 

  • Mehlhorn N, Hanenberg S (2022) Imperative versus declarative collection processing: an rct on the understandability of traditional loops versus the stream api in java. In: Proceedings of the 44th international conference on software engineering, pp 1157–1168

  • Munaiah N, Kroh S, Cabrey C, Nagappan M (2017) Curating github for engineered software projects. Empir Softw Eng 22(6):3219–3253

    Article  Google Scholar 

  • Myers L, Sirois MJ (2004) Spearman correlation coefficients, differences between. Encyclopedia of Statistical Sciences 12

  • Palomba F, Bavota G, Di Penta M, Fasano F, Oliveto R, De Lucia A (2018) On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation. Empir Softw Eng 23(3):1188–1221. https://doi.org/10.1007/s10664-017-9535-z

    Article  Google Scholar 

  • Pankratius V, Schmidt F, Garretón G (2012) Combining functional and imperative programming for multicore software: an empirical study evaluating scala and java. In: 2012 34th International Conference on Software Engineering (ICSE). IEEE, pp 123–133

  • Pythonorg (2022a) Python 3.0 - what’s new https://docs.python.org/3.0/whatsnew/3.0.html 03 Mar 2022

  • Pythonorg (2022b) Python AST module https://docs.python.org/3/library/ast.html (last access: 03/10/2022)

  • Rahman F, Devanbu PT (2011) Ownership, experience and defects: a fine-grained study of authorship. In: Proceedings of the 33rd International conference on software engineering, ICSE 2011, Waikiki, Honolulu , HI, USA, May 21-28, 2011, pp 491–500

  • Rao AE, Chimalakonda S (2020) An exploratory study towards understanding lambda expressions in Python. In: Proceedings of the evaluation and assessment in software engineering, pp 318–323

  • Ray B, Hellendoorn V, Godhane S, Tu Z, Bacchelli A, Devanbu PT (2016) On the “naturalness” of buggy code. In: Proceedings of the 38th international conference on software engineering, ICSE 2016, Austin, TX, USA, May 14-22, 2016, pp 428–439. https://doi.org/10.1145/2884781.2884848

  • Ray B, Posnett D, Filkov V, Devanbu PT (2014) A large scale study of programming languages and code quality in github. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering, pp 155–165

  • Rupert G, Miller J (2011) Survival analysis, 2nd edn. John Wiley and Sons

    Google Scholar 

  • Salvaneschi G, Proksch S, Amann S, Nadi S, Mezini M (2017) On the positive effect of reactive programming on software comprehension: an empirical study. IEEE Trans Softw Eng PP:1–1. https://doi.org/10.1109/TSE.2017.2655524

    Article  Google Scholar 

  • Schröter I, Krüger J, Siegmund J, Leich T (2017) Comprehending studies on program comprehension. In: 2017 IEEE/ACM 25th International Conference on Program Comprehension (ICPC). IEEE, pp 308–311

  • Shepperd M (1988) A critique of cyclomatic complexity as a software metric. Softw Eng J 3(2):30–36

    Article  Google Scholar 

  • Siegmund J, Kästner C, Liebig J, Apel S, Hanenberg S (2014) Measuring and modeling programming experience. Empir Softw Eng 19(5):1299–1334. https://doi.org/10.1007/S10664-013-9286-4

    Article  Google Scholar 

  • Sliwerski J, Zimmermann T, Zeller A (2005) When do changes induce fixes? In: Proceedings of the 2005 international workshop on mining software repositories, MSR 2005, Saint Louis, Missouri, USA, May 17, 2005

  • Spadini D, Aniche MF, Bacchelli A (2018) Pydriller: python framework for mining software repositories. In: Leavens GT, Garcia A, Pasareanu CS (eds) Proceedings of the 2018 ACM joint meeting on european software engineering conference and symposium on the foundations of software engineering, ESEC/SIGSOFT FSE 2018, Lake Buena Vista, FL, USA, November 04-09, 2018. ACM, pp 908–911. https://doi.org/10.1145/3236024.3264598

  • Switowskicom (2022) For loop vs. list comprehension https://switowski.com/blog/for-loop-vs-list-comprehension (last access: 03/10/2022)

  • Tanaka H, Matsumoto S, Kusumoto S (2019) A study on the current status of functional idioms in Java. IEICE Trans Inf Syst 102(12):2414–2422

    Article  Google Scholar 

  • Therneau TM (2023) A Package for Survival Analysis in R. https://CRAN.R-project.org/package=survival, r package version 3.5-7

  • Tsantalis N, Mazinanian D, Rostami S (2017) Clone refactoring with lambda expressions. In: Uchitel S, Orso A, Robillard MP (Eds) Proceedings of the 39th International conference on software engineering, ICSE 2017, Buenos Aires, Argentina, May 20-28, 2017. IEEE / ACM, pp 60–70

  • Tufano M, Palomba F, Bavota G, Oliveto R, Di Penta M, De Lucia A, Poshyvanyk D (2017b) When and why your code starts to smell bad (and whether the smells go away). IEEE Trans Software Eng 43(11):1063–1088. https://doi.org/10.1109/TSE.2017.2653105

    Article  Google Scholar 

  • Tufano M, Bavota G, Poshyvanyk D, Di Penta M, Oliveto R, De Lucia A (2017a) An empirical study on developer-related factors characterizing fix-inducing commits. J Softw Evol Process 29(1). https://doi.org/10.1002/smr.1797

  • Uesbeck PM, Stefik A, Hanenberg S, Pedersen J, Daleiden P (2016) An empirical study on the impact of c++ lambdas and programmer experience. In: Proceedings of the 38th international conference on software engineering, pp 760–771

  • Vandeput N (2022) List comprehensions vs. for loops: It is not what you think. https://towardsdatascience.com/list-comprehensions-vs-for-loops-it-is-not-what-you-think-34071d4d8207, (Last access: 03/10/2022)

  • Zampetti F, Belias F, Zid C, Antoniol G, Penta MD (2022) An empirical study on the fault-inducing effect of functional constructs in python. In: IEEE International conference on software maintenance and evolution, ICSME 2022, Limassol, Cyprus, October 3-7, 2022. IEEE, pp 47–58. https://doi.org/10.1109/ICSME55016.2022.00013

  • Zampetti F, Zid C, Antoniol G, Di Penta M (2024). The dark side of functional constructs: a quantitative and qualitative analysis of their fix-inducing effects. https://doi.org/10.5281/zenodo.11403724

  • Zhang Z, Xing Z, Xia X, Xu X, Zhu L (2022) Making python code idiomatic by automatic refactoring non-idiomatic python code with pythonic idioms. In: Proceedings of the 30th ACM joint European software engineering conference and symposium on the foundations of software engineering, ESEC/FSE 2022, Singapore, Singapore, November 14-18, 2022. ACM, pp 696–708

  • Zhang Z, Xing Z, Xia X, Xu X, Zhu L, Lu Q (2023) Faster or slower? performance mystery of python idioms unveiled with empirical evidence. In: 45th IEEE/ACM International conference on software engineering, ICSE 2023, Melbourne, Australia, May 14-20, 2023. IEEE, pp 1495–1507

  • Zheng M, Yang J, Wen M, Zhu H, Liu Y, Jin H (2021) Why do developers remove lambda expressions in Java? In: 2021 36th IEEE/ACM international conference on Automated Software Engineering (ASE). IEEE, pp 67–78

  • Zid C, Belias F, Khomh F, Di Penta M, Antoniol G (2024a) List comprehension versus for loops performance in real python projects: should we care? In: IEEE International conference on software analysis, evolution and reengineering (SANER 2024), Tue 12 - Fri 15 March 2024 Rovaniemi , Finland. ACM/IEEE

  • Zid C, Zampetti F, Antoniol G, Di Penta M (2024b) A study on the pythonic functional constructs’ understandability. In: Proceedings of the 45th ACM/IEEE International conference on software engineering (ICSE 2024), May 14-20 2024, Lisbon, Portugal. ACM/IEEE

Download references

Acknowledgements

Massimiliano Di Penta acknowledges the Italian PRIN 2020 Project EMELIOT “Engineered MachinE Learning-intensive IoT systems”, ID 2020W3A5FY. Fiorella Zampetti is partially funded by the PON DM 1062/2021 Italian Grant.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fiorella Zampetti.

Ethics declarations

Conflicts of Interest

The authors have no conflicts of interest to declare that are relevant to the content of this article.

Additional information

Communicated by: Alexandre Bergel

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zampetti, F., Zid, C., Antoniol, G. et al. The downside of functional constructs: a quantitative and qualitative analysis of their fix-inducing effects. Empir Software Eng 30, 9 (2025). https://doi.org/10.1007/s10664-024-10568-z

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10664-024-10568-z

Keywords

Navigation