STATISTICS in Software
5.2.3 STATISTICS Scan UPC  13 In None Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications. GTIN  13 Creation In None Using Barcode encoder for Software Control to generate, create EAN13 image in Software applications. Not all statistics are appropriate for all scales. The following indicates which common statistical methods are appropriate: Nominal scale: Only mode, median, and percentiles Ordinal scale: The above and Spearman correlations Interval scale: The above and mean, standard deviation, and Pearson correlations Ratio scale: All statistics Absolute scale: All statistics EAN / UCC  13 Reader In None Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications. GTIN  13 Drawer In C# Using Barcode printer for Visual Studio .NET Control to generate, create EAN13 image in .NET applications. EXAMPLE 5.4 AVERAGES
Make EAN13 In .NET Framework Using Barcode generation for ASP.NET Control to generate, create EAN13 image in ASP.NET applications. Generating GTIN  13 In .NET Using Barcode maker for Visual Studio .NET Control to generate, create EAN13 image in VS .NET applications. Temperature is an interval scale measure. Thus, it makes statistical sense to give an average temperature. However, the numbers on baseball players uniforms are a nominal scale measure. It does not make sense to give the average of the numbers on a team s uniforms. Similarly, the average ranking of the students in a class or the average of a student s rankings in a number of classes is not appropriate. Encode GTIN  13 In VB.NET Using Barcode encoder for VS .NET Control to generate, create EAN13 image in VS .NET applications. Drawing Code128 In None Using Barcode encoder for Software Control to generate, create Code 128 Code Set B image in Software applications. Software Metrics
Encoding Code 3/9 In None Using Barcode drawer for Software Control to generate, create Code 3 of 9 image in Software applications. Draw GS1  12 In None Using Barcode generator for Software Control to generate, create UPCA Supplement 2 image in Software applications. Product Metrics
UCC128 Printer In None Using Barcode printer for Software Control to generate, create GTIN  128 image in Software applications. UPC  13 Maker In None Using Barcode encoder for Software Control to generate, create EAN13 Supplement 5 image in Software applications. Product metrics are metrics that can be calculated from the document independent of how it was produced. Generally, these are concerned with the structure of the source code. Product metrics could be de ned for other documents. For example, the number of paragraphs in a requirements speci cation would be a product metric. British Royal Mail 4State Customer Code Encoder In None Using Barcode printer for Software Control to generate, create British Royal Mail 4State Customer Barcode image in Software applications. Data Matrix Scanner In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. EXAMPLE 5.5 LINES OF CODE
Create UCC  12 In Java Using Barcode creator for Android Control to generate, create UPC A image in Android applications. ECC200 Generation In Java Using Barcode creator for Java Control to generate, create Data Matrix ECC200 image in Java applications. The most basic metric for size is the lines of code metric. There are many different ways to count lines of code. The definition may be a simple as the number of NEW LINE characters in the file. Often comments are excluded from the count of lines. Sometimes blank lines or lines with only delimiters are excluded. Sometimes statements are counted instead of lines. EAN 13 Generation In ObjectiveC Using Barcode creator for iPad Control to generate, create EAN13 image in iPad applications. Code 39 Creation In None Using Barcode maker for Online Control to generate, create Code39 image in Online applications. McCABE S CYCLOMATIC NUMBER
DataMatrix Decoder In Java Using Barcode reader for Java Control to read, scan read, scan image in Java applications. Printing UCC128 In Visual Basic .NET Using Barcode printer for VS .NET Control to generate, create GS1 128 image in VS .NET applications. McCabe s cyclomatic number, introduced in 1976, is, after lines of code, one of the most commonly used metrics in software development. Also called McCabe s complexity measure from the title of the original journal article, it is based on graph theory s cyclomatic number. McCabe tries to measure the complexity of a program. The premise is that complexity is related to the control ow of the program. Graph theory uses a formula, C e n 1 to calculate the cyclomatic number. McCabe uses the slightly modi ed formula: C e n 2p where: e Number of edges n Number of nodes p Number of strongly connected components (which is normally 1) EXAMPLE 5.6
Determine the cyclomatic number from the control flow graph shown in Fig. 51. a b c d
Fig. 51. Control ow graph.
There are 8 nodes, so n 8. There are 11 arcs, so e 11. The cyclomatic number is C 11 8 2 5: A planar graph is a graph that can be drawn without lines crossing. The Swiss mathematician Leonhard Euler (1707 1783) proved for planar graphs that CHAPTER 5 Software Metrics
2 n e r, where r number of regions, e number of edges, and n number of nodes. A region is an area enclosed (or de ned) by arcs. Using algebra, this can be converted to r e n 2. Therefore, the number of regions on a planar graph equals the cyclomatic number. EXAMPLE 5.7
Label the regions in the control flow graph from Example 5.6 with Roman numerals. As shown in Fig. 52, there are five regions. Region I is the outside of the graph. a I e II
b III f
c IV g V
Fig. 52. Control ow graph with roman numerals.
Calculating the cyclomatic number from control ow graphs is timeconsuming. Constructing a control ow graph from a large program would be prohibitively timeconsuming. McCabe found a more direct method of calculating his measure. He found that the number of regions is usually equal to one more than the number of decisions in a program, C 1, where is the number of decisions. In source code, an IF statement, a WHILE loop, or a FOR loop is considered one decision. A CASE statement or other multiple branch is counted as one less decision than the number of possible branches. Control ow graphs are required to have a distinct starting node and a distinct stopping node. If this is violated, the number of decisions will not be one less than the number of regions.

