Much of software development revolves around understanding the relationship between software changes and their effects. If we could learn and predict those relationships, such predictions could benefit several areas of software engineering. While recent advances in artificial intelligence have shown great promise in software engineering tasks, predicting the semantics of code without executing it remains a big challenge. In this paper, we present Neural Change Prediction, a novel and fundamental technique to learn and predict associations between software changes and their dynamic effects on program behavior. Specifically, for a given program and test inputs, we automatically apply numerous mutations to the code and observe how these changes alter the program's output. From these (changes to software, changes in behavior)-pairs, we create models that: (1) for a desired change in behavior, predict where and how the code should be changed (feature localization, software evolution, and software repair); and (2) for a given code change, predict how this code change affects the output (effect prediction). We have conducted a detailed case study on CSS configuration files and an evaluation on Python programs to demonstrate the generality and wide applicability of Neural Change Prediction. While Neural Change Prediction requires numerous mutations (and thus numerous executions of the program under test), Neural Change Prediction is fully automatic and does not require any prior knowledge of the code or its semantics, making it applicable to any software artifact that can be executed and whose output can be observed.
翻译:软件开发工作的很大一部分围绕理解软件变更及其影响之间的关系展开。如果我们能够学习并预测这些关系,此类预测可惠及软件工程的多个领域。尽管近期人工智能的进展在软件工程任务中展现出巨大潜力,但在不执行代码的情况下预测其语义仍是一项重大挑战。本文提出神经变化预测(Neural Change Prediction),这是一种新颖的基础性技术,用于学习并预测软件变更与其对程序行为的动态影响之间的关联。具体而言,针对给定程序和测试输入,我们自动向代码施加大量突变,并观察这些变更如何改变程序的输出。通过这些(软件变更-行为变化)配对,我们构建了以下模型:(1)针对期望的行为变化,预测应在何处以及如何修改代码(特征定位、软件演化与软件修复);(2)针对给定的代码变更,预测该变更如何影响输出(影响预测)。我们通过对CSS配置文件进行详细案例研究,并在Python程序上开展评估,验证了神经变化预测的通用性与广泛适用性。尽管神经变化预测需要大量突变(进而需要大量执行被测程序),但该技术完全自动化,无需任何关于代码或其语义的先验知识,因而可适用于任何可执行且其输出可观测的软件制品。