一句话:提出 TS-Detector 工具,从源码中检测五种 feature toggle 使用模式,并在多语言开源项目中评估。
特性开关(feature toggle)允许开发者控制功能状态,在保留整体软件功能的同时向有限用户发布功能。然而缺乏全面的最佳实践常导致不当实现,引发代码质量问题;某些开关使用模式容易产生 toggle smells,但目前没有工具能从源码检测这些使用模式。本文提出 TS-Detector,可检测五种开关使用模式:Spread、Nested、Dead、Mixed 和 Enum,并在六个编程语言的十个开源项目中应用。作者进行了人工评估,结果显示检测 Spread、Nested、Dead 的 true positive rate 分别为 80%、86.4%、66.6%,而 Mixed 与 Enum 用法的 true negative rate 达到 100%。该工具已在 GitHub 仓库发布,并提供视频演示。
Feature toggles enable developers to control feature states, allowing the features to be released to a limited group of users while preserving overall software functionality. The absence of comprehensive best practices for feature toggle usage often results in improper implementation, causing code quality issues. Although certain feature toggle usage patterns are prone to toggle smells, there is no tool as of today for software engineers to detect toggle usage patterns from the source code. This paper presents a tool TS-Detector to detect five different toggle usage patterns across ten open-source software projects in six different programming languages. We conducted a manual evaluation and results show that the true positive rates of detecting Spread, Nested, and Dead toggles are 80%, 86.4%, and 66.6% respectively, and the true negative rate of Mixed and Enum usages was 100%. The tool can be downloaded from its GitHub repository 1 and can be used following the instructions provided there. The video demonstration can be viewed from the link2 shared.