An empirical study on the impact of C++ lambdas and programmer experience

Author(s): Phillip Merlin Uesbeck, Andreas Stefik, Stefan Hanenberg, Jan Pedersen, Patrick Daleiden
Venue: International Conference on Software Engineering
Date: 2016

Type of Experiement: Controlled Experiment
Sample Size: 58
Class/Experience Level: Undergraduate Student, Professional
Participant Selection: student classwork and experience level
Data Collection Method: Observation, Project Artifact(s)


Lambda Expressions have made their way into Java 8 and C++ version 11, however there is no consensus on whether they are truly beneficial to developers. This paper reports on the first ever controlled trial that was conducted on the developer impact of lambda expressions versus normal iterators. There has been plenty of literature about the performance benefits of lambda expressions, but none about the human factors of using them in code.

This experiment recruited undergraduate students of various skill levels and working professionals with thus a higher experience level. The experiment had two groups, one using lambda expressions and one using iterators which was the control group. Using Iterators was chosen as the control group because blogs and scholarly work consistently claimed that this was the context in which lambdas were supposedly better. Each group was given the same four programming tasks in C++ 11 to complete. The development time and compiler errors for each task were recorded in the experiment.

The results showed that students are negatively impacted by lambda expressions in regard to how quickly they can write correct programs to a test specification and whether they can complete a task. The analysis from log data shows that participants spent more time with compiler errors, and thus have more errors, when using lambdas as compared to iterators. The more experienced users were able to complete the task with or without lambdas, but would do so much faster with iterators. Lambda expressions negatively affected the development time of producing software.