< reference $Id: SampleJava.ref,v 1.2 2009/04/06 18:03:48 frmath Exp $ > # # Version: April 2009 by Kalimetrix on behalf of IBM Rational. # #------------------------------------------------------------------ # This file is an EXAMPLE of a LOGISCOPE QUALITY MODEL FILE | # that is used to evaluate source code MAINTAINABILITY of | # Ada, C, C++, or Java|programs in compliance with the | # ISO/IEC 9126-1:2001 international standard [9126-1]. | # | # The ISO/IEC 9126-1:2001 international standard defines | # software internal quality according to the following six | # characteristics: | # - FUNCTIONALITY | # - RELIABILITY | # - USABILITY | # - EFFICIENCY | # - MAINTAINABILITY | # - PORTABILITY | # | # MAINTAINABILITY is defined as "the capability of the software | # product to be modified. Modifications may include corrections, | # improvements or adaptation of the software to changes in | # environment, and in requirements and functional specifications" | # It is broken down into the following four sub-characteristics: | # - ANALYZABILITY | # - CHANGEABILITY | # - STABILITY | # - TESTABILITY | # | # For a standardized definitions of these sub-characteristics, | # please refer to Logiscope Audit - Basic Concepts or [9126-1]. | # | # The present Logiscope Quality Model file complies with the | # ISO/IEC 9126-1:2001 Quality Model and follow the recommendations| # of the software product evaluation international standard | # by rating software components according to four levels of | # performance: | # | # EXCELLENT : All metrics respect the specified thresholds. | # GOOD : When it does not deviate much from the model. | # FAIR : When some component attributes may undermine the | # optimal level of maintainability. | # POOR : When the component attributes cannot guarantee an | # optimal level of maintainability. | # Such a component shall be subject to code review | # to state if the complexity is justified or not | # | # The Logiscope Audit quality models are presented in this order: | # /ADA | # /C | # /C++ | # /JAVA | # | #------------------------------------------------------------------ /ADA *MD* # User Defined Metric Section : # ----------------------------- # Function Scope: "Average size of statements": avg_size = (N1+N2) / MAX(lc_stat,1) { Average number of operands and operators per executable statement: avg_size = N1+N2 / lc_stat; where: N1 is the number of operator occurrences, N2 is the number of operand occurrences, lc_stat is the number of statements in the function. } "Vocabulary frequency": voc_freq = MAX((N1+N2),1) / MAX((n1+n2),1) { Average number of times the vocabulary is used: voc_freq = (N1+N2) / (n1+n2) where : N1 is the number of operator occurrences, N2 is the number of operand occurrences, n1 is the number of distinct operators, n2 is the number of distinct operands. } "Comment frequency": com_freq = lc_comm / MAX(lc_stat,1) { Ratio between the number of lines of comments in the function and the number of statements: com_freq = lc_comm / lc_stat where: lc_comm is the number of lines of comments in the function, lc_stat is the number of instructions in the function. } "Structuring": struc_pg = ct_bran + ct_exit { Number of violations of Structured Programming: - ct_bran : No destructuring branchings - ct_exit : No auxilary exit } # Module Scope: "Module comment rate": md_comf = md_comm / md_line { Ratio between the number of lines of comments in the module and the number of lines: md_comf = md_comm / md_line where: md_comm is the number of lines of comments in the module, md_line is the total number of lines in the module. } "Module declarations": md_dcl = md_vars + md_consts + md_types { Number of data declared in the module: md_dcl = md_vars + md_consts + md_types where: md_vars is the number of declared variables, md_consts is the number of declared constants. md_types is the number of declared types. } "Module fan out": md_fanout = md_expva + md_expco + md_expty + md_expex { Number of data exported by the module: md_fanout = md_expva + md_expco + md_expty + md_expex where: md_expva is the number of exported variables, md_expco is the number of exported constants. md_expty is the number of exported types, md_expex is the number of exported exceptions. } # Application Scope: "Average complexity of functions": ap_wmc = ap_vg / ap_func { Average cyclomatic number (VG) of the functions defined in the project: ap_wmc = ap_vg / ap_func where: ap_vg is the sum of the cyclomatic numbers of the functions, ap_func is the number of functions in the application. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: avg_size F 0.00 9.00 com_freq F 0.20 +oo ct_nest I 0 4 ct_path I 0 80 struc_pg I 0 1 ct_vg I 0 10 dc_calling I 0 7 ic_param I 0 5 lc_stat I 0 50 n2 I 0 30 voc_freq F 0.00 4.00 # Module scope: md_n2 I 0 100 md_dcl I 0 25 md_line I 0 1000 md_comf F 0.20 +oo md_excs I 0 0 md_stat I 0 500 md_expfn I 0 15 md_fanout I 0 7 md_types I 0 5 md_vars I 0 10 md_with I 0 4 # Application scope: ap_func I 0 3000 ap_sline I 0 200000 ap_vg I 0 6000 ap_cg_levl I 1 12 ap_wmc F 0.00 3.00 *MC* # Criteria / Sub-characteristics Specification Section: # ----------------------------------------------------- # Function scope: ANALYZABILITY = ct_vg + avg_size + com_freq + lc_stat { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be indentified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITY = voc_freq + n2 + ct_nest { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITY = struc_pg + dc_calling + ct_path { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITY = ct_vg + ic_param + ct_path { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Module scope: ANALYZABILITYm = md_comf + md_line + md_with { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be indentified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 CHANGEABILITYm = md_n2 + md_types + md_vars { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITYm = md_dcl + md_fanout + md_expfn { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITYm = md_expfn + md_stat + md_excs { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Application scope: SIZE = ap_func + ap_sline + ap_vg + ap_cg_levl + ap_wmc { Application Size is based on : - Number of functions - Total number of lines - Sum of function cyclomatic numbers - Depth of Call Graph - Average complexity of functions } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ LOW 4 5 2 MEDIUM 2 3 1 LARGE 0 1 0 *BQ* # Factors / characteristics specification Section: # ------------------------------------------------ MAINTAINABILITY: component = ANALYZABILITY + CHANGEABILITY + STABILITY + TESTABILITY { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: module = ANALYZABILITYm + CHANGEABILITYm + STABILITYm + TESTABILITYm { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 STATISTICS: application = SIZE { Application statistics: for statistical and information purposes only. } LOW 2 2 MEDIUM 1 1 LARGE 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /C *MD* # User Defined Metric Section : # ----------------------------- # Function Scope : "Average size of statements" : avg_size = (N1+N2) / MAX(lc_stat,1) { Average number of operands and operators per executable statement: avg_size = N1+N2 / lc_stat; where: N1 is the number of operator occurrences, N2 is the number of operand occurrences, lc_stat is the number of statements in the function. } "Vocabulary frequency" : voc_freq = MAX((N1+N2),1) / MAX((n1+n2),1) { Average number of times the vocabulary is used: voc_freq = (N1+N2) / (n1+n2) where : N1 is the number of operator occurrences, N2 is the number of operand occurrences, n1 is the number of distinct operators, n2 is the number of distinct operands. } "Comment frequency": com_freq = lc_comm / MAX(lc_stat,1) { Ratio between the number of lines of comments in the function and the number of statements: com_freq = lc_comm / lc_stat where: lc_comm is the number of lines of comments in the function, lc_stat is the number of instructions in the function. } "McCabe cyclomatic number": mc_vg = ct_vg + ct_ternary + ct_andthen + ct_orelse { McCabe Cyclomatic number of the function: mc_vg = ct_vg + ct_ternary + ct_andthen + ct_orelse where: ct_vg is the control graph cyclomatic number, ct_ternary is the number of occurrences of the "?:" operator, ct_andthen is the number of occurrences of the "&&" operator, ct_orelse is the number of occurrences of the "||" operator. The later 3 measures add all conditions to the "branch" oriented control graph cyclomatic number. } "Structuring": struc_pg = ct_bran + ct_exit { Number of violations of Structured Programming: - ct_bran : No break or continue in a loop, No goto - ct_exit : No auxilary exit } # Application Scope: "Average complexity of functions": ap_wmc = ap_vg / ap_func { Average cyclomatic number (VG) of the functions defined in the project: ap_wmc = ap_vg / ap_func where: ap_vg is the sum of the cyclomatic numbers of the functions, ap_func is the number of functions in the application. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: avg_size F 0.00 9.00 com_freq F 0.20 +oo ct_nest I 0 4 ct_path I 0 80 struc_pg I 0 1 ct_vg I 0 10 dc_calls I 0 7 dc_calling I 0 7 ic_param I 0 5 lc_stat I 0 50 mc_vg I 0 15 n2 I 0 30 voc_freq F 0.00 4.00 # Application scope: ap_func I 0 3000 ap_sline I 0 200000 ap_vg I 0 6000 ap_cg_levl I 1 12 ap_wmc F 0.00 3.00 *MC* # Criteria / Sub-characteristics specification Section: # ----------------------------------------------------- ANALYZABILITY = ct_vg + avg_size + com_freq + lc_stat { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be indentified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITY = voc_freq + n2 + ct_nest { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITY = struc_pg + dc_calling + ct_path { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITY = mc_vg + ic_param + dc_calls + ct_path { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 SIZE = ap_func + ap_sline + ap_vg + ap_cg_levl + ap_wmc { Application Size is based on : - Number of functions - Total number of lines - Sum of function cyclomatic numbers - Depth of Call Graph - Average complexity of functions } LOW 4 5 2 MEDIUM 2 3 1 LARGE 0 1 0 *BQ* # Factors / characteristics specification Section: # ------------------------------------------------ MAINTAINABILITY: component = ANALYZABILITY + CHANGEABILITY + STABILITY + TESTABILITY { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 STATISTICS: application = SIZE { Application statistics: for statistical and information purposes only. } LOW 2 2 MEDIUM 1 1 LARGE 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /C++ *MD* # User Defined Metric Section : # ----------------------------- # Function Scope : "Average size of statements" : avg_size = (N1+N2) / MAX(lc_stat,1) { Average number of operands and operators per executable statement: avg_size = N1+N2 / lc_stat; where: N1 is the number of operator occurrences, N2 is the number of operand occurrences, lc_stat is the number of statements in the function. } "Vocabulary frequency" : voc_freq = MAX((N1+N2),1) / MAX((n1+n2),1) { Average number of times the vocabulary is used: voc_freq = (N1+N2) / (n1+n2) where : N1 is the number of operator occurrences, N2 is the number of operand occurrences, n1 is the number of distinct operators, n2 is the number of distinct operands. } "Comment frequency": com_freq = lc_comm / MAX(lc_stat,1) { Ratio between the number of lines of comments in the function and the number of statements: com_freq = lc_comm / lc_stat where: lc_comm is the number of lines of comments in the function, lc_stat is the number of instructions in the function. } "Structuring": struc_pg = ct_bran + ct_exit { Number of violations of Structured Programming: - ct_bran: no break or continue in a loop, no goto, - ct_exit: no auxilary exit. } # Module Scope: "Module comment rate": md_comf = md_comm / md_line { Ratio between the number of lines of comments in the module and the total number of lines: md_comf = md_comm / md_line where: md_comm is the number of lines of comments in the module, md_line is the total number of lines in the module. } "Module declarations": md_dcl = md_vars + md_consts + md_types { Number of data declared in the module: md_dcl = md_vars + md_consts + md_types where: md_vars is the number of declared variables, md_consts is the number of declared constants. md_types is the number of declared types. } # Class scope: "Class comment rate": cl_comf = cl_bcom / MAX(cl_wmc,1) { Ratio between the number of blocks of comments in the class and the total number of statements: cl_comf = cl_bcom / cl_wmc where: cl_bcom is the number of lines of comments in the class, cl_wmc is the sum of cyclomatic numbers of the methods in the class. } "Total number of attributes": cl_data = cl_data_prot + cl_data_publ + cl_data_priv { Total number of private, protected and public attributes in the class. } "Total number of methods" : cl_func = cl_func_priv + cl_func_prot + cl_func_publ { Total number of private, protected and public methods in the class. } # Application Scope: "Average complexity of functions": ap_wmc = ap_vg / ap_func { Average cyclomatic number (VG) of the functions defined in the project: ap_wmc = ap_vg / ap_func where: ap_vg is the sum of the cyclomatic numbers of the functions, ap_func is the number of functions in the application. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: avg_size F 0.00 9.00 com_freq F 0.20 +oo ct_nest I 0 3 ct_path I 0 80 struc_pg I 0 1 ct_vg I 0 10 dc_calls I 0 7 dc_calling I 0 7 ic_param I 0 5 lc_stat I 0 30 n2 I 0 20 voc_freq F 0.00 4.00 # Module scope: md_n2 I 0 100 md_dcl I 0 25 md_line I 0 600 md_comf F 0.20 +oo md_stat I 0 250 md_expfn I 0 15 md_expva I 0 1 md_types I 0 5 md_vars I 0 10 md_impmo I 0 4 # Class scope: cl_comf F 1.00 +oo cl_data I 0 7 cl_func I 0 25 cl_wmc I 0 80 cu_cdused I 0 10 cu_cdusers I 0 5 in_bases I 0 3 in_noc I 0 3 cl_func_publ I 0 15 cl_data_publ I 0 0 cl_dep_meth I 0 10 # Application scope: ap_func I 0 3000 ap_sline I 0 200000 ap_vg I 0 6000 ap_cg_levl I 1 12 ap_wmc F 0.00 3.00 ap_inhg_levl I 1 5 # MOOD metrics: ap_mhf F 0.1 0.4 ap_ahf F 0.7 1.0 ap_mif F 0.6 0.8 ap_aif F 0.3 0.6 ap_pof F 0.3 1.0 ap_cof F 0.03 0.18 *MC* # Criteria / Sub-characteristics specification Section: # ----------------------------------------------------- # Function Scope: ANALYZABILITY = ct_vg + avg_size + com_freq + lc_stat { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITY = voc_freq + n2 + ct_nest { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITY = struc_pg + dc_calling + ct_path { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITY = ct_vg + ic_param + dc_calls + ct_path { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 # Module Scope: ANALYZABILITYm = md_line + md_comf + md_impmo { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 CHANGEABILITYm = md_n2 + md_types + md_vars { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITYm = md_dcl + md_expfn + md_expva { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITYm = md_stat + md_expfn + md_vars { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Class scope: ANALYZABILITYc = cl_wmc + cl_comf + in_bases + cu_cdused { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITYc = cl_wmc + cl_func + cl_data { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITYc = cl_data_publ + cu_cdusers + in_noc + cl_func_publ { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 TESTABILITYc = cl_wmc + cl_func + cu_cdused + cl_dep_meth { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 # Application Scope: SIZE = ap_func + ap_sline + ap_vg + ap_cg_levl + ap_wmc + ap_inhg_levl { Application Size is based on : - Number of functions - Total number of lines - Sum of function cyclomatic numbers - Depth of Call Graph - Average complexity of functions - Depth of Inheritance Tree } LOW 5 6 2 MEDIUM 2 4 1 LARGE 0 1 0 MOOD = ap_mhf + ap_ahf + ap_mif + ap_aif + ap_pof + ap_cof { The Metrics for Object Oriented Design (MOOD) have been introduced by F. Brito E Abreu [BRI, 94]: - MHF: Methof Hiding factor - AHF: Attribute Hiding factor - MIF: Method Inheritance Factor - AIF: Attribute Inheritance Factor - POF: Polymorphism Factor - COF: Coupling Factor } LOW 5 6 0 MEDIUM 2 4 0 LARGE 0 1 0 *BQ* # Factors / characteristics specification Section: # ------------------------------------------------ MAINTAINABILITY: component = ANALYZABILITY + CHANGEABILITY + STABILITY + TESTABILITY { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: module = ANALYZABILITYm + CHANGEABILITYm + STABILITYm + TESTABILITYm { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: class = ANALYZABILITYc + CHANGEABILITYc + STABILITYc + TESTABILITYc { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 STATISTICS: application = SIZE + MOOD { Application statistics: for statistical and information purposes only. } LOW 2 2 MEDIUM 1 1 LARGE 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o /JAVA *MD* # User Defined Metric Section : # ----------------------------- # Function Scope : "Average size of statements": avg_size = (N1+N2) / MAX(lc_stat,1) { Average number of operands and operators per executable statement: avg_size = N1+N2 / lc_stat; where: N1 is the number of operator occurrences, N2 is the number of operand occurrences, lc_stat is the number of statements in the function. } "Vocabulary frequency": voc_freq = MAX((N1+N2),1) / MAX((n1+n2),1) { Average number of times the vocabulary is used: voc_freq = (N1+N2) / (n1+n2) where : N1 is the number of operator occurrences, N2 is the number of operand occurrences, n1 is the number of distinct operators, n2 is the number of distinct operands. } "Comment frequency": com_freq = lc_comm / MAX(lc_stat,1) { Ratio between the number of lines of comments in the function and the number of statements: com_freq = lc_comm / lc_stat where: lc_comm is the number of lines of comments in the function, lc_stat is the number of instructions in the function. } "Structuring": struc_pg = ct_bran + MAX(ct_exit,1) { Number of violations of Structured Programming: - ct_bran : No break or continue in a loop, - ct_exit : No auxilary exit. } # Module Scope: "Module comment rate": md_comf = md_comm / md_line { Ratio between the number of lines of comments in the module and the number of lines: md_comf = md_comm / md_line where: md_comm is the number of lines of comments in the module, md_line is the total number of lines in the module. } "Module declarations": md_import = md_import_demd + md_import_pack + md_import_type { Number of data imported in the module: md_import = md_import_pack + md_import_type + md_import_demd where: md_import_pack is the number of imported packages, md_import_type is the number of imported types, md_import_demd is the number of importation on demand. } # Class scope: "Class comment rate": cl_comf = cl_comm / MAX(cl_line,1) { Ratio between the number of lines of comments in the module and the total number of lines: cl_comf = cl_comm / cl_line where: cl_comm is the number of lines of comments in the package, cl_line is the total number of lines in the package. } # Package scope: "Package comment rate": pk_comf = pk_com / MAX(pk_stmt,1) { Ratio between the number of lines of comments in the package and the total number of statements: pk_comf = pk_comm / pk_stmt where: pk_comm is the number of lines of comments in the package, pk_stmt is the total number of statements in the package. } "Total number of inheritance" : pk_inh = pk_extend + pk_implement { Number of inheritance using extend and/or implement in the package } # Application scope: "Average complexity of functions": ap_wmc = ap_vg / ap_func { Average cyclomatic number (VG) of the functions defined in the project: ap_wmc = ap_vg / ap_func where: ap_vg is the sum of the cyclomatic numbers of the functions, ap_func is the number of functions in the application. } *ME* # Metric Thresholds Specification Section: # ---------------------------------------- # Function scope: avg_size F 1.00 7.00 com_freq F 0.20 +oo ct_nest I 0 2 ct_path I 0 60 struc_pg I 0 1 ct_vg I 0 7 ic_param I 0 5 lc_stat I 0 30 n2 I 0 20 voc_freq F 1.00 4.00 # Module scope: md_class I 0 1 md_interf I 0 1 md_line I 0 500 md_comf F 0.20 +oo md_stat I 0 200 md_dclstat I 0 20 md_import I 0 10 md_import_pack I 0 4 # Class scope: cl_comf F 0.20 +oo cl_data I 0 7 cl_func I 0 20 cl_stat I 0 100 cl_wmc I 0 40 cu_cdused I 0 10 cu_cdusers I 0 5 in_bases I 0 3 in_noc I 0 3 cl_func_publ I 0 15 cl_data_publ I 0 0 # Package scope: pk_class I 0 7 pk_file I 0 10 pk_comf F 0.20 +oo pk_line I 0 3000 pk_data I 0 20 pk_data_publ I 0 0 pk_func I 0 100 pk_func_publ I 0 30 pk_pkused I 0 20 pk_inh_levl_max I 0 3 pk_inh I 0 10 pk_type I 0 5 pk_vg I 0 200 # Application scope: ap_func I 0 3000 ap_sline I 0 200000 ap_vg I 0 6000 ap_wmc F 0.00 3.00 ap_inhg_levl I 1 5 *MC* # Criteria / Sub-characteristics specification Section: # ----------------------------------------------------- ANALYZABILITY = ct_vg + avg_size + com_freq + lc_stat { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be indentified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITY = voc_freq + n2 + ct_nest { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITY = struc_pg + ct_nest + ct_path { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITY = ct_vg + ic_param + ct_path { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Module scope: ANALYZABILITYm = md_comf + md_line + md_import_pack { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 CHANGEABILITYm = md_stat + md_dclstat + md_class { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITYm = md_dclstat + md_class + md_interf { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 TESTABILITYm = md_stat + md_class + md_import { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Class scope: ANALYZABILITYc = cl_wmc + cl_comf + in_bases + cu_cdused { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITYc = cl_stat + cl_func + cl_data { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 STABILITYc = cl_data_publ + cu_cdusers + in_noc + cl_func_publ { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 TESTABILITYc = cl_wmc + cl_func + cu_cdused { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 3 3 3 GOOD 2 2 2 FAIR 1 1 1 POOR 0 0 0 # Package scope: ANALYZABILITYp = pk_vg + pk_comf + pk_inh_levl_max + pk_pkused { ANALYZABILITY: the capability of the sofware product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 CHANGEABILITYp = pk_stmt + pk_file + pk_func + pk_data { CHANGEABILITY: the capability of the software product to enable a specified modification to be implemented [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 STABILITYp = pk_data_publ + pk_func_publ + pk_type + pk_inh { STABILITY: the capability of the software product to avoid unexpected effects from modifications of the software [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 TESTABILITYp = pk_vg + pk_func + pk_inh + pk_class { TESTABILITY: the capability of the software product to enable modified software to be validated [ISO/IEC 9126-1:2001]. } #+----------------------------------------------------+ #| Level of | Number of metrics OK | Weight in | #| Performance | min | max | the report | #+--------------|----------|-----------|--------------+ EXCELLENT 4 4 3 GOOD 3 3 2 FAIR 2 2 1 POOR 0 1 0 # Application scope: SIZE = ap_func + ap_sline + ap_vg + ap_wmc + ap_inhg_levl { Application Size is based on : - Number of functions - Total number of lines - Sum of function cyclomatic numbers - Average complexity of functions - Depth of Inheritance Tree } LOW 5 5 2 MEDIUM 2 4 1 LARGE 0 1 0 *BQ* # Factors / characteristics specification Section: # ------------------------------------------------ MAINTAINABILITY: component = ANALYZABILITY + CHANGEABILITY + STABILITY + TESTABILITY { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: module = ANALYZABILITYm + CHANGEABILITYm + STABILITYm + TESTABILITYm { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: class = ANALYZABILITYc + CHANGEABILITYc + STABILITYc + TESTABILITYc { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 MAINTAINABILITY: package = ANALYZABILITYp + CHANGEABILITYp + STABILITYp + TESTABILITYp { MAINTAINABILITY: the capability of the software product to be modified. Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications [ISO/IEC 9126-1:2001]. } #+----------------------------------------+ #| Level of | Sum of the weights of | #| Performance | the subcharacteristics | #| | minimum | maximum | #+--------------|------------|------------+ EXCELLENT 12 12 GOOD 9 11 FAIR 6 8 POOR 0 5 STATISTICS: application = SIZE { Application statistics: for statistical and information purposes only. } LOW 2 2 MEDIUM 1 1 LARGE 0 0 #-------o-------o-------o-------o-------o-------o-------o-------o