07.12.2012 Views

Structured Testing - McCabe and Associates

Structured Testing - McCabe and Associates

Structured Testing - McCabe and Associates

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

One essential ingredient in any testing methodology is to limit the program logic during<br />

development so that the program can be understood, <strong>and</strong> the amount of testing required to verify<br />

the logic is not overwhelming. A developer who, ignorant of the implications of complexity,<br />

expects to verify a module such as that of Figure 3-9 with a h<strong>and</strong>ful of tests is heading for<br />

disaster. The size of the module in Figure 3-9 is only 30 lines of source code. The size of several<br />

of the previous graphs exceeded 60 lines, for example the 282-line module in Figure 3-1.<br />

In practice, large programs often have low complexity <strong>and</strong> small programs often have high<br />

complexity. Therefore, the common practice of attempting to limit complexity by controlling<br />

only how many lines a module will occupy is entirely inadequate. Limiting complexity<br />

directly is a better alternative.<br />

22<br />

Figure 3-9. Control flow graph with complexity 28.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!