Understanding and Measuring Nesting

Nesting is a fundamental and very commonly used programming construct. In many cases, the wise use of nesting contributes significantly to a programming team's elegantly designing a solution to a difficult problem. However, the ease with which nesting constructs may be created and the essentially unlimited depth and breadth to which they may exist also enable a programming team to create structures which may be extremely difficult to understand and maintain. In this paper, we examine nesting and nesting metrics. In particular, we discuss nesting and complexity, we give a new definition for the scope of a selection statement, we define simple and precise metrics for nesting depth and breadth, and we present a new nesting concept, the nesting tree.