一句话:大规模实证分析 12 个 JavaScript/TypeScript 可替代特性的演化趋势、使用模式与代码坏味。
JavaScript 为同一任务提供多种特性实现方式(feature alternatives),但误用或组合使用易使代码脆弱难维护。现有工作多聚焦单一特性,缺乏对替代特性不当使用所产生负面模式的认识。本文收集 3,066 个开源项目版本,对 12 个具有替代实现的 JavaScript/TypeScript 特性进行大规模实证分析,考察其演化趋势、使用模式与代码坏味,并设计基于查询的启发式检测方法 DiTU 以支撑仓库级特性使用分析。研究揭示 12 种使用模式,其中 7 种被判定为代码坏味模式,并提出 9 个度量指标,为语言设计者、开发者与工具构建者提供洞见。
JavaScript offers a wide range of language features, providing developers with multiple ways—known as feature alternatives—to accomplish tasks. While this flexibility is beneficial, improper usage of feature alternatives can lead to code being bug-prone and challenging to maintain. Therefore, exploring how language feature alternatives are utilized in the wild is vital to providing valuable insights for the language community. Existing research has studied individual JavaScript features; however, there is still a gap in understanding the negative patterns that arise from the improper or combined use of feature alternatives. To fill this gap, we collected 3,066 open-source project versions and conducted a comprehensive empirical analysis of twelve JavaScript (and TypeScript) features with alternative implementations, revealing language feature alternatives’ evolving trends (RQ1), usage patterns (RQ2), and code smell issues (RQ3). To support this study, we also designed DiTU, a query-based heuristic feature usage analysis method to detect feature usage from large-scale repositories. Our study revealed twelve usage patterns, with seven of them further evaluated as code smell patterns. Additionally, we introduced nine insightful metrics that provide a deeper understanding of these patterns. Our results benefit language designers, users, and tool developers in navigating the evolving landscape of JavaScript.
@inproceedings{paperbot11894,
title = {Evolving Trends, Patterns, and Hidden Pitfalls: Unveiling JavaScript Feature Usage in the Wild},
author = {Dawei Chen and Wuxia Jin and Hui Guo and Guanlin Qiao and Peng Di and Ting Liu},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3764521}
}