一句话:通过挖掘 1.66 亿 Java 方法的频繁控制流子图,数据驱动地发现可新增语法糖以简化常见代码惯用法。
论文关注编程语言演化中语法糖设计长期依赖经验与直觉的问题。作者提出一种数据驱动的语言演化方法:将开源 Java 方法的控制流图进行泛化,以捕获更广泛的编程语言用法与重复模式,并在包含 166,827,154 个 Java 方法的超大规模数据集上应用频繁子图挖掘,从而识别可能带来显著影响的新语法糖机会。实验发现了一批涉及多种编程构造、可在 Java 中实现的新语法糖,它们能够简化频繁出现的代码惯用法。该工作为 Java 语言设计者提供有价值的数据证据,并作为数据驱动编程语言设计与演化的概念验证。
Programming languages are essential tools for developers, and their evolution plays a crucial role in supporting the activities of developers. One instance of programming language evolution is the introduction of syntactic sugars, which are additional syntax elements that provide alternative, more readable code constructs. However, the process of designing and evolving a programming language has traditionally been guided by anecdotal experiences and intuition. Recent advances in tools and methodologies for mining open-source repositories have enabled developers to make data-driven software engineering decisions. In light of this, this paper proposes an approach for motivating data-driven programming evolution by applying frequent subgraph mining techniques to a large dataset of 166,827,154 open-source Java methods. The dataset is mined by generalizing Java control-flow graphs to capture broad programming language usages and instances of duplication. Frequent subgraphs are then extracted to identify potentially impactful opportunities for new syntactic sugars. Our diverse results demonstrate the benefits of the proposed technique by identifying new syntactic sugars involving a variety of programming constructs that could be implemented in Java, thus simplifying frequent code idioms. This approach can potentially provide valuable insights for Java language designers, and serve as a proof-of-concept for data-driven programming language design and evolution.