一句话:提出动态阈值的二元测试性分析,将软件指标与缺陷讨论从相关性转向缺陷密度是否高于预期,并在 SAP HANA 上验证。
在软件工程中,研究者长期用统计相关性判断代码指标与缺陷的关系,但在大型工业项目中,这类结论常因相关不等于因果、统计显著性与单事件影响混淆而难以落地。本文采用已有 binary testedness 思路,利用软件指标将源码分为两部分,检验其中缺陷数是否高于或低于预期,并针对 SAP HANA 这一大型工业项目分析多个软件指标。相比先前静态二分,作者引入动态阈值进行源码分类。结果表明,部分指标与缺陷分布显著相关,但不同指标的效应量相差数个数量级。该工作将讨论从“指标 X 与缺陷相关”转变为“具有属性 X 的源码缺陷是否多于预期”,推动基于证据的根因分析。
Researchers and practitioners have been studying correlations between software metrics and defects for decades. The typical approach is to postulate a hypothesis that a certain metric correlates with the number of defects. A statistical test then utilizes historical data to accept or reject the hypothesis. Although this methodology has been widely adopted, our own experience is that such correlations are often limited in their practical relevance, particularly for large industrial projects: Interpreting and arguing about them is challenging and cumbersome; the difference between correlation and causation might not be clear; and the practical impact of a correlation is often questioned due to misconceptions between a statistical conclusion and the impact on singular events. Instead of discussing correlations, we found that the analysis for binary testedness results in more fruitful discussions. Binary testedness, as proposed by prior work, utilizes a metric to divide the source code into two parts and verifies whether more (or less) defects appear in each part than expected. In our work, we leverage the binary testedness approach and analyze several software metrics for a large industrial project to illustrate the concept. We furthermore introduce dynamic thresholds as a novel and more practical approach for source code classification compared to the static binary classification of previous works. Our results show that some studied metrics have a significant correlation with bug distribution, but effect sizes differ by several magnitudes across metrics. Overall, our approach moves away from “metric X correlates with defects” to a more fruitful “source code with attribute X has more (or less) bugs than expected”, reframing the discussion from questioning statistics and methods towards an evidence-based root cause analysis.