08.01.2015 Views

phsjhxx

phsjhxx

phsjhxx

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6. Complexity Analysis<br />

Using software metrics like complexity analysis will guide you towards maintainable and<br />

testable pieces of code by reducing the complexity and splitting the code into smaller<br />

chunks.<br />

6.1. Halstead Metric<br />

6.1.1 Calculation<br />

First we need to compute the following numbers, given the program:<br />

• n1 = the number of distinct operators<br />

• n2 = the number of distinct operands<br />

• N1 = the total number of operators<br />

• N2 = the total number of operands<br />

From these numbers, five measures can be calculated:<br />

• Program length:<br />

• Program vocabulary:<br />

• Volume:<br />

• Difficulty :<br />

• Effort:<br />

The difficulty measure D is related to the difficulty of the program to write or understand,<br />

e.g. when doing code review.<br />

The volume measure V describes the size of the implementation of an algorithm.<br />

PL/SQL Coding Guidelines 45

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

Saved successfully!

Ooh no, something went wrong!