Question-and-answer platforms such as Stack Overflow are an important way for software developers to share and retrieve knowledge. However, reusing poorly understood code can lead to serious problems, such as bugs or security vulnerabilities. To better understand how code comments affect the perceived helpfulness of Stack Overflow answers, we conducted an online experiment simulating a Stack Overflow environment (n=91). The results indicate that both block and inline comments are perceived as significantly more helpful than uncommented source code. Moreover, novices rated code snippets with block comments as more helpful than those with inline comments. Interestingly, other surface features, such as the position of an answer and its answer score, were considered less important. Moreover, the content of Stack Overflow has been a major source for training large language models. AI-based coding assistants such as GitHub Copilot, which are based on these models, are changing the way Stack Overflow is used. However, our findings have implications beyond Stack Overflow. First, they may help to improve the relevance also of other community-driven platforms, which provide human advice and explanations of code solutions, complementing AI-based support for software developers. Second, since chat-based AI tools can be prompted to generate code in different ways, knowing which properties influence perceived helpfulness can lead to more targeted prompting strategies to generate readable code snippets.


翻译:问答平台(如Stack Overflow)是软件开发者分享和获取知识的重要途径。然而,复用理解不足的代码可能导致严重问题,如程序错误或安全漏洞。为深入理解代码注释如何影响Stack Overflow回答的感知有用性,我们开展了一项模拟Stack Overflow环境的在线实验(n=91)。结果表明,无论是块注释还是行内注释,其感知有用性均显著高于未注释的源代码。此外,新手认为带有块注释的代码片段比带有行内注释的更具帮助性。有趣的是,其他表面特征(如回答的排序位置及评分)则被认为相对次要。值得关注的是,Stack Overflow的内容已成为训练大语言模型的主要来源。基于这些模型的AI编程助手(如GitHub Copilot)正改变着Stack Overflow的使用方式。然而,我们的发现远不止影响Stack Overflow本身:首先,这有助于提升其他社区驱动平台的相关性——这些平台提供人工建议和代码解决方案解释,可补充基于AI的开发者支持工具;其次,由于基于聊天的AI工具可通过不同提示方式生成代码,了解影响感知有用性的属性,将有助于制定更精准的提示策略,以生成可读性强的代码片段。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
AI生成代码缺陷综述
专知会员服务
17+阅读 · 2025年12月8日
【ETHZ博士论文】机器学习代码: 安全性与可靠性
专知会员服务
19+阅读 · 2024年10月25日
专知会员服务
16+阅读 · 2021年1月23日
机器学习的可解释性
专知会员服务
180+阅读 · 2020年8月27日
八个不容错过的 GitHub Copilot 功能!
CSDN
11+阅读 · 2022年9月22日
tensorflow系列笔记:流程,概念和代码解析
北京思腾合力科技有限公司
30+阅读 · 2017年11月11日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Arxiv
0+阅读 · 5月27日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员