arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.14431cs.SE
收藏

深入理解 NPM 生态系统中的破坏性变更

Towards Better Comprehension of Breaking Changes in the NPM Ecosystem

Dezhen Kong, Jiakun Liu, Lingfeng Bao, David Lo

AI总结:

针对NPM生态系统破坏性变更带来的高昂维护成本,本文构建了381个项目的数据集,系统分类了语法与行为破坏性变更及其成因,并为自动化检测与重命名技术提供了改进建议。

摘要:

破坏性变更给下游和上游开发者带来大量工作量:下游开发者需要适应破坏性变更,上游开发者负责识别并记录这些变更。在以频繁代码变更和对破坏性变更高容忍度著称的 NPM 生态系统中,工作量更大。为了更好地理解 NPM 生态系统中的破坏性变更并增强破坏性变更检测工具,我们开展了一项大规模实证研究来调查 NPM 生态系统中的破坏性变更。我们构建了一个包含 381 个流行 NPM 项目中明确记录的破坏性变更的数据集。我们发现 95.4% 的检测到的破坏性变更可以被开发者的文档覆盖,约 19% 的破坏性变更无法通过回归测试检测到。随后在调查收集到的破坏性变更源代码的过程中,我们得出了 JavaScript 和 TypeScript 特有的语法破坏性变更分类法,以及主要行为破坏性变更类型的分类法。此外,我们调查了开发者在 NPM 中进行破坏性变更的原因,发现三个主要原因,即减少代码冗余、改善标识符名称和改善 API 设计,每个类别包含若干子项。我们为未来研究提供了可操作的建议,例如应在 JavaScript 项目中应用自动命名和重命名技术以改善标识符名称,未来研究可尝试检测更多类型的行为破坏性变更。在提出建议的同时,我们还讨论了自动重命名和破坏性变更检测方法的弱点。

英文摘要:

Breaking changes cause a lot of effort to both downstream and upstream developers: downstream developers need to adapt to breaking changes and upstream developers are responsible for identifying and documenting them. In the NPM ecosystem, characterized by frequent code changes and a high tolerance for making breaking changes, the effort is larger. For better comprehension of breaking changes in the NPM ecosystem and to enhance breaking change detection tools, we conduct a large-scale empirical study to investigate breaking changes in the NPM ecosystem. We construct a dataset of explicitly documented breaking changes from 381 popular NPM projects. We find that 95.4% of the detected breaking changes can be covered by developers' documentation, and about 19% of the breaking changes cannot be detected by regression testing. Then in the process of investigating source code of our collected breaking changes, we yield a taxonomy of JavaScript and TypeScript-specific syntactic breaking changes and a taxonomy of major types of behavioral breaking changes. Additionally, we investigate the reasons why developers make breaking changes in NPM and find three major reasons, i.e., to reduce code redundancy, to improve identifier name, and to improve API design, and each category contains several sub-items. We provide actionable implications for future research, e.g., automatic naming and renaming techniques should be applied in JavaScript projects to improve identifier names, future research can try to detect more types of behavioral breaking changes. By presenting the implications, we also discuss the weakness of automatic renaming and breaking change detection approaches.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑