Measuring nesting - Hend Alrasheed; Austin Melton (IET Software)
Abstract Nesting is a fundamental and very commonly used programming construct. In many cases, the wise use of nesting contributes significantly to a programming team 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 programs that may be extremely difficult to understand and maintain. In this paper, nesting and nesting metrics are examined. The authors begin the nesting examination/discussion with a precise definition of the scope of programme selection nodes. The term ‘nodes’ instead of ‘statements’ is used because this work is done on control flow graphs of programme modules. Although there has been much work done on metrics related to nesting, there has not been significant work done on metrics that focus entirely on nesting. Explicit definitions for nesting depth and nesting breadth metrics are given for programme modules. The metrics are validated by comparing them to probably the best known nesting metric, the MaCabe cyclomatic metric. Also, the metrics are compared to the standard lines of code metric. Further, a new nesting concept, the nesting tree, is discussed and it is proposed that nesting trees themselves could be useful nesting measurement values.