Exploring Influence of Feature Toggles on Code Complexity

Tajmilur Rahman, Imran Shalabi, Tushar Sharma · 2024

Feature toggles are conditional variables that control program execution flow. Toggles are used to control feature states and allow developers to introduce unfinished features to a limited user group while maintaining regular software functionality. Due to the lack of comprehensive best practices, guidelines, or a coding standard for using feature toggles, developers often use them in an inappropriate way leading to code quality issues. In this paper, we investigate four feature toggle usage patterns identified in two popular open-source software projects and assess their impact on code-complexity and size. We develop a tool ts-detector to identify the usage patterns automatically. Our investigation indicates that spread toggle and mixed toggle usage patterns occur most and least in the analyzed subject systems. We also found that feature toggle usage patterns collectively have a strong influence on the code complexity and size metrics. Our fine-grained analysis reveals that spread and nested toggle usage patterns have a significant correlation with selective size and complexity metrics. This paper not only offers a tool for software developers and researchers to identify the usage patterns and take corrective actions, but also, the study will motivate other researchers to further extend the experiments to understand and mitigate issues arising from misusing feature toggles.

Read the paper · More papers on PaperTik