[Paper Review] Source code and data of "so-edit-viz" tool
This paper presents SOTorrent, an open dataset reconstructing the version history of Stack Overflow posts at the level of individual text and code blocks. Using 134 string similarity metrics, the authors identify optimal matching strategies—Manhattan profile distance for text and Winnowing-based fingerprinting for code—enabling analysis of post evolution, edit-comment relationships, and code clones, with key findings showing most edits are minor and early, and many code snippets are reused without proper attribution or license compliance.
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.
Motivation & Objective
- To address the lack of fine-grained version history access for Stack Overflow posts, which limits research on code and text evolution.
- To develop a reliable method for reconstructing the history of individual text and code blocks across post edits.
- To analyze the implications of code clones on Stack Overflow and assess licensing risks in copied code snippets.
- To improve understanding of how edits, comments, and post evolution are interrelated on the platform.
- To create and maintain an open, extensible dataset (SOTorrent) linking SO posts to external sources like GitHub and web URLs.
Proposed method
- Evaluation of 134 string similarity metrics to identify the most effective for matching text and code blocks across post revisions.
- Use of profile-based metrics with Manhattan distance for text block matching, and fingerprint-based Winnowing algorithm for code block matching.
- Development of a multi-step matching strategy to resolve ambiguous predecessor candidates, iteratively refined using random post samples.
- Analysis of false positives and false negatives in the initial reconstruction to improve matching accuracy.
- Extraction of URLs from text blocks and comments, and collection of GitHub file references to SO posts to enable cross-platform linkage.
- Application of the dataset to answer research questions on edit patterns, code clone detection, and licensing implications.
Experimental results
Research questions
- RQ1RQ1: How do Stack Overflow posts evolve over time in terms of content, edits, and structural changes?
- RQ2RQ2: Which types of posts (e.g., questions vs. answers) are more likely to be edited, and what factors influence edit frequency?
- RQ3RQ3: What are the patterns of interaction between post edits and comments, and how do they relate to content evolution?
- RQ4RQ4: What is the prevalence and nature of code clones on Stack Overflow, and what are the associated licensing and maintainability risks?
Key findings
- Most edits to Stack Overflow posts are minor and occur soon after the initial post creation, indicating rapid community-driven refinement.
- Code blocks are rarely modified without concurrent changes to surrounding text, suggesting that edits are typically holistic rather than isolated.
- The profile-based metric using Manhattan distance achieved the highest accuracy for matching text block revisions, while the Winnowing-based fingerprinting method outperformed others for code blocks.
- A significant number of code snippets on Stack Overflow are reused across multiple posts, indicating the presence of code clones, with potential licensing risks due to lack of attribution.
- Only about 25% of code snippet usages in GitHub projects properly attribute the original SO post, highlighting widespread licensing non-compliance.
- The dataset reveals that many SO posts link to external resources, and GitHub projects frequently reference SO posts, enabling future research on cross-platform code flow.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.