arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1905.12111cs.SE
收藏

在线代码示例的分析和适配支持

Analyzing and Supporting Adaptation of Online Code Examples

Tianyi Zhang, Di Yang, Cristina Videira Lopes, Miryung Kim

摘要:

开发人员经常求助于在线Q&A论坛,如Stack Overflow(SO),以满足他们的编程需求。虽然这些论坛上的代码示例是很好的起点,但它们通常不完整,不适合开发人员的本地程序上下文;对这些示例进行改编是将其集成到生产代码中所必需的。因此,改编在线代码示例的过程是由多个开发人员独立地一遍又一遍地完成的。我们的工作广泛地研究了这些适应性和变化,作为一个工具,帮助集成这些在线代码的例子在一个目标上下文中的交互式方式的基础。我们进行了大规模的实证研究的性质和程度的适应和变化的SO片段。我们基于克隆检测、时间戳分析和显式URL引用构建了一个将SO帖子与GitHub对应帖子联系起来的综合数据集。然后,我们定性地检查了400个SO示例及其GitHub对应项,并开发了24种适应类型的分类法。使用这种分类法,我们在GumTree之上构建了一个自动适应分析技术,将整个数据集分类为这些类型。我们构建了一个名为ExampleStack的Chrome扩展,它可以自动从每个SO示例及其GitHub对应项中提取一个适应感知模板,以识别发生大多数更改的热点。一项针对16名程序员的用户研究表明,看到类似GitHub对应程序的共性和差异,增加了他们对给定SO示例的信心,并帮助他们更全面地了解如何以不同的方式重用示例,避免常见的陷阱。

英文摘要:

Developers often resort to online Q&A forums such as Stack Overflow (SO) for filling their programming needs. Although code examples on those forums are good starting points, they are often incomplete and inadequate for developers' local program contexts; adaptation of those examples is necessary to integrate them to production code. As a consequence, the process of adapting online code examples is done over and over again, by multiple developers independently. Our work extensively studies these adaptations and variations, serving as the basis for a tool that helps integrate these online code examples in a target context in an interactive manner. We perform a large-scale empirical study about the nature and extent of adaptations and variations of SO snippets. We construct a comprehensive dataset linking SO posts to GitHub counterparts based on clone detection, time stamp analysis, and explicit URL references. We then qualitatively inspect 400 SO examples and their GitHub counterparts and develop a taxonomy of 24 adaptation types. Using this taxonomy, we build an automated adaptation analysis technique on top of GumTree to classify the entire dataset into these types. We build a Chrome extension called ExampleStack that automatically lifts an adaptation-aware template from each SO example and its GitHub counterparts to identify hot spots where most changes happen. A user study with sixteen programmers shows that seeing the commonalities and variations in similar GitHub counterparts increases their confidence about the given SO example, and helps them grasp a more comprehensive view about how to reuse the example differently and avoid common pitfalls.

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

↑