# Software Metrics and Software Metrology Software Metrics and Software MetrologyAlain AbranIEEE Computer Society, 2010ISBN 978-0-470-59720-0

Chapitre 1: Introduction
Chapitre 2: From Measurement Methods to Quantitative Models
Chapitre 3: Metrology and Quatity Criteria in Software Measurement
Chapitre 4: Quantification and Measurement are not the same
Chapitre 5: Design of Software Measurement Methods
Chapitre 6: Cyclomatic Complexity
Chapitre 7: Halstead's Metrics
Chapitre 8: Function Points
Chapitre 9: Use Case Points
Chapitre 10: ISO 9126
Chapitre 11: COSMIC: Design
Chapitre 12: COSMIC: Industrialization
Chapitre 13: Convertibility across measurements methods
Chapitre 14: Design of Standard Etalons

### Some definitions

[page 35] Verification or Validation?
• Verification: provision of objective evidence that a given item fulfills specified requirements [ISO VIM 2007].
• Validation: verification, where the specified requirements are adequate for an intented use [ISO VIM 2007].
[page 114] et [page 168] Scale Type and Mathematical Structure

 Scale Type Description Examples Operations allowed Misuse Nominal used to name objects or events; used only in identifying requirements. Telephone Area Code (514-Montreal, 418-Quebec City, etc) ==, != 514 is higher than 418 Ordinal used to put objects in order, criterion may be subjective (preferably objective).. Frequentness (0=very rare, 1=rare, 2=medium, 3=frequent, etc.) nominal operations and,<, > '2' is twice as frequent as '1' Interval (also called cardinal) used to determine difference between ranks. Temperature in Celcius, calendar time ordinal operations and,+, -, average +10C is twice warmer than +5C Ratio has an absolute zero that is not arbritary; significant to multiply by a non-negative number. Temperature in Kelvin, mass, distance. interval operations and,*, /, percentage, log(1 meter) = 0log (3 feets) ~= 1.1meters (or feets) are arbitrary echelons. Absolute has a significant unit measure (echelon) that is not arbritary, significant to count entities. Entity count. ratio operations and,log()

[page 141] Software Complexity
• "the degree to which a system or component has a design or implementation that is difficult to understand and verify" [IEEE 1990].
• "the degree of complication of a system or system component, determined by such factors as:
• the number and intricacy of interfaces,
• the number and intricacy of conditional branches,
• the degree of nesting, and
• the types of data structures " [Evans and Marciniak 1987].

[page 152] The measurement unit produced by log2

 In general, in engineering applications, we do not take the logarithm of a dimensioned number, only that of a dimensionless quantity. For instance, in calculating decibels, we take the logarithms of a ratio of two quantities.  A ratio of quantities with the same dimensions is itself dimensuionless. We can write:log(a/b) = log(a) - log(b)making it appear that we are taking the logs of dimentioned quantities (a) and (b), but the dimensions "come out in the wash" : by the time we have finished (substracting one log from the other), we have effectively taken the log of a dimentionless quantity (a/b).We can regard units as factors in an expression, for instance:8 meters = 8 * 1 meter800 cm  = 800 * 1 cm              = 800 * 0.01 * 1 meter(..)The inconvenient term 8*log2(1m) is an additive term that depends on the units being used.  If it is part of a valid engineering calculation, it will be canceled out somewhere in the process.  It may be, for instance, that when we take the log of 8 meters, we are actually taking the log of a ratio of 8 meters to a one-meter standard length.

[page 162] Two kinds of software size:
• technical size, mesured from a developer's perspective: number of LOC, classes, etc.
• functional size, measured from a user's perspective: must be independant of technical development and implementation decisions; thus can be to compare the productivity of different techniques and technologies.
[Personal Note] : I would add computational size, from a machine's perpective: size in memory, size on disk, % of CPU.
[page 232] A real-time system:
• "A system in which computation is performed during the actual time that an external process occurs, in order that the computation results can be used to control, monitor or respond in a timely manner to the external process" [IEEE 610 1990].
• Any system in which the time at which the output is produced is significant,  This is usually because the input corresponds to some movement in the physical world, and the output has to relate to that same movement in the physical world, and the output has to relate to some movement. The lag from input time to output time must be sufficiently small for acceptable timeliness." [Illingworth 1991].

### Some metrics and equations

#### Cyclomatic complexity

 v(G) = e - n + pe : nb edgesn : nb verticesp: separate components

#### Halstead's metrics

 Base measures:N1 : Total nb of occurrences of operatorsN2 : Total nb of occurrences of operarandsn1 : Nb of distinct operatorsn2 : Nb of distinct operandsn1* : Nb of potential operators (minimum possible number of operators for a module)n2* : Nb of potential operandsN = N1  + N2N : length of a program Pn = n1  + n2n : vocabularyV = N * log2 nV : volume of a program PV* = (2 + n2)  log2 (2 + n2) V* : potential (minimal) volume of a program PL = V* / VL : program level D = (n1 / 2) * (N1  / n2)D : program difficulty E = V / L according [Abran], V * D according othersE : programming effortT = E / S T : programming time in secondsS : the Stroud number, i.e. the number of mental discrimination per second, in the range of 5 to 20.  S is set to 18 for software scientists.

• ISO 9126
• ISO 14143
• ISO 14143
• ISO 14598
• ISO 15939
• ISO 19761
• ISO 20926
• ISO 20968
• ISO 24570
• ISO 25000
• ISO 29881
• ISO 90003

### Some errors or typos:

• [page 114] : Wrong cross-reference: "See also Tables 3.3 and 3.4 in Section 5.5 of Chapter 5" (in fact, it's Tables 8.3 and 8.4 in Section 8.4.2 of Chapter 8).
• [page 140] : Inconstitencies: "Lopez and Habra (..) threshold for the java programming language" and in page 155: In Java language, ..

### Some doubtful conclusions:

• [page 140] : "[The] cyclomatic complexity measure correlates with errors in software modules [Watson and McCabe 1996]. Again this statement has led users of this CC number to associate low numbers of errors with a low cyclomatic number.  Howeve, a coefficient of correlation (r) between two given variables X and Y does not mean that one variable implies the other, but simply expresses the fact that the two variables vary in the same direction."
• Any researcher should know the difference between a correlation and a cause/effect relationship!
• [page 155] Most of Halstead's metrics, which were disigned almost thirty years ago, do not meet key design criteria of measurement methods in engineering and the physical sciences.
• We should not mix up metrics (indices) and measurement methods!
• Is computing a physical science?

Dernière mise à jour: 26 novembre 2010.