Algorithmic Information Content Psychological Complexity

Chapter 4 • Software Measurement and Estimation 157 Charles Bennett defined logical depth of a description to characterize the difficulty of going from the shortest program that can print the description to the actual description of the system. Consider not just the shortest program to print out the string, but a set of short programs that have the same effect. For each of these programs, determine the length of time or number of steps needed to compute and print the string. Finally, average the running times so that shorter programs are given greater weight.

4.6 Summary and Bibliographical Notes

Horst Zuse, History of Software Measurement, Technische Universität Berlin, Online at: http:irb.cs.tu-berlin.de~zusesme.html [Halstead, 1977] distinguishes software science from computer science. The premise of software science is that any programming task consists of selecting and arranging a finite number of program “tokens,” which are basic syntactic units distinguishable by a compiler: operators and operands. He defined several software metrics based on these tokens. However, software science has been controversial since its introduction and has been criticized from many fronts. Halstead’s work has mainly historical importance for software measurement since it was instrumental in making metrics studies an issue among computer scientists. Working memory Chunking unit Chunking unit Intelligent system Input sequence from the world time-varying Figure 4-3: A model of a limited working memory. Ivan Marsic • Rutgers University 158 S. Kusumoto, F. Matukawa, K. Inoue, S. Hanabusa, and Y. Maegawa, “Estimating effort by use case points: Method, tool and case study,” Proceedings of the IEEE 10th International Symposium on Software Metrics METRICS’04, G. Karner, “Metrics for Objectory,” Diploma thesis, University of Linköping, Sweden. No. LiTH-IDA-Ex-9344:21. December 1993. Coupling and cohesion: [Constantine et al., 1974; Eder et al., 1992; Allen Khoshgoftaar, 1999; Henry Gotterbarn, 1996; Mitchell Power, 2005] See also: http:c2.comcgiwiki?CouplingAndCohesion [Henderson-Sellers, 1996] provides a condensed review of software metrics up to the publication date, so it is somewhat outdated. It is technical and focuses on metrics of structural complexity. B. Henderson-Sellers, L. L. Constantine, and I. M. Graham, “Coupling and cohesion: Towards a valid suite of object-oriented metrics,” Object-Oriented Systems, vol. 3, no. 3, 143-158, 1996. Problems Problem 4.1 Problem 4.2 Problem 4.3 C YCLOMATIC M C C ABE C OMPLEXITY Consider the following quicksort sorting algorithm: Q UICKSORT A, p, r 1 if p r 2 then q ← P ARTITION A, p, r 3 Q UICKSORT A, p, q − 1 4 Q UICKSORT A, q + 1, r where the P ARTITION procedure is as follows: Chapter 4 • Software Measurement and Estimation 159 P ARTITION A, p, r 1 x ← A[r] 2 i ← p − 1 3 for j ← p to r − 1 4 do if A[j] ≤ x 5 then i ← i + 1 6 exchange A[i] ↔ A[j] 7 exchange A[i + 1] ↔ A[r] 8 return i + 1 a Draw the flowchart of the above algorithm. b Draw the corresponding graph and label the nodes as n 1 , n 2 , … and edges as e 1 , e 2 , … c Calculate the cyclomatic complexity of the above algorithm. Problem 4.4