< reference $Id: Halstead.ref,v 1.2 2009/05/04 15:08:24 frmath Exp $ > # # Version: May 2009 by Kalimetrix on behalf of IBM Rational. # #------------------------------------------------------------------ # This file is an EXAMPLE of a LOGISCOPE QUALITY MODEL FILE. | # It implements the metrics defined by M.H HALSTEAD in | # "Elements of Software Science" - North Holland - Elsevier 1977 | # [HAL,77]. | # | # These metrics are available at various scopes according to the | # programming language: function, class, module or package. | # | # C++, C, Java and Ada Halstead models are presented in this | # order: | # /C++ : Function and Module scopes only | # /C : Function scope only | # /JAVA : Function, Class and Package scopes only | # /ADA : Function and Module scopes only | #------------------------------------------------------------------ /C++ *MD* *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: n1 I 0 +oo N1 I 0 +oo n2 I 0 +oo N2 I 0 +oo n I 0 +oo N I 0 +oo CN F 0.00 +oo V F 0.00 +oo D F 0.00 +oo L F 0.00 +oo E F 0.00 +oo I F 0.00 +oo # Module scope: md_n1 I 0 +oo md_N1 I 0 +oo md_n2 I 0 +oo md_N2 I 0 +oo md_n I 0 +oo md_N I 0 +oo md_CN F 0.00 +oo md_V F 0.00 +oo md_D F 0.00 +oo md_L F 0.00 +oo md_E F 0.00 +oo md_I F 0.00 +oo *MC* # Criteria / Sub-characteristics Specification Section: # ----------------------------------------------------- # Function scope: Function_BASIC = n1 + N1 + n2 + N2 { Halstead textual Elements : Please specify levels of performance } LEVEL_1 0 4 0 Function_HALSTEAD = n + N + CN + V + D + L + E + I { Halstead Theory : Please specify levels of performance } LEVEL_1 0 8 0 # Module scope: Module_BASIC = md_n1 + md_N1 + md_n2 + md_N2 { Halstead textual Elements : Please specify levels of performance } LEVEL_1 0 4 0 Module_HALSTEAD = md_n + md_N + md_CN + md_V + md_D + md_L + md_E + md_I { Halstead Theory : Please specify levels of performance } LEVEL_1 0 8 0 *BQ* # Factors / characteristics Specification Section: # ------------------------------------------------ MAINTAINABILITY: component = Function_BASIC + Function_HALSTEAD { Halstead Theory : Please specify levels of performance } LEVEL_1 0 0 MAINTAINABILITY: module = Module_BASIC + Module_HALSTEAD { Halstead Theory : Please specify levels of performance } LEVEL_1 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /C *MD* # User Defined Metric Section : # ----------------------------- # Function scope: "Halstead function length": N = N1 + N2 { HALSTEAD function length: N = N1 + N2 } "Halstead function vocabulary": n = n1 + n2 { HALSTEAD vocabulary of the function: n = n1 + n2 } "Halstead function estimated Length": CN = LOG2(n1) * n1 + LOG2(n2) * n2 { HALSTEAD estimated length of the function: CN = LOG2(n1) * n1 + LOG2(n2) * n2 } "Halstead function volume": V = N * LOG2(n) { HALSTEAD function volume :V = N * LOG2(n) It corresponds to the minimum of bits necessary to represent the program. } "Halstead function difficulty": D = (n1 * N2) / (2 * n2) { HALSTEAD function difficulty: D = (n1 * N2) / (2 * n2) It is the product of the relative level of difficulty dur to number of distinct operators and the average times an operand is used. } "Halstead function level": L = 1 / D { HALSTEAD level of the function: L = 1 / D } "Halstead function mental effort": E = V / L { HALSTEAD mental effort required to develop and understand the function: E = V / L } "Halstead function intelligent content": I = V * L { HALSTEAD function intelligent content: I = V * L It represents the complexity of the algorithm regardless of the language used. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: n1 I 0 +oo N1 I 0 +oo n2 I 0 +oo N2 I 0 +oo n I 0 +oo N I 0 +oo CN F 0.00 +oo V F 0.00 +oo D F 0.00 +oo L F 0.00 +oo E F 0.00 +oo I F 0.00 +oo *MC* # Criteria / Sub-characteristics Specification Section: # ----------------------------------------------------- # Function scope: Function_BASIC = n1 + N1 + n2 + N2 { Halstead textual elements: Please specify levels of performance } LEVEL_1 0 4 0 Function_HALSTEAD = n + N + CN + V + D + L + E + I { Halstead Theory: Please specify levels of performance } LEVEL_1 0 8 0 *BQ* # Factors / characteristics Specification Section: # ------------------------------------------------ MAINTAINABILITY: component = Function_BASIC + Function_HALSTEAD { Halstead Theory: Please specify levels of performance } LEVEL_1 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /JAVA *MD* # Function scope: "Halstead function length": N = N1 + N2 { HALSTEAD function length: N = N1 + N2 } "Halstead function vocabulary": n = n1 + n2 { HALSTEAD vocabulary of the function: n = n1 + n2 } "Halstead function estimated Length": CN = LOG2(n1) * n1 + LOG2(n2) * n2 { HALSTEAD estimated length of the function: CN = LOG2(n1) * n1 + LOG2(n2) * n2 } "Halstead function volume": V = N * LOG2(n) { HALSTEAD function volume :V = N * LOG2(n) It corresponds to the minimum of bits necessary to represent the program. } "Halstead function difficulty": D = (n1 * N2) / (2 * n2) { HALSTEAD function difficulty: D = (n1 * N2) / (2 * n2) It is the product of the relative level of difficulty dur to number of distinct operators and the average times an operand is used. } "Halstead function level": L = 1 / D { HALSTEAD level of the function: L = 1 / D } "Halstead function mental effort": E = V / L { HALSTEAD mental effort required to develop and understand the function: E = V / L } "Halstead function intelligent content": I = V * L { HALSTEAD function intelligent content: I = V * L It represents the complexity of the algorithm regardless of the language used. } # Class scope: "Halstead class length": cl_N = cl_N1 + cl_N2 { HALSTEAD class length: N = N1 + N2 } "Halstead class vocabulary": cl_n = cl_n1 + cl_n2 { HALSTEAD vocabulary of the class: n = n1 + n2 } "Halstead class estimated Length": cl_CN = LOG2(cl_n1) * cl_n1 + LOG2(cl_n2) * cl_n2 { HALSTEAD estimated length of the class: CN = LOG2(n1) * n1 + LOG2(n2) * n2 } "Halstead class volume": cl_V = cl_N * LOG2(cl_n) { HALSTEAD class volume :V = N * LOG2(n) It corresponds to the minimum of bits necessary to represent the class. } "Halstead class difficulty": cl_D = (cl_n1 * cl_N2) / (2 * cl_n2) { HALSTEAD class difficulty: D = (n1 * N2) / (2 * n2) It is the product of the relative level of difficulty dur to number of distinct operators and the average times an operand is used. } "Halstead class level": cl_L = 1 / cl_D { HALSTEAD level of the module: L = 1 / D } "Halstead class mental effort": cl_E = cl_V / cl_L { HALSTEAD mental effort required to develop and understand the class: E = V / L } "Halstead class intelligent content": cl_I = cl_V * cl_L { HALSTEAD class intelligent content: I = V * L It represents the complexity of the algorithm regardless of the language used. } # Package scope: "Halstead package length": pk_N = pk_N1 + pk_N2 { HALSTEAD package length: N = N1 + N2 } "Halstead package vocabulary": pk_n = pk_n1 + pk_n2 { HALSTEAD vocabulary of the package: n = n1 + n2 } "Halstead package estimated length": pk_CN = LOG2(pk_n1) * pk_n1 + LOG2(pk_n2) * pk_n2 { HALSTEAD estimated length of the package: CN = LOG2(n1) * n1 + LOG2(n2) * n2 } "Halstead package volume": pk_V = pk_N * LOG2(pk_n) { HALSTEAD package volume: V = N * LOG2(n) It corresponds to the minimum of bits necessary to represent the package. } "Halstead package difficulty": pk_D = (pk_n1 * pk_N2) / (2 * pk_n2) { HALSTEAD package difficulty: D = (n1 * N2) / (2 * n2) It is the product of the relative level of difficulty dur to number of distinct operators and the average times an operand is used. } "Halstead package level": pk_L = 1 / pk_D { HALSTEAD level of the package: L = 1 / D } "Halstead package mental effort": pk_E = pk_V / pk_L { HALSTEAD mental effort required to develop and understand the package: E = V / L } "Halstead package intelligent content": pk_I = pk_V * pk_L { HALSTEAD package intelligent content: I = V * L It represents the complexity of the algorithm regardless of the language used. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: n1 I 0 +oo N1 I 0 +oo n2 I 0 +oo N2 I 0 +oo n I 0 +oo N I 0 +oo CN F 0.00 +oo V F 0.00 +oo D F 0.00 +oo L F 0.00 +oo E F 0.00 +oo I F 0.00 +oo # Class scope: cl_n1 I 0 +oo cl_N1 I 0 +oo cl_n2 I 0 +oo cl_N2 I 0 +oo cl_n I 0 +oo cl_N I 0 +oo cl_CN F 0.00 +oo cl_V F 0.00 +oo cl_D F 0.00 +oo cl_L F 0.00 +oo cl_E F 0.00 +oo cl_I F 0.00 +oo # Package scope: pk_n1 I 0 +oo pk_N1 I 0 +oo pk_n2 I 0 +oo pk_N2 I 0 +oo pk_n I 0 +oo pk_N I 0 +oo pk_CN F 0.00 +oo pk_V F 0.00 +oo pk_D F 0.00 +oo pk_L F 0.00 +oo pk_E F 0.00 +oo pk_I F 0.00 +oo *MC* # Criteria / Sub-characteristics Specification Section: # ----------------------------------------------------- # Function scope: Function_BASIC = n1 + N1 + n2 + N2 { Halstead textual Elements : Please specify levels of performance } LEVEL_1 0 4 0 Function_HALSTEAD = n + N + CN + V + D + L + E + I { Halstead Theory : Please specify levels of performance } LEVEL_1 0 8 0 # Class scope: Class_BASIC = cl_n1 + cl_N1 + cl_n2 + cl_N2 { Halstead basic metrics: Please specify levels of performance } LEVEL_1 0 4 0 Class_HALSTEAD = cl_n + cl_N + cl_CN + cl_V + cl_D + cl_L + cl_E + cl_I { Halstead Theory: Please specify levels of performance } LEVEL_1 0 8 0 # Package scope: Package_BASIC = pk_n1 + pk_N1 + pk_n2 + pk_N2 { Halstead basic metrics: Please specify levels of performance } LEVEL_1 0 4 0 Package_HALSTEAD = pk_n + pk_N + pk_CN + pk_V + pk_D + pk_L + pk_E + pk_I { Halstead Theory: Please specify levels of performance } LEVEL_1 0 8 0 *BQ* # Factors / characteristics Specification Section: # ------------------------------------------------ MAINTAINABILITY: component = Function_BASIC + Function_HALSTEAD { Halstead Theory: Please specify levels of performance } LEVEL_1 0 0 MAINTAINABILITY: class = Class_BASIC + Class_HALSTEAD { Halstead Theory: Please specify levels of performance } LEVEL_1 0 0 MAINTAINABILITY: package = Package_BASIC + Package_HALSTEAD { Halstead Theory: Please specify levels of performance } LEVEL_1 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /ADA *MD* *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: n1 I 0 +oo N1 I 0 +oo n2 I 0 +oo N2 I 0 +oo n I 0 +oo N I 0 +oo CN F 0.00 +oo V F 0.00 +oo D F 0.00 +oo L F 0.00 +oo E F 0.00 +oo I F 0.00 +oo # Module scope: md_n1 I 0 +oo md_N1 I 0 +oo md_n2 I 0 +oo md_N2 I 0 +oo md_n I 0 +oo md_N I 0 +oo md_CN F 0.00 +oo md_V F 0.00 +oo md_D F 0.00 +oo md_L F 0.00 +oo md_E F 0.00 +oo md_I F 0.00 +oo *MC* # Criteria / Sub-characteristics Specification Section: # ----------------------------------------------------- # Function scope: Function_BASIC = n1 + N1 + n2 + N2 { Halstead basic metrics: Please specify levels of performance } LEVEL_1 0 4 0 Function_HALSTEAD = n + N + CN + V + D + L + E + I { Halstead Theory : Please specify levels of performance } LEVEL_1 0 8 0 # Module scope: Module_BASIC = md_n1 + md_N1 + md_n2 + md_N2 { Halstead basic metrics: Please specify levels of performance } LEVEL_1 0 4 0 Module_HALSTEAD = md_n + md_N + md_CN + md_V + md_D + md_L + md_E + md_I { Halstead Theory : Please specify levels of performance } LEVEL_1 0 8 0 *BQ* # Factors / characteristics Specification Section: # ------------------------------------------------ MAINTAINABILITY: component = Function_BASIC + Function_HALSTEAD { Halstead Theory : Please specify levels of performance } LEVEL_1 0 0 MAINTAINABILITY: module = Module_BASIC + Module_HALSTEAD { Halstead Theory : Please specify levels of performance } LEVEL_1 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o