An Empirical Study of Method Chaining in Java
Autor: | Tomoki Nakamaru, Tetsuro Yamazaki, Tomomasa Matsunaga, Soramichi Akiyama, Shigeru Chiba |
---|---|
Rok vydání: | 2020 |
Předmět: |
Java
Programming language Computer science media_common.quotation_subject Method chaining 020207 software engineering 02 engineering and technology computer.software_genre Software quality Programming style Style (sociolinguistics) Empirical research Quantitative analysis (finance) 0202 electrical engineering electronic engineering information engineering 020201 artificial intelligence & image processing Good practice computer computer.programming_language media_common |
Zdroj: | MSR |
Popis: | While some promote method chaining as a good practice for improving code readability, others refer to it as a bad practice that worsens code quality. In this paper, we first investigate whether method chaining is a programming style accepted by real-world programmers. To answer this question, we collected 2,814 Java repositories on GitHub and analyzed historical trends in the frequency of method chaining. The results of our analysis revealed the increasing use of method chaining; 23.1% of method invocations were part of method chains in 2018, whereas only 16.0% were such invocations in 2010. We then explore language features that are helpful to the method-chaining style but have not been supported yet in Java. For this aim, we conducted manual inspections of method chains that are randomly sampled from the collected repositories. We also estimated how effective they are to encourage the method-chaining style if they are adopted in Java. |
Databáze: | OpenAIRE |
Externí odkaz: |