To implement important quality attributes of software such as architectural security tactics, developers incorporate API of software frameworks, as building blocks, to avoid re-inventing the wheel and improve their productivity. However, this is a challenging and error-prone task, especially for novice programmers. Despite the advances in the field of API-based program synthesis, the state-of-the-art suffers from a twofold shortcoming when it comes to architectural tactic implementation tasks. First, the specification of the desired tactic must be explicitly expressed, which is out of the knowledge of such programmers. Second, these approaches synthesize a block of code and leave the task of breaking it down into smaller pieces, adding each piece to the proper location in the code, and establishing correct dependencies between each piece and its surrounding environment as well as the other pieces, to the programmer. To mitigate these challenges, we introduce IPSynth, a novel inter-procedural program synthesis approach that automatically learns the specification of the tactic, synthesizes the tactic as inter-related code snippets, and adds them to an existing code base. We extend our first-place award-winning extended abstract recognized at the 36th IEEE/ACM International Conference on Automated Software Engineering (ASE'21) research competition track. In this paper, we provide the details of the approach, present the results of the experimental evaluation of IPSynth, and analyses and insights for a more comprehensive exploration of the research topic. Moreover, we compare the results of our approach to one of the most powerful code generator tools, ChatGPT. Our results show that our approach can accurately locate corresponding spots in the program, synthesize needed code snippets, add them to the program, and outperform ChatGPT in inter-procedural tactic synthesis tasks.
翻译:为了实现软件的重要质量属性(如架构安全策略),开发者通过集成软件框架的API作为构建模块来避免重复造轮子并提高生产效率。然而,这对新手程序员而言是一项具有挑战性且易出错的任务。尽管基于API的程序合成领域取得了进展,但在架构策略实现任务中,现有技术存在双重缺陷:首先,必须显式表达目标策略的规约,而这超出了此类程序员的知识范畴;其次,这些方法仅合成代码块,却将代码分解为多个片段、将各片段添加至代码中正确位置、以及建立各片段之间及其与周围环境的正确依赖关系等任务完全交由程序员完成。为解决这些挑战,本文提出IPSynth——一种新颖的跨过程程序合成方法,该方法可自动学习策略规约,将策略合成为相互关联的代码片段,并将其嵌入现有代码库。本文扩展了在第三十六届IEEE/ACM国际自动化软件工程会议(ASE'21)研究竞赛赛道中获得一等奖的扩展摘要。本文详细阐述了该方法,展示了IPSynth的实验评估结果,并对该研究课题进行了更全面的分析与洞见。此外,我们还将本方法与最强大的代码生成工具ChatGPT进行了结果比较。实验表明,本方法能精确定位程序中的对应位置,合成所需代码片段,将其嵌入程序,并在跨过程策略合成任务中优于ChatGPT。