度量代码特征的常见度量元

度量元体系

对于已有度量元的分类可以按照提取的角度进行分类也可以从软件质量的角度进行分类。

度量元按照提取方式的角度分为如下的几类

度量代码特征的常见度量元

从软件可维护性质量模型的角度可以按照如下的方式进行分类

度量代码特征的常见度量元

CK度量元

wmc

Weighted methods per class

CK

类中方法的个数

dit

Depth of Inheritance Tree

CK

类的继承层次

noc

Number of Children

CK

类的直接子类个数

cbo

Coupling between object classes

CK

类与其他类存在耦合关系的数量,这里耦合关系只考虑非继承关系,即 CK 认为耦合关系不包括继承关系,只包括依赖 关系、实现关系、关联关系、组合关系、聚合关系。

rfc

Response for a class

CK

类的响应集,RFC一方面反应了类本身定义的方法数量,另一方面反映了一个类与其他类之间的交互性(耦合性)。因此 RFC 体现了类的复杂性。

lcom

Lack of cohesion in methods

CK

内聚缺乏度;计算所有的方法对的个数减去方法对中没有共享全局变量的方法对

ca

Afferent couplings

CK

传入耦合:有多少类依赖于要度量的类

ce

Efferent couplings

CK

传出耦合:要度量的类依赖多少外部类

npm

Number of Methods

CK

有多少方法是公共的方法

lcom3

Lack of cohesion in methods

CK

 

loc

Lines of Code

CK

代码行数

dam

Data Access Metric

CK

一个类中私有的属性占所有属性的比例

moa

Measure of Aggregation

CK

类中的属性类型是类的定义的个数

mfa

Measure of Functional Abstraction

CK

一个类中继承的方法个数占所有方法个数的比率

cam

Cohesion Among Methods of Class

CK

每个方法不同参数类型总和除以类中不同参数的个数乘以总的方法个数

cbm

Coupling between Methods

CK

继承的方法与该类中新建的方法之间耦合的个数;继承的方法使用新定义的属性,继承的方法调用新建的方法;新建的方法调用继承的方法

 

 

McCabe

loc

line of code

McCabe

代码行数

v(g)

cyclomatic complexity

McCabe

圈复杂度

ev(g)

essential complexity

McCabe

基本复杂度

 

 

Halstead

n

total oeprators+operands

Halstead

所有的操作符和操作数的和

v

volume

Halstead

程序容量

l

program length

Halstead

程序长度

d

difficulty

Halstead

复杂度

i

intelligence

Halstead

智力

e

effot

Halstead

工作量

t

time estimator

Halstead

时间评估

lOCode

line count

Halstead

代码行数(有效代码)

lOComment

count of lines of comments

Halstead

注释行数

IOBlank

count of blank lines

Halstead

空行数

uniq_Op

unique operators

Halstead

多少种操作操作符

uniq_Opnd

unique operands

Halstead

多少种操作数

total_Op

total operators

Halstead

操作符个数

total_Opnd

total operands

Halstead

操作数个数

branchCount

branch of the flow graph

 

分支个数

HALSTEAD_LEVEL

level at which the program can be understand

Halstead

程序可以理解的程度

 

LOC

空白行

注释行

总的代码行

可执行的代码行

 

code churn

Total LOC

is the number of lines of non-commented executable lines in the files comprising the new version of a binary.

Churned LOC

is the sum of the added and changed lines of code between a baseline version and a new version of the files comprising a binary.

Deleted LOC

is the number of lines of code deleted between the baseline version and the new version of a binary. The churned LOC and the deleted LOC are computed by the version control systems using a file comparison utility like diff.

File count

is the number of files compiled to create a binary.

Weeks of churn

is the cumulative time that a file was opened for editing from the version control system.

File churned

is the number of files within the binary that churned.

churned LOC/Total LOC

 

Deleted LOC/Total LOC

 

Weeks of churn/File count

 

Churned LOC/Deleted LOC

 

 

耦合和内聚度量元

CBO

Coupling between object classes. According to the definition of this measure, a class is coupled to another, if methods of one class use methods or attributes of the other, or vice versa. CBO is then defined as the number of other classes to which a class is coupled.

CBO'

Same as CBO, except that inheritance-based coupling is not counted.

DAC

Data abstraction coupling. The number of attributes in a class that have another class as their type.

LCOM1

Lack of cohesion in methods. The number of pairs of methods in the class using no attribute in common.

LCOM2

LCOM2 is the number of pairs of methods in the class using no attributes in common, minus the number of pairs of methods that do. If this difference is negative, however, LCOM2 is set to zero.

LCOM3

Consider an undirected graph G, where the vertices are the methods of a class, and there is an edge between two vertices if the corresponding methods use at least an attribute in common. LCOM3 is defined as the number of connected components of G.

LCOM4

Like LCOM3, where graph G additionally has an edge between vertices representing methods m and n, if m invokes n or vice versa.

LCOM5

Consider a set of methods {Mi} (i=1,...,m) accessing a set of attributes {Aj} (j=1,...,a). Let

(Aj) be the number of methods which reference attribute Aj. Then LCOM5= 度量代码特征的常见度量元

 

NetworkMetrics

通过网络嵌入的方式提取模块依赖图中的节点特征

 

Previous Defects

模块之前含有的缺陷个数

 

Entropy Metrics

the idea consists in measuring, over a time interval, how distributed changes are in a system.The more spread, the higher is the complexity.

 

HCM

History of Complexity Metric

度量代码特征的常见度量元

度量代码特征的常见度量元

WHCM

Weight History of Complexity Metric

cij = pj , each modified file gets the entropy of the system weighted with the probability of the file being modified.

度量代码特征的常见度量元

上一篇:cookie不支持中文,必须转码后存储,否则会乱码


下一篇:Luogu P2602 [ZJOI2010]数字计数 数位DP