Presentation is loading. Please wait.

Presentation is loading. Please wait.

Measure18 1 Software Measurement Halstead’s Software Science.

Similar presentations


Presentation on theme: "Measure18 1 Software Measurement Halstead’s Software Science."— Presentation transcript:

1 measure18 1 Software Measurement Halstead’s Software Science

2 measure18 2 Maurice Halstead u Originally a meteorologist –Involved in first cloud seeding u In 1970’s he did empirical studies looking for relationships between code and the “ilities” – maintainability, readability, testability, etc u Wanted to find the intrinsic things to measure

3 measure18 3 Vs Physics Study blue metal balls vs white tennis balls. Conclude that blue balls made bigger dents than white balls.

4 measure18 4 Halstead's software science u every token is either an operator or an operand u tokens with a value are operands   2 is the number of unique operands u other tokens are operators   1 is the number of unique operators   is the total number of unique tokens   =  1 +  2

5 measure18 5 Sample Program Z = 0; while X > 0 Z = Z + Y ; X = X - 1 ; end-while ; print (Z) ;

6 measure18 6 Counts u =3 u ;5 u while-endwhile1 u >1 u +1 u -1 u print1 u ()1 uZ4u02uX3uY1u11uZ4u02uX3uY1u11

7 measure18 7 Counting Rules u Halstead also was concerned about algorithms and not about declarations, i/o statements, etc. u Thus, he did not count declarations, input or output statements, or comments.

8 measure18 8 Counting Rules u There is a lot of debate about counting rules. In fact there was a conference that dealt just with counting rules. One conclusion, the results are not very sensitive to the counting rules. Pick a set of rules and be consistent. u Suggest syntax-oriented counting rules

9 measure18 9 Counting Rules u if two symbols always occur together, count them as one operator. u if there are two different structures that are semantically the same, still count them as two different operators. u count declarations, i/o, etc. Count everything that is necessary for expressing the program. u operators are basically keywords. user-defined items are basically operands.

10 measure18 10 Length, N u N = N 1 + N 2 u where, N 1 is the total number of operators and N 2 is the total number of operands

11 measure18 11 estimate of the length, est N u If N and est N are not within 30% of each other, it is not reasonable to apply any of the other software science measures.

12 measure18 12 TTYP1 - Calculate Halstead’s cin >> a >> b >> c; if (a > b){ cout << “hello”; if (c < a){cout << “part 1”; if ( c > b){cout << “part 2”; } else{ cout << “part 3”;} } else{if (c<a){cout<<”part 4”;} } cout << “exiting”;


Download ppt "Measure18 1 Software Measurement Halstead’s Software Science."

Similar presentations


Ads by Google