arrow
Return

Mining Semantic Loop Idioms

delete2018-07-01
delete12
delete
OA
AI
M
Miltiadis Allamanis *
E
Earl T. Barr
C
Christian Bird
P
Prémkumar Dévanbu
M
Mark Marron
C
Charles Sutton
DOI:10.1109/TSE.2018.2832048delete
deleteOriginal
deleteShare
deleteSave
View PDF
Abstract

Abstract

En 中文
To write code, developers stitch together patterns, like API protocols or data structure traversals. Discovering these patterns can identify inconsistencies in code or opportunities to replace these patterns with an API or a language construct. We present coiling, a technique for automatically mining code for semantic idioms: surprisingly probable, semantic patterns. We specialize coiling for loop idioms, semantic idioms of loops. First, we show that automatically identifiable patterns exist, in great numbers, with a large-scale empirical study of loops over 25MLOC. We find that most loops in this corpus are simple and predictable: 90 percent have fewer than 15LOC and 90 percent have no nesting and very simple control. Encouraged by this result, we then mine loop idioms over a second, buildable corpus. Over this corpus, we show that only 50 loop idioms cover 50 percent of the concrete loops. Our framework opens the door to data-driven tool and language design, discovering opportunities to introduce new API calls and language constructs. Loop idioms show that LINQ would benefit from an Enumerate operator. This can be confirmed by the exitence of a StackOverflow question with 542k views that requests precisely this feature.
Keywords:
Data-driven tool design
idiom mining
code patterns
AI Summary

AI Summary

Key information extracted from the uploaded paper, including a brief overview, abstract, background, key highlights, visual analysis, and future outlook.

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.8K
Citations:
1.1W

Organization

U
University College London
Scholars:
7.9W
Papers: 6.2W
Citations: 15.7W
U
university of london
Scholars:
21.5W
Papers: 19.7W
Citations: 305
M
microsoft united kingdom
Scholars:
150
Papers: 121
Citations: 1
U
University of Edinburgh
Scholars:
5.1W
Papers: 4.6W
Citations: 71
researcher View more organizations