Page 190 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 190

Principles of Software Engineering



                   Notes         as 10 is a common limit for cyclomatic complexity, 60 is a common limit for the number of lines
                                 of  code,  the  somewhat  archaic  rationale  being  that  each  software  module  should  fit  on  one
                                 printed page to be manageable. Although the number of lines of code is often used as a crude
                                 complexity measure, there is no consistent relationship between the two. Many modules with
                                 no branching of control flow (and hence the minimum cyclomatic complexity of one) consist
                                 of far greater than 60 lines of code, and many modules with complexity greater than ten have
                                 far fewer than 60 lines of code. For example, Figure 9.4 has complexity 1 and 282 lines of code,
                                 while Figure 9.5 has complexity 28 and 30 lines of code. Thus, although the number of lines of
                                 code is an important size measure, it is independent of complexity and should not be used for
                                 the same purposes.
                                 Several flow graphs and their complexity

                                 Several actual control flow graphs and their complexity measures are presented in through,
                                 to solidify understanding of the measure. The graphs are presented in order of increasing
                                 complexity, in order to emphasize the relationship between the complexity numbers and an
                                 intuitive notion of the complexity of the graphs. (See Figure 9.6 and Figure 9.7)

                                                  Figure 9.4: Control Flow Graph with Complexity 1





















































        184                               LOVELY PROFESSIONAL UNIVERSITY
   185   186   187   188   189   190   191   192   193   194   195