[论文解读] An Empirical Study on the Impact of Refactoring Activities on Evolving Client-Used APIs
本实证研究分析了在183个版本的八个流行Java库中,重构对客户端使用API的影响,利用自动化工具检测到12,900次重构和9,700次API破坏。研究发现,仅有37%的客户端使用API破坏是由重构直接引起的,其余部分则由错误修复和功能新增驱动,表明尽管存在重构活动,库维护者仍优先考虑向后兼容性。
Context: Refactoring is recognized as an effective practice to maintain evolving software systems. For software libraries, we study how library developers refactor their Application Programming Interfaces (APIs), especially when it impacts client users by breaking an API of the library. Objective: Our work aims to understand how clients that use a library API are affected by refactoring activities. We target popular libraries that potentially impact more library client users. Method: We distinguish between library APIs based on their client-usage (refereed to as client-used APIs) in order to understand the extent to which API breakages relate to refactorings. Our tool-based approach allows for a large-scale study across eight libraries (i.e., totaling 183 consecutive versions) with around 900 clients projects. Results: We find that library maintainers are less likely to break client-used API classes. Quantitatively, we find that refactoring activities break less than 37% of all client-used APIs. In a more qualitative analysis, we show two documented cases of where non-refactoring API breaking changes are motivated other maintenance issues (i.e., bug fix and new features) and involve more complex refactoring operations. Conclusion: Using our automated approach, we find that library developers are less likely to break APIs and tend to break client-used APIs when addressing these maintenance issues.
研究动机与目标
- 理解重构活动如何影响演化软件库中客户端使用的API。
- 调查客户端使用API中的API破坏在多大程度上由重构而非其他维护活动引起。
- 评估库维护者在重构面向客户端的API时是否优先考虑向后兼容性。
- 提供一个大规模、基于工具的API破坏与重构数据集,以支持复现和进一步研究。
提出的方法
- 使用自动化静态分析检测八个流行Java库在183个连续版本中的重构操作(例如,move_method、rename_method)。
- 通过字节码分析比较库版本之间的二进制兼容性,识别API破坏。
- 通过挖掘实际客户端项目(约900个项目)确定API的客户端使用情况,识别出被积极使用的API。
- 应用非参数统计检验分析重构类型与API破坏频率之间的关系。
- 创建包含完整重构与破坏数据集的复现包,并公开发布。
实验结果
研究问题
- RQ1在演化软件库中,客户端使用的API因重构活动而破坏的程度如何?
- RQ2客户端使用API与非客户端使用API在重构频率和类型上存在哪些差异?
- RQ3未由重构引起的剩余API破坏由什么驱动?它们与错误修复或功能新增等维护任务有何关联?
- RQ4某些重构类型(例如,rename_method、move_field)是否比其他类型更可能破坏客户端使用的API?
主要发现
- 仅有37%的客户端使用API破坏是由重构操作直接引起的,表明大多数破坏源于非重构活动。
- 与内部类或非客户端使用类相比,库维护者显著更少破坏客户端使用的API。
- 其余63%的API破坏主要由非重构维护任务(如错误修复和功能新增)驱动。
- 像move_method、rename_method和move_field这样的简单重构,相较于其他类,更少应用于客户端使用的API。
- 本研究发现,复杂重构常涉及非重构驱动的破坏,表明存在更深层次的设计或维护挑战。
- 公开发布的12,900次重构与9,700次API破坏数据集,为未来API演化研究的复现和工具开发提供了支持。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。