Published in Proceedings of the National Software Application Conference (NASAC 2019), Hangzhou, China. 2019., 2019
In this paper, we investigate the use of higher-order functions in Scala programs. We collected 7,804 higher-order functions from 35 Scala projects in GitHub with the most stars and conducted an exploratory study via answering five research questions of using higher-order functions, including the data scale, the definitions and calls, the overlap with lambda expressions, the developer contribution, and the factor that affects the function calls. Our study mainly shows five empirical results about the common use of higher-order functions in Scala programs: higher-order functions are not widely used in Scala programs; most of higher-order functions are defined and called by the same developers; there exists a small overlap between calling higher-order functions and calling lambda expressions; top 20% of developers have contributed 81% of definitions and 86% of calls of higher-order functions; and the number of calls of higher-order functions correlates most with the number of executable lines of code and the code complexity. This study can be viewed as a preliminary result to understand the use of higher-order functions and to trigger further investigation in Scala programs.