arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.11269cs.SE
收藏

方法链接Redux:Java、Kotlin和Python中方法链接的实证研究

Method Chaining Redux: An Empirical Study of Method Chaining in Java, Kotlin, and Python

Ali M. Keshk, Robert Dyer

摘要:

将方法链接在一起可能有好处和缺点,就像在流畅的API中经常做的那样。之前的一项研究调查了Java开发人员如何在超过2700个开源项目中链接方法。该研究观察到,对于所分析的数据集,Java中方法链的使用很流行,并且似乎随着时间的推移而增加。然而,该研究仅限于较小的Java项目样本,并且也不清楚结果是否适用于其他语言。在这项工作中,我们首先通过构建类似的数据集和我们自己的分析脚本来复制先前的结果。然后,我们通过分析89k个Java项目的更大数据集来扩展这些结果,并通过分析26k个Kotlin项目和98k个Python项目来推广到其他程序设计语言。结果显示,链接在Java和Kotlin中比Python更受欢迎,Kotlin中的链接使用没有增长,Python在非测试代码中的使用更多。

英文摘要:

There are possible benefits and drawbacks to chaining methods together, as is often done in fluent APIs. A prior study investigated how Java developers chain methods in over 2.7k open-source projects. That study observed, for the dataset analyzed, that the use of method chaining in Java is popular and seems to be increasing over time. That study however was limited to a smaller sample of Java projects, and it is also not clear if the results generalize to other languages. In this work, we first replicate the prior results by building a similar dataset and our own analysis scripts. We then extend those results by analyzing a much larger dataset of 89k Java projects and generalizing to other programming languages by analyzing 26k Kotlin projects and 98k Python projects. The results show chaining is more popular in Java and Kotlin than Python, chaining use in Kotlin is not growing, and Python sees more use in non-testing code.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑