Authors: Abram Hindle Michael W. Godfrey Richard C. Holt
Venue: 2008 Eighth IEEE International Working Conference on Source Code Analysis and Manipulation , pp. 111-120, 2008
Year: 2008
Abstract: In a previous study, we showed that indentation was regular across multiple languages and the variance in the level of indentation of a block of revised code is correlated with metrics such as McCabe cyclomatic complexity. Building on that work the current paper investigates the relationship between the "shape'' of the indentation of the revised code block (the "revision'') and the corresponding syntactic structure of the code. We annotated revisions matching these three indentation shapes: "flat'' (all lines are equally indented), "slash'' (indentation becomes increasingly deep), or "bubble'' (indentation increases and then decreases). We then classified the code structure as one of: function definition, loop, expression, comment, etc. We studied thousands of revisions, coming from over 200 software projects, written in a variety of languages. Our study indicates that indentation shape correlates positively with code structure; that is, certain shapes typically correspond to certain code structures. For example, flat shapes commonly correspond to comments while bubble shapes commonly correspond to conditionals and function definitions. These results can form the basis of a tool framework that can analyze code in a language independent way to support browsing targeted to viewing particular code structures such as conditionals or comments.
BibTeX:
@inproceedings{abramhindle2008fistcs,
author = "Abram Hindle and Michael W. Godfrey and Richard C. Holt",
title = "From Indentation Shapes to Code Structures",
year = "2008",
pages = "111-120",
booktitle = "Proceedings of 2008 Eighth IEEE International Working Conference on Source Code Analysis and
Manipulation
"
}
Plain Text:
Abram Hindle, Michael W. Godfrey, and Richard C. Holt, "From Indentation Shapes to Code Structures," 2008 Eighth IEEE International Working Conference on Source Code Analysis and Manipulation
, pp. 111-120