• DocumentCode
    3008316
  • Title

    From Indentation Shapes to Code Structures

  • Author

    Hindle, Abram ; Godfrey, Michael W. ; Holt, Richard C.

  • Author_Institution
    Software Archit. Group, Univ. of Waterloo, Waterloo, ON
  • fYear
    2008
  • fDate
    28-29 Sept. 2008
  • Firstpage
    111
  • Lastpage
    120
  • 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.
  • Keywords
    program control structures; programming language semantics; reverse engineering; systems analysis; McCabe cyclomatic complexity; code analysis; code syntactic structure classification; function definition; indentation shape; program comment; program expression; program loop; program revision; program understanding; programming language; tool framework; Analysis of variance; Buildings; Computer science; History; Length measurement; Libraries; Pixel; Shape measurement; Software architecture; Visualization; Change Metric; Indentation; Indentation Shapes; Metrics; Revision Metrics;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    Source Code Analysis and Manipulation, 2008 Eighth IEEE International Working Conference on
  • Conference_Location
    Beijing
  • Print_ISBN
    978-0-7695-3353-7
  • Type

    conf

  • DOI
    10.1109/SCAM.2008.31
  • Filename
    4637544