Skip to main content
Erschienen in: Empirical Software Engineering 1/2019

02.05.2018

Programmers do not favor lambda expressions for concurrent object-oriented code

verfasst von: Sebastian Nielebock, Robert Heumüller, Frank Ortmeier

Erschienen in: Empirical Software Engineering | Ausgabe 1/2019

Einloggen

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

Lambda expressions have long been state-of-the-art in the functional programming paradigm. Especially with regard to the use of higher-order functions, they provide developers with a means of defining predicate or projection functions locally, which greatly increases the comprehensibility of the resulting source code. This benefit has motivated language designers to also incorporate lambda expressions into object-oriented (OO) programming languages. In particular, they are claimed to facilitate concurrent programming. One likely reason for this assumption is their purity: pure lambda expressions are free of side effects, and therefore cannot cause, e.g., race conditions. In this paper, we present the first empirical analysis of whether or not this claim is true for OO projects. For this purpose, we investigated the application of lambda expressions in 2923 open-source projects, implemented in one of the most common OO programming languages: C#, C++, and Java. We present three major findings. First, the majority of lambda expressions are not applied in concurrent code and most concurrent code does not make use of lambda expressions. Second, for all three of the languages, we observed that developers compromise their code by applying a significantly higher number of impure, capturing lambda expressions, which are capable of causing race conditions. Finally, we explored further use cases of lambda expressions and found out that testing, algorithmic implementation, and UI are far more common use-cases for the application of lambda expressions. Our results encourage to investigate in more detail the reasons that hinder programmers to apply lambda expressions in concurrent programming and to support developers, e.g., by providing automatic refactorings.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Fußnoten
1
Sometimes they are also referred to as the overall concept of closures.
 
3
TIOBE Index January’16, RedMonk Programming Language Ranking January’16, PYPL PopularitY of Programming Language January’16
 
4
C# used delegates since its first version, which represent a kind of function pointers
 
6
A variable is called effectively final if there is no further write access to this variable after its initialization.
 
7
The same behavior can be achieved by assigning the variable i to an effectively final local variable in the loop’s body and capture this value in the lambda expression
 
13
February 5th, 2018
 
Literatur
Zurück zum Zitat Barr M (1999) Programming embedded systems in C and C++. O’Reilly Media, Inc, Sebastopol Barr M (1999) Programming embedded systems in C and C++. O’Reilly Media, Inc, Sebastopol
Zurück zum Zitat Ben-Ari M (2006) Principles of concurrent and distributed programming, 2nd edn. Pearson Education Limited, EnglandMATH Ben-Ari M (2006) Principles of concurrent and distributed programming, 2nd edn. Pearson Education Limited, EnglandMATH
Zurück zum Zitat Borges H, Hora A, Valente MT (2016) Understanding the factors that impact the popularity of GitHub repositories. In: Proceedings of the 32nd IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 334–344. https://doi.org/10.1109/ICSME.2016.31 Borges H, Hora A, Valente MT (2016) Understanding the factors that impact the popularity of GitHub repositories. In: Proceedings of the 32nd IEEE international conference on software maintenance and evolution (ICSME). IEEE, pp 334–344. https://​doi.​org/​10.​1109/​ICSME.​2016.​31
Zurück zum Zitat Coblenz M, Nelson W, Aldrich J, Myers B, Sunshine J (2017) Glacier: transitive class immutability for java. In: Proceedings of the 39th international conference of software engineering (ICSE). IEEE Press, Piscataway, pp 496–506. https://doi.org/10.1109/ICSE.2017.52 Coblenz M, Nelson W, Aldrich J, Myers B, Sunshine J (2017) Glacier: transitive class immutability for java. In: Proceedings of the 39th international conference of software engineering (ICSE). IEEE Press, Piscataway, pp 496–506. https://​doi.​org/​10.​1109/​ICSE.​2017.​52
Zurück zum Zitat Costa D, Andrzejak A, Seboek J, Lo D (2017) Empirical study of usage and performance of java collections. In: Proceedings of the 8th ACM/SPEC on international conference on performance engineering (ICPE). ACM, New York, pp 389–400. https://doi.org/10.1145/3030207.3030221 Costa D, Andrzejak A, Seboek J, Lo D (2017) Empirical study of usage and performance of java collections. In: Proceedings of the 8th ACM/SPEC on international conference on performance engineering (ICPE). ACM, New York, pp 389–400. https://​doi.​org/​10.​1145/​3030207.​3030221
Zurück zum Zitat De Wael M, Marr S, Van Cutsem T (2014) Fork/join parallelism in the wild: documenting patterns and anti-patterns in java programs using the fork/join framework. In: Proceedings of the 11th international conference on principles and practices of programming on the java platform: virtual machines, languages, and tools (PPPJ). ACM, New York, pp 39–50. https://doi.org/10.1145/2647508.2647511 De Wael M, Marr S, Van Cutsem T (2014) Fork/join parallelism in the wild: documenting patterns and anti-patterns in java programs using the fork/join framework. In: Proceedings of the 11th international conference on principles and practices of programming on the java platform: virtual machines, languages, and tools (PPPJ). ACM, New York, pp 39–50. https://​doi.​org/​10.​1145/​2647508.​2647511
Zurück zum Zitat Dyer R, Rajan H, Nguyen HA, Nguyen TN (2014) Mining billions of AST nodes to study actual and potential usage of java language features. In: Proceedings of the 36th international conference on software engineering (ICSE). ACM, New York, pp 779–790. https://doi.org/10.1145/2568225.2568295 Dyer R, Rajan H, Nguyen HA, Nguyen TN (2014) Mining billions of AST nodes to study actual and potential usage of java language features. In: Proceedings of the 36th international conference on software engineering (ICSE). ACM, New York, pp 779–790. https://​doi.​org/​10.​1145/​2568225.​2568295
Zurück zum Zitat Dyer R, Nguyen HA, Rajan H, Nguyen TN (2015) Boa: ultra-large-scale software repository and source-code mining. ACM Trans Softw Eng Methodol 25(1):7:1–7:34CrossRef Dyer R, Nguyen HA, Rajan H, Nguyen TN (2015) Boa: ultra-large-scale software repository and source-code mining. ACM Trans Softw Eng Methodol 25(1):7:1–7:34CrossRef
Zurück zum Zitat Garcia R, Jarvi J, Lumsdaine A, Siek JG, Willcock J (2003) A comparative study of language support for generic programming. In: Proceedings of the 18th annual ACM SIGPLAN conference on object-oriented programming, systems, languages, and applications (OOPSLA), pp 115–134 Garcia R, Jarvi J, Lumsdaine A, Siek JG, Willcock J (2003) A comparative study of language support for generic programming. In: Proceedings of the 18th annual ACM SIGPLAN conference on object-oriented programming, systems, languages, and applications (OOPSLA), pp 115–134
Zurück zum Zitat Gu R, Jin G, Song L, Zhu L, Lu S (2015) What change history tells us about thread synchronization. In: Proceedings of the 10th joint meeting of the european software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering (ESEC/FSE). ACM, New York, pp 426–438. https://doi.org/10.1145/2786805.2786815 Gu R, Jin G, Song L, Zhu L, Lu S (2015) What change history tells us about thread synchronization. In: Proceedings of the 10th joint meeting of the european software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering (ESEC/FSE). ACM, New York, pp 426–438. https://​doi.​org/​10.​1145/​2786805.​2786815
Zurück zum Zitat Gyori A, Franklin L, Dig D, Lahoda J (2013) Crossing the gap from imperative to functional programming through refactoring. In: Proceedings of the 9th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering (ESEC/FSE). ACM, pp 543–553 Gyori A, Franklin L, Dig D, Lahoda J (2013) Crossing the gap from imperative to functional programming through refactoring. In: Proceedings of the 9th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering (ESEC/FSE). ACM, pp 543–553
Zurück zum Zitat Hill E, Pollock L, Vijay-Shanker K (2009) Automatically capturing source code context of NL-queries for software maintenance and reuse. In: Proceedings of the 31st international conference on software engineering (ICSE). IEEE, pp 232–242 Hill E, Pollock L, Vijay-Shanker K (2009) Automatically capturing source code context of NL-queries for software maintenance and reuse. In: Proceedings of the 31st international conference on software engineering (ICSE). IEEE, pp 232–242
Zurück zum Zitat Jarczyk O, Gruszka B, Jaroszewicz S, Bukowski L, Wierzbicki A (2014) GitHub projects. quality analysis of open-source software. In: Aiello LM, McFarland D (eds) Proceedings of the 6th international conference on social informatics (SocInfo). Springer International Publishing, Cham, pp 80–94. https://doi.org/10.1007/978-3-319-13734-6_6 Jarczyk O, Gruszka B, Jaroszewicz S, Bukowski L, Wierzbicki A (2014) GitHub projects. quality analysis of open-source software. In: Aiello LM, McFarland D (eds) Proceedings of the 6th international conference on social informatics (SocInfo). Springer International Publishing, Cham, pp 80–94. https://​doi.​org/​10.​1007/​978-3-319-13734-6_​6
Zurück zum Zitat Kim D, Murphy-Hill E, Parnin C, Bird C, Garcia R (2013) The reaction of open-source projects to new language features: an empirical study of C# generics. Journal of Object Technology 12(4):1:1–1:31CrossRef Kim D, Murphy-Hill E, Parnin C, Bird C, Garcia R (2013) The reaction of open-source projects to new language features: an empirical study of C# generics. Journal of Object Technology 12(4):1:1–1:31CrossRef
Zurück zum Zitat Lin Y, Dig D (2013) Check-then-act misuse of java concurrent collections. In: Proceedings of the 6th international conference on software testing, verification and validation (ICST). IEEE, pp 164–173 Lin Y, Dig D (2013) Check-then-act misuse of java concurrent collections. In: Proceedings of the 6th international conference on software testing, verification and validation (ICST). IEEE, pp 164–173
Zurück zum Zitat Lin Y, Radoi C, Dig D (2014) Retrofitting concurrency for android applications through refactoring. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering (FSE). ACM, New York, pp 341–352. https://doi.org/10.1145/2635868.2635903 Lin Y, Radoi C, Dig D (2014) Retrofitting concurrency for android applications through refactoring. In: Proceedings of the 22nd ACM SIGSOFT international symposium on foundations of software engineering (FSE). ACM, New York, pp 341–352. https://​doi.​org/​10.​1145/​2635868.​2635903
Zurück zum Zitat Martelli A, Ravenscroft A, Ascher D (eds) (2005) Python cookbook, vol 2. O’Reilly Media Inc, Sebastopol Martelli A, Ravenscroft A, Ascher D (eds) (2005) Python cookbook, vol 2. O’Reilly Media Inc, Sebastopol
Zurück zum Zitat Miller W, Myers EW (1985) A file comparison program. Software: Practice and Experience 15(11):1025–1040 Miller W, Myers EW (1985) A file comparison program. Software: Practice and Experience 15(11):1025–1040
Zurück zum Zitat Pankratius V, Schmidt F, Garretón G (2012) Combining functional and imperative programming for multicore software: an empirical study evaluating scala and java. In: Proceedings of the 34th international conference on software engineering (ICSE). IEEE Press, Piscataway, pp 123–133. http://dl.acm.org/citation.cfm?id=2337223.2337238 Pankratius V, Schmidt F, Garretón G (2012) Combining functional and imperative programming for multicore software: an empirical study evaluating scala and java. In: Proceedings of the 34th international conference on software engineering (ICSE). IEEE Press, Piscataway, pp 123–133. http://​dl.​acm.​org/​citation.​cfm?​id=​2337223.​2337238
Zurück zum Zitat Parnin C, Bird C, Murphy-Hill E (2011) Java generics adoption: how new features are introduced, championed, or ignored. In: Proceedings of the 8th working conference on mining software repositories (MSR). ACM, pp 3–12 Parnin C, Bird C, Murphy-Hill E (2011) Java generics adoption: how new features are introduced, championed, or ignored. In: Proceedings of the 8th working conference on mining software repositories (MSR). ACM, pp 3–12
Zurück zum Zitat Parnin C, Bird C, Murphy-Hill E (2013) Adoption and use of java generics. Empir Softw Eng (EMSE) 18(6):1047–1089CrossRef Parnin C, Bird C, Murphy-Hill E (2013) Adoption and use of java generics. Empir Softw Eng (EMSE) 18(6):1047–1089CrossRef
Zurück zum Zitat Parr T (2013) The definitive ANTLR 4 reference, 2nd edn. The Pragmatic Programmers, Raleigh Parr T (2013) The definitive ANTLR 4 reference, 2nd edn. The Pragmatic Programmers, Raleigh
Zurück zum Zitat Stefik A, Hanenberg S (2014) The programming language wars: questions and responsibilities for the programming language community. In: Proceedings of the 13th ACM international symposium on new ideas, new paradigms, and reflections on programming & software (Onward!). ACM, pp 283–299 Stefik A, Hanenberg S (2014) The programming language wars: questions and responsibilities for the programming language community. In: Proceedings of the 13th ACM international symposium on new ideas, new paradigms, and reflections on programming & software (Onward!). ACM, pp 283–299
Zurück zum Zitat Torres W, Pinto G, Fernandes B, Oliveira JP, Ximenes FA, Castor F (2011) Are java programmers transitioning to multicore?: a large scale study of java FLOSS. In: Proceedings of the compilation of the co-located workshops on DSM’11, TMC’11, AGERE! 2011, AOOPES’11, NEAT’11, & VMIL’11. ACM, New York, pp 123–128. https://doi.org/10.1145/2095050.2095072 Torres W, Pinto G, Fernandes B, Oliveira JP, Ximenes FA, Castor F (2011) Are java programmers transitioning to multicore?: a large scale study of java FLOSS. In: Proceedings of the compilation of the co-located workshops on DSM’11, TMC’11, AGERE! 2011, AOOPES’11, NEAT’11, & VMIL’11. ACM, New York, pp 123–128. https://​doi.​org/​10.​1145/​2095050.​2095072
Zurück zum Zitat 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 (ICSE). ACM, pp 760–771 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 (ICSE). ACM, pp 760–771
Zurück zum Zitat Wang X, Pollock L, Vijay-Shanker K (2017) Automatically generating natural language descriptions for object-related statement sequences. In: Proceedings of the 24th international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 205–216 Wang X, Pollock L, Vijay-Shanker K (2017) Automatically generating natural language descriptions for object-related statement sequences. In: Proceedings of the 24th international conference on software analysis, evolution and reengineering (SANER). IEEE, pp 205–216
Metadaten
Titel
Programmers do not favor lambda expressions for concurrent object-oriented code
verfasst von
Sebastian Nielebock
Robert Heumüller
Frank Ortmeier
Publikationsdatum
02.05.2018
Verlag
Springer US
Erschienen in
Empirical Software Engineering / Ausgabe 1/2019
Print ISSN: 1382-3256
Elektronische ISSN: 1573-7616
DOI
https://doi.org/10.1007/s10664-018-9622-9

Weitere Artikel der Ausgabe 1/2019

Empirical Software Engineering 1/2019 Zur Ausgabe