正在加载图片...
334 IEEE TRANSACTIONS ON SOFTWARE ENGINEERING,VOL 41,NO.4,APRIL 2015 TABLE 1 Definitions of Slice-Based Cohesion Metrics Metric Definition Description Source Coverage Coverage=☆∑图 The extent to which the slices cover the module(measured 31,[20] as the ratio of the mean slice size to the module size) MaxCoverage MaCoveragemaxiSLil 1 The extent to which the largest slice covers the module (measured as the ratio of the size of the largest slice to the module size) MinCoverage MinCoverage in(M minilSLil The extent to which the smallest slice covers the module (measured as the ratio of the size of the smallest slice to the module size) Overlap Overlap=高∑图哥 The extent to which slices are interdependent(measured as the average ratio of the size of the"cohesive section"to the size of each slice) Tightness Tightness gi万 The extent to which all the slices in the module belong together(measured as the ratio of the size of the "cohesive section"to the module size) SFC ISG(SA(M) SFC =okens(M) The extent to which all the slices in the module belong [4 together (measured as the ratio of the number of super-glue tokens to the total number of data tokens of the module) WFC WFC=ISS4AMω The extent to which the slices in the module belong together tokens(Ar) (measured as the ratio of the number of glue tokens to the total number of data tokens of the module) A A= 2tG(SAM))slices containingt The extent to which the glue tokens in the module are adhe- ltokens(M)x SA(M) sive(measured as the ratio of the amount of the adhesive- ness to the total possible adhesiveness) NHD NHD=1-∑=19(k-G) The extent to which the statements in the slices are the same [5) (measured as the ratio of the total slice agreement between rows to the total possible agreement between rows in the statement-level slice occurrence matrix of the module) SBFC 1 if Vol =1 The extent to which the slices are similar(measured as [8 SBFC -tabens(-l) the average degree of the normalized similarity between tokens(M川Vx(V-可 otherwise columns in the data-token-level slice occurrence matrix of the module) M,Vo denotes the set of its output variables,length(M) the forward slices from the definitions of the largest, denotes its size,SA(M)denotes its slice abstraction,and smallest,and range variables in the backward slices;and (5) tokens(M)denotes the set of its data tokens.SLi is the slice the ninth to eleventh columns list the metric slices for the obtained for vi Vo and SLint (called "cohesive section"by largest,smallest,and range variables.Here,a vertical bar Harman et al.[61)is the intersection of SLi over all vi Vo. "|"in the last nine columns denotes that the indicated state- In particular,G(SA(M))and SG(SA(M))are respectively ment is part of the corresponding slice for the named output the set of glue tokens and the set of super-glue tokens.In variable.This example function determines the smallest,the the definition of NHD,k is the number of statements,I is the largest,and the range of an array,which is a modified ver- number of output variables,and c;is the number of Is in sion of the example module used by Longworth [7].For this the jth column of the statement-level slice occurrence example,Vo consists of largest,smallest,and range.The for- matrix.In the definition of SBFC,z;is the number of 1s in mer two variables are the modified reference parameters the i-th row of the data-token-level slice occurrence matrix. and the latter is the function return value.Table 3 shows the Note that all the slice-based cohesion metrics can be com- data-token level slice occurrence matrix of the fun function puted at the statement or data-token level,although some of under end slices and metric slices,where T;indicates the ith them are originally defined at either the statement level or data token for T in the function. the data-token level.The data-token level is at a finer granu- Table 4 shows the computations of twenty data-token- larity than the statement level since a statement might con-level slice-based cohesion metrics.In this table,the second tain a number of data tokens.We next use an example to eleventh rows show the computations for end-slice-based function fun shown in Table 2 to illustrate the computations cohesion metrics and the 12th to 21st rows show the compu- of the slice-based cohesion metrics at the data-token level.tations for metric-slice-based cohesion metrics.As can be In Table 2:(1)the first column lists the statement number seen,end-slice-based metrics indicate with typical values (excluding non-executable statements such as blank state- around 0.5 or 0.6,while metric-slice-based metrics indicate ments,"("and ")")(2)the second column lists the code of with typical values around 0.7 or 0.8.In particular,for the example function;(3)the third to fifth columns respec-each cohesion metric(except MaxCoverage),the metric-slice- tively list the end slices for the largest,smallest,and range based version has a considerably larger value than the cor- variables;(4)the sixth to eighth columns respectively list responding end-slice-based version.When looking at theM, Vo denotes the set of its output variables, length(M) denotes its size, SA(M) denotes its slice abstraction, and tokens(M) denotes the set of its data tokens. SLi is the slice obtained for vi 2 Vo and SLint (called “cohesive section” by Harman et al. [6]) is the intersection of SLi over all vi 2 Vo. In particular, G(SA(M)) and SG(SA(M)) are respectively the set of glue tokens and the set of super-glue tokens. In the definition of NHD, k is the number of statements, l is the number of output variables, and ci is the number of 1s in the jth column of the statement-level slice occurrence matrix. In the definition of SBFC, xi is the number of 1s in the i-th row of the data-token-level slice occurrence matrix. Note that all the slice-based cohesion metrics can be com￾puted at the statement or data-token level, although some of them are originally defined at either the statement level or the data-token level. The data-token level is at a finer granu￾larity than the statement level since a statement might con￾tain a number of data tokens. We next use an example function fun shown in Table 2 to illustrate the computations of the slice-based cohesion metrics at the data-token level. In Table 2: (1) the first column lists the statement number (excluding non-executable statements such as blank state￾ments, “{“, and “}”); (2) the second column lists the code of the example function; (3) the third to fifth columns respec￾tively list the end slices for the largest, smallest, and range variables; (4) the sixth to eighth columns respectively list the forward slices from the definitions of the largest, smallest, and range variables in the backward slices; and (5) the ninth to eleventh columns list the metric slices for the largest, smallest, and range variables. Here, a vertical bar “ j ” in the last nine columns denotes that the indicated state￾ment is part of the corresponding slice for the named output variable. This example function determines the smallest, the largest, and the range of an array, which is a modified ver￾sion of the example module used by Longworth [7]. For this example, Vo consists of largest, smallest, and range. The for￾mer two variables are the modified reference parameters and the latter is the function return value. Table 3 shows the data-token level slice occurrence matrix of the fun function under end slices and metric slices, where Ti indicates the ith data token for T in the function. Table 4 shows the computations of twenty data-token￾level slice-based cohesion metrics. In this table, the second to eleventh rows show the computations for end-slice-based cohesion metrics and the 12th to 21st rows show the compu￾tations for metric-slice-based cohesion metrics. As can be seen, end-slice-based metrics indicate with typical values around 0.5 or 0.6, while metric-slice-based metrics indicate with typical values around 0.7 or 0.8. In particular, for each cohesion metric (except MaxCoverage), the metric-slice￾based version has a considerably larger value than the cor￾responding end-slice-based version. When looking at the TABLE 1 Definitions of Slice-Based Cohesion Metrics Metric Definition Description Source Coverage Coverage ¼ 1 j j Vo P V0 j j i¼1 SLi j j length Mð Þ The extent to which the slices cover the module (measured as the ratio of the mean slice size to the module size) [3], [20] MaxCoverage MaxCoverage ¼ 1 lengthð Þ M maxi SLi j j The extent to which the largest slice covers the module (measured as the ratio of the size of the largest slice to the module size) MinCoverage MinCoverage ¼ 1 lengthð Þ M mini SLi j j The extent to which the smallest slice covers the module (measured as the ratio of the size of the smallest slice to the module size) Overlap Overlap ¼ 1 j j Vo P V0 j j i¼1 SLint j j SLi j j The extent to which slices are interdependent (measured as the average ratio of the size of the “cohesive section” to the size of each slice) Tightness Tightness ¼ SLint j j length Mð Þ The extent to which all the slices in the module belong together (measured as the ratio of the size of the “cohesive section” to the module size) SFC SFC ¼ j j SG SA M ð Þ ð Þ j j tokens Mð Þ The extent to which all the slices in the module belong together (measured as the ratio of the number of super-glue tokens to the total number of data tokens of the module) [4] WFC WFC ¼ j j G SA M ð Þ ð Þ j j tokens Mð Þ The extent to which the slices in the module belong together (measured as the ratio of the number of glue tokens to the total number of data tokens of the module) A A ¼ P t2G SA M ð Þ ð Þ slices containing t j j tokens Mð Þ j j SA Mð Þ The extent to which the glue tokens in the module are adhe￾sive (measured as the ratio of the amount of the adhesive￾ness to the total possible adhesiveness) NHD NHD ¼ 1  2 lk kð Þ 1 Pl j¼1 cj k  cj The extent to which the statements in the slices are the same (measured as the ratio of the total slice agreement between rows to the total possible agreement between rows in the statement-level slice occurrence matrix of the module) [5] SBFC SBFC ¼ 1 if Vj j¼ o 1 Pj j tokens Mð Þ t¼1 xið Þ xi1 j j tokens Mð Þ j j Vo ð Þ j j Vo 1 otherwise ( The extent to which the slices are similar (measured as the average degree of the normalized similarity between columns in the data-token-level slice occurrence matrix of the module) [8] 334 IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, VOL. 41, NO. 4, APRIL 2015
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有