Streaming APIs allow for big data processing of native data structures by providing MapReduce-like operations over these structures. However, unlike traditional big data systems, these data structures typically reside in shared memory accessed by multiple cores. Although popular, this emerging hybrid paradigm opens the door to possibly detrimental behavior, such as thread contention and bugs related to non-execution and non-determinism. This study explores the use and misuse of a popular streaming API, namely, Java 8 Streams. The focus is on how developers decide whether or not to run these operations sequentially or in parallel and bugs both specific and tangential to this paradigm. Our study involved analyzing 34 Java projects and 5.53 million lines of code, along with 719 manually examined code patches. Various automated, including interprocedural static analysis, and manual methodologies were employed. The results indicate that streams are pervasive, stream parallelization is not widely used, and performance is a crosscutting concern that accounted for the majority of fixes. We also present coincidences that both confirm and contradict the results of related studies. The study advances our understanding of streams, as well as benefits practitioners, programming language and API designers, tool developers, and educators alike.
|Raffi Khatchadourian||City University of New York (CUNY) Hunter College|
|Yiming Tang||City University of New York (CUNY) Graduate Center|
|Mehdi Bagherzadeh||Oakland University|
|Baishakhi Ray||Columbia University|
My and my research students‘ names are boldfaced, undergraduate students are italicized, and female students are underlined:
Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Baishakhi Ray. An empirical study on the use and misuse of Java 8 streams. In Heike Wehrheim and Jordi Cabot, editors, Fundamental Approaches to Software Engineering, FASE 2020, pages 97–118, Cham, April 2020. ETAPS, Springer International Publishing. (23/81; 28% acceptance rate). EAPLS Best Paper Award 🏆. [ bib | DOI | data | slides | http ]
Subject Source Code
The set of open-source Java projects packaged as Eclipse projects used in the stream usage and characteristics studies can be downloaded as an archive. Please refer to the included
README.md file for building instructions and the
LICENSE.md file for licensing information. Subject source code and version history for the stream bug study can be downloaded directly from GitHub.
The data set consisting of the raw results produced during our study can be found on Zenodo. The directory structure is as follows:
characteristics_subject_data.csv: General attributes of the subjects used for the stream characteristics analysis.
subject rawmay be the subproject for several subjects.
- Some metrics, e.g., SLOC, are only associated with the first subproject for a given subject.
characteristics_subject_ages.csv: Ages of the subjects used for the stream characteristics analysis.
characteristics_subject_entry_points.csv: Detailed info on entry points used in the analysis of the characteristics.
characteristics_stream_execution_modes.csv: Stream execution modes.
characteristics_stream_orderings.csv: Stream orderings.
characteristics_stream_attributes.csv: Stream side-effects and stateful intermediate operations (SIOs).
method_calls.csv: Raw data for the stream operation analysis.
method_calls_subjects.csv: Data on the subjects used for the method call analysis.
bugs.csv: Raw data for the stream bug study.