Sebastian Nielebock, Robert Heumüller, Frank Ortmeier: Programmers do not Favor Lambda Expressions for Concurrent Object-Oriented Code. In: Springer Empirical Software Engineering (EMSE), 24 (1), S. 103–138, 2018, ISSN: 1382-3256.

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 2,923 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.

BibTeX (Download)

@article{NielebockLambda2018,
title = {Programmers do not Favor Lambda Expressions for Concurrent Object-Oriented Code},
author = {Sebastian Nielebock and Robert Heum\"{u}ller and Frank Ortmeier},
editor = {Springer},
url = {https://cse.cs.ovgu.de/cse-wordpress/wp-content/uploads/2018/11/2018-11-06-ESEC-FSE-Lambda-In-Concurrency_prepared_publication.pdf
https://cse.cs.ovgu.de/cse-wordpress/wp-content/uploads/2018/10/journal-emse-lambda-1.pdf
https://bitbucket.org/SNielebock/lambdainconcurrentdataset},
doi = {10.1007/s10664-018-9622-9},
issn = {1382-3256},
year  = {2018},
date = {2018-05-02},
journal = {Springer Empirical Software Engineering (EMSE)},
volume = {24},
number = {1},
pages = {103--138},
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 2,923 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.},
keywords = {Concurrency, Empirical Software Engineering, Lambda Expression, Misuses, Object-Orientation, Programming Language, Static Analysis},
pubstate = {published},
tppubtype = {article}
}