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

我们能否识别需要代码片段的 Stack Overflow 问题?——探究缺失代码片段的原因与影响

Can We Identify Stack Overflow Questions Requiring Code Snippets? Investigating the Cause & Effect of Missing Code Snippets

Saikat Mondal, Mohammad Masudur Rahman, Chanchal K. Roy

AI总结:

本研究通过实证分析、从业者调查和机器学习模型,探究Stack Overflow问题中缺失代码片段的原因与影响,并成功以高精度识别需要代码片段的问题,从而提升问答效率与知识库质量。

摘要:

在 Stack Overflow (SO) 问答网站上,用户经常请求解决其代码相关问题(例如错误、意外行为)的解决方案。不幸的是,他们在提交问题时常常遗漏所需的代码片段,这可能会妨碍他们的问题得到及时且恰当的答案。在本研究中,我们进行了一项实证研究,调查在需要时 SO 问题中缺失代码片段的原因与影响。在此,我们的贡献有三个方面。首先,我们分析了所需代码片段的存在或缺失如何影响问题类型(提交时遗漏代码、在请求后包含代码以及提交时包含代码片段)与相应答案元数据(例如是否存在已接受的答案)之间的相关性。根据我们的分析,在提交问题时包含所需代码片段的问题获得已接受答案的几率是那些遗漏代码的问题的三倍。我们还调查了混杂因素(例如用户声誉)是否在所需代码片段存在或缺失之外影响问题获得答案。我们发现这些因素并不会损害所需代码片段的存在或缺失与答案元数据之间的相关性。其次,我们调查了64名从业者,以了解用户为何遗漏必要的代码片段。其中约60%的人同意用户不清楚他们的问题是否需要代码片段。第三,我们因此提取了四个基于文本的特征(例如关键词),并构建了六个机器学习模型来识别需要代码片段的问题。我们的模型能够以86.5%的精确率、90.8%的召回率、85.3%的F1分数和85.2%的总体准确率预测目标问题。我们的工作有潜力在编程问答中节省大量时间,并通过减少未回答和未解决的问题来提高宝贵知识库的质量。

英文摘要:

On the Stack Overflow (SO) Q&A site, users often request solutions to their code-related problems (e.g., errors, unexpected behavior). Unfortunately, they often miss required code snippets during their question submission, which could prevent their questions from getting prompt and appropriate answers. In this study, we conduct an empirical study investigating the cause & effect of missing code snippets in SO questions whenever required. Here, our contributions are threefold. First, we analyze how the presence or absence of required code snippets affects the correlation between question types (missed code, included code after requests & had code snippets during submission) and corresponding answer meta-data (e.g., presence of an accepted answer). According to our analysis, the chance of getting accepted answers is three times higher for questions that include required code snippets during their question submission than those that missed the code. We also investigate whether the confounding factors (e.g., user reputation) affect questions receiving answers besides the presence or absence of required code snippets. We found that such factors do not hurt the correlation between the presence or absence of required code snippets and answer meta-data. Second, we surveyed 64 practitioners to understand why users miss necessary code snippets. About 60% of them agree that users are unaware of whether their questions require any code snippets. Third, we thus extract four text-based features (e.g., keywords) and build six ML models to identify the questions that need code snippets. Our models can predict the target questions with 86.5% precision, 90.8% recall, 85.3% F1-score, and 85.2% overall accuracy. Our work has the potential to save significant time in programming question-answering and improve the quality of the valuable knowledge base by decreasing unanswered and unresolved questions.

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

↑