通过自动化重构对新语言特性采用的前瞻性实证评估:Java 8默认方法的案例
Proactive Empirical Assessment of New Language Feature Adoption via Automated Refactoring: The Case of Java 8 Default Methods
摘要:
随着时间的推移,程序设计语言和平台不断改进,有时会产生新的语言功能,提供许多好处。然而,尽管有这些好处,开发人员可能并不总是愿意在他们的项目中采用它们。在本文中,我们描述了一个实证研究,我们评估通过一个特定的新的语言功能。研究开发人员如何使用(或不使用)新的语言功能在程序设计语言研究和工程中很重要,因为它使设计人员了解语言的可用性,从而用该语言创建有意义的程序。反过来,这些知识可以推动该领域未来的创新。在这里,我们探索Java 8默认方法,它允许接口包含(实例)方法实现。默认方法可以简化接口的演化,使某些普遍存在的设计模式变得多余,并提高模块性和可维护性。这项工作的重点是通过科学的方法和新的技术,发现开发人员发现这些构造有用的情况,以及它们没有的原因。虽然有几项研究围绕着评估新的语言特征,但据我们所知,这种结构以前没有被考虑过。尽管有这些好处,但我们发现开发人员并不是在所有情况下都采用默认方法。我们的研究包括提交pull request,将语言特性引入19个真实世界的开源Java项目,而不改变原始程序语义。这种新颖的评估技术是主动的,因为采用是由自动重构方法驱动的,而不是等待开发人员自己发现和集成功能。通过这种方式,我们提出了更早而不是更晚有效使用语言功能的最佳实践和模式,并且能够指导(不久的)未来的语言发展。我们预见这种技术在评估其他新的语言特性、设计模式和其他编程习惯方面是有用的。
英文摘要:
Programming languages and platforms improve over time, sometimes resulting in new language features that offer many benefits. However, despite these benefits, developers may not always be willing to adopt them in their projects for various reasons. In this paper, we describe an empirical study where we assess the adoption of a particular new language feature. Studying how developers use (or do not use) new language features is important in programming language research and engineering because it gives designers insight into the usability of the language to create meaning programs in that language. This knowledge, in turn, can drive future innovations in the area. Here, we explore Java 8 default methods, which allow interfaces to contain (instance) method implementations. Default methods can ease interface evolution, make certain ubiquitous design patterns redundant, and improve both modularity and maintainability. A focus of this work is to discover, through a scientific approach and a novel technique, situations where developers found these constructs useful and where they did not, and the reasons for each. Although several studies center around assessing new language features, to the best of our knowledge, this kind of construct has not been previously considered. Despite their benefits, we found that developers did not adopt default methods in all situations. Our study consisted of submitting pull requests introducing the language feature to 19 real-world, open source Java projects without altering original program semantics. This novel assessment technique is proactive in that the adoption was driven by an automatic refactoring approach rather than waiting for developers to discover and integrate the feature themselves. In this way, we set forth best practices and patterns of using the language feature effectively earlier rather than later and are able to possibly guide (near) future language evolution. We foresee this technique to be useful in assessing other new language features, design patterns, and other programming idioms.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。