[论文解读] Source code and data of "so-edit-viz" tool
本文提出 SOTorrent,一个开放数据集,可重建 Stack Overflow 帖子中文本和代码块的版本历史。作者使用 134 种字符串相似性度量,识别出最优匹配策略——文本使用曼哈顿轮廓距离,代码使用 Winnowing 基于的指纹技术,从而实现对帖子演化、编辑-评论关系以及代码克隆的分析。主要发现显示,大多数编辑为轻微修改且发生于初始发布后不久,且许多代码片段被重复使用而未正确标注来源或遵守许可条款。
Stack Overflow (SO) is the most popular question-and-answer website for software developers, providing a large amount of code snippets and free-form text on a wide variety of topics. Like other software artifacts, questions and answers on SO evolve over time, for example when bugs in code snippets are fixed, code is updated to work with a more recent library version, or text surrounding a code snippet is edited for clarity. To be able to analyze how content on SO evolves, we built SOTorrent, an open dataset based on the official SO data dump. SOTorrent provides access to the version history of SO content at the level of whole posts and individual text or code blocks. It connects SO posts to other platforms by aggregating URLs from text blocks and comments, and by collecting references from GitHub files to SO posts. In this paper, we describe how we built SOTorrent, and in particular how we evaluated 134 different string similarity metrics regarding their applicability for reconstructing the version history of text and code blocks. Based on different analyses using the dataset, we present: (1) insights into the evolution of SO posts, e.g., that post edits are usually small, happen soon after the initial creation of the post, and that code is rarely changed without also updating the surrounding text; (2) a qualitative study investigating the close relationship between post edits and comments, (3) a first analysis of code clones on SO together with an investigation of possible licensing risks. Finally, since the initial presentation of the dataset, we improved the post block extraction and our predecessor matching strategy.
研究动机与目标
- 为解决缺乏对 Stack Overflow 帖子细粒度版本历史访问的问题,该问题限制了对代码与文本演化的研究。
- 开发一种可靠的方法,用于重建单个文本块与代码块在帖子多次编辑中的历史记录。
- 分析代码克隆在 Stack Overflow 上的影响,并评估复制代码片段中的许可风险。
- 增进对编辑、评论与帖子演化之间相互关系的理解。
- 创建并维护一个开放、可扩展的数据集(SOTorrent),将 SO 帖子与 GitHub 和网页 URL 等外部资源关联起来。
提出的方法
- 评估 134 种字符串相似性度量,以识别在帖子修订版本间匹配文本与代码块时最有效的度量。
- 使用基于轮廓的度量结合曼哈顿距离进行文本块匹配,使用基于指纹的 Winnowing 算法进行代码块匹配。
- 开发多步匹配策略以解决潜在前驱候选的歧义性,通过随机抽取的帖子样本迭代优化。
- 分析初始重建中的误报与漏报,以提升匹配准确性。
- 从文本块和评论中提取 URL,并收集指向 SO 帖子的 GitHub 文件引用,以实现跨平台关联。
- 应用该数据集回答关于编辑模式、代码克隆检测及许可影响的研究问题。
实验结果
研究问题
- RQ1RQ1:从内容、编辑和结构变化的角度来看,Stack Overflow 帖子随时间如何演化?
- RQ2RQ2:哪些类型的帖子(例如问题与答案)更可能被编辑,影响编辑频率的因素有哪些?
- RQ3RQ3:帖子编辑与评论之间的互动模式是怎样的,它们如何与内容演化相关联?
- RQ4RQ4:Stack Overflow 上代码克隆的普遍性与性质如何,其相关的许可与可维护性风险是什么?
主要发现
- 大多数对 Stack Overflow 帖子的编辑是轻微修改,且发生于初始发布后不久,表明社区驱动的快速优化。
- 代码块很少在不伴随周围文本修改的情况下被修改,表明编辑通常是整体性的而非孤立的。
- 基于轮廓的度量结合曼哈顿距离在匹配文本块修订版本中实现了最高准确率,而基于 Winnowing 的指纹方法在代码块匹配中优于其他方法。
- Stack Overflow 上大量代码片段在多个帖子中被重复使用,表明存在代码克隆,且由于缺乏来源标注,存在潜在许可风险。
- 在 GitHub 项目中,仅约 25% 的代码片段使用情况正确标注了原始 SO 帖子,凸显了广泛的许可合规性缺失。
- 该数据集显示,许多 SO 帖子链接到外部资源,且 GitHub 项目频繁引用 SO 帖子,为未来跨平台代码流动研究提供了支持。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。