SoftwareQualityModel

advertisement
Software Quality Model
-- a preliminary report --
鄢萌 刘骁
Outline
1. 软件质量
2. 软件质量模型
3. 概率质量模型
4. 主题质量模型
5. Squale模型详解
2015/4/8
page2
Preface
Measure what is measurable, and make measurable what
is not so.
-----Galileo Galilei (1564-1642)
2015/4/8
page3
软件质量
• 软件过程质量:
-- 过程质量,设计质量
-- 软件过程监控与软件过程改进(CMM/CMMI,redmine过程框架)
• 软件质量:
-- 满足用户的需求
-- 需求、设计及开发质量
-- 内部及外部质量(可观测)
-- 设计、实现、测试及维护质量
-- 无缺陷 ,运行正确 (狭义)
--与软件产品满足明确或隐含需求的能力有关的特征和特性的总和
2015/4/8
page4
软件质量模型
质量特性/特征/子特征/度量元
特征值计算方法/特征权重
软件质量模型
个体评分/特征评分/综合评分方法
2015/4/8
page5
基于源代码挖掘的软件质量模型
isse.cqu.edu.cn
Level 1
质量需求特
征
建模和学习
Level 2
1
1 ,n
质量需求
子特征
Level 3
1
1 ,n
特征表示
和描述
基于源代码的软件质量评估和分析
源代码度量
特征
源代码
特征提取
现有软件质量模型
• Boehm
• McCall
• ISO9126
• SIG model
• Squale
• Sqale (sonar)
2015/4/8
page7
Boehm’s Model(Boehm, 1976)
2015/4/8
page8
McCall(US Air Force)(McCall, 1978)
2015/4/8
page9
McCall model
可维护性
灵活性
可测试性
产
品
修
正
性
可移植性
可重用性
产
可互操作性
品
转
移
性
产品运行性
正确性
完整性
rf = c1m1 + c2m2 + c3m3 + ...
rf is a rating of a quality factor, f
ci are the regression coefficients
2015/4/8
可靠性
有用性
有效性
m. are the various measurements f
page10
ISO 9126 (1991)
 “软件质量”(ISO9126):软件满足规定或潜在用户需
求特性的总和。包括“内部质量”、“外部质量”和“
使用质量”三部分。
• 外在因素:软件所提供的功能、性能、人机交互界面是否美
观、易于操作
• 内在因素:软件的设计好坏、缺陷的数目和严重程度
–
–
–
–
–
–
–
没有××功能(功能)
运行速度太慢(性能)
有太多的错误(缺陷)
软件不好改动(维护)
界面不美观(人机界面)
这个软件不好使用(易用性)
等等。。。。。
2015/4/8
page11
ISO 9126
2015/4/8
page12
ISO 9126
 Specifying software quality for a product yet to be
developed is difficult for the customer and/or
supplier
 The customer needs to understand and communicate
requirements for the product to be developed
 The supplier needs to understand the requirement and
to assess with confidence whether it is possible to
provide the product with the right level of quality
ISO 9126 will serve to eliminate any
misunderstanding between customer and supplier
2015/4/8
page13
ISO 9126
外部和内部质量
功能性
可靠性
易用性
效率
可维护性
可移植性
适合性
准确性
互操作性
成熟性
容错性
易恢复性
易理解性
易学性
易操作性
吸引性
时间特性
易分析性
易改变性
稳定性
易测试性
适应性
易安装性
共存性
易替换性
保密安全
性
资源利用
性
ISO 9126 does not provide sub-characteristics and metrics, nor the
method for measurement, rating and assessment.
2015/4/8
page14
SIG1 model (Software Improvement
Group) (2007, 2011)
Ideas:
1.
2.
3.
4.
5.
Based on ISO9126
Focus on maintainability
non-overlap metrics
Better and worse principle
Benchmark in 2011
Rating 1: <= 10% coverage
Rating 2: 10% < coverage <= 60%
Rating 3: 60% < coverage <= 80%
Rating 4: 80% < coverage <= 95%
Rating 5: coverage >95%
1. Software Improvement Group http://www.sig.eu/
2015/4/8
page15
SQALE(2011)
• SQALE: Software Quality Assessment based on
Lifecycle Expectations
http://nemo.sonarqube.org/dashboard/index/176173?did=19
2015/4/8
page16
SQALE (sonar)
2015/4/8
page17
SQALE (sonar)
SQALE Quality Model Example for the Java Language
2015/4/8
page18
Outline
1. 软件质量
2. 软件质量模型
3. 概率质量模型
4. 主题质量模型
5. Squale模型详解
2015/4/8
page19
Paper
• Bakota T, Hegedus P, Kortvelyesi P, et al. A
probabilistic software quality model[C]//Software
Maintenance (ICSM), 2011 27th IEEE International
Conference on. IEEE, 2011: 243-252.
http://www.sed.inf.u-szeged.hu/
2015/4/8
page20
Probabilistic Quality Model
存在的问题:
源代码仓库
特征/度量元
提取
现有
质量
模型
构造质量模型
概率
主题
模型
 源代码底层度量元表示单一
--值或均值
 上层指标计算方法的单一
--权重依据
--线性加权
创新点:
创建了一个标准数据库
从概率的角度为每层的每
个属性构造了goodness函
数
质量评估与改进
2015/4/8
page21
Overview
Benchmark构建
开始
选取100
个java项
目
专家选择
度量元选择
columbus
度量元计算
构造benchmark database
与benchmark中
度量元进行比较
得到goodness
函数
计算上层特征
的goodness
验证与评估
System1
REM
构建概率质量模型
2015/4/8
page22
Probabilistic Quality Model
2015/4/8
page23
Formulation
• Attribute Dependency Graph (ADG) G= (S∪A, E)
S: sensor nodes
A: aggregation nodes
E: Edges
• Goodness:how good or bad an attribute is
Xu : the goodness of each node u
gu : the goodness function of node u
h(t) : the density functions of a system for a metric t
w(t) : the weight –function of the metric t
2015/4/8
page24
Constructing goodness function (1/3)
h1(t),h2(t) : the density functions of two systems for the same metric
w(t) : the weight –function of the metric
D(h1,h2) : h1与h2在度量元t上的差异
2015/4/8
page25
Constructing goodness function (2/3)
-- w(t) : the weight–function of the metric
--Set w(t)=c: all metric values matter in the same amount
--Set w(t)=t: higher metrical values are worse. (e.g. McCabe’s complexity)
归一化:
2015/4/8
x →x/2· max(| max|,| min|)+0.5
[−∞,+∞] → [0,1]
page26
Constructing goodness function (3/3)
第i个系统在特定的度量元上取值的随机变量:
中心极限定理:
2015/4/8
page27
Aggregation
--v :each aggregate node
--n :is the number of incoming edges
--n :is the number of incoming edges
-: the composed probability of the vote
--
2015/4/8
the goodness of the target node
page28
Experiment(data)
2015/4/8
page29
Experiment(Result)
2015/4/8
page30
Evaluation(1/3)
• Pearson相关系数
r 
 X  X Y  Y 
 X  X   Y  Y 
2
2





X 的离均差平方和:
l XX   X  X
Y 的离均差平方和:
lYY   Y  Y
X与Y 间的离均差积和:
l XY   X  X Y  Y

lXY
lXX lYY
2
2


0.8-1.0 极强相关
0.6-0.8 强相关
0.4-0.6 中等程度相关
0.2-0.4 弱相关
0.0-0.2 极弱相关或无相关
2015/4/8
page31
Evaluation(2/3)
2015/4/8
page32
Evaluation(3/3)
--Averaged grades for maintainability and it’s ISO9126 attributes based on the
developer’s opinion
2015/4/8
page33
Conclusion
• Positive
--expert knowledge
--benchmark database
--ISO9126 based
--a probabilistic model
• Negative
-- weight function w(t)
-- limitation of the developers
-- only compare the mean values of goodness functions and the
averages of the experts’ votes (distribution)
2015/4/8
page34
Outline
1. 软件质量
2. 软件质量模型
3. 概率质量模型
4. 主题质量模型
5. Squale模型详解
2015/4/8
page35
Topic model in NLP
-- 一个主题好比是一个“桶”
-- 主题是由一“桶”有联系的单词来体现
-- 每个文档都是所有主题的概率混合
-- 每个词都与一个主题概率相关
2015/4/8
page36
Topic model in Shape semantics
Probabilistic Latent Semantic Analysis (pLSA)
d
D
z
w
N
“face”
2015/4/8
page37
Topic model in software quality
Probabilistic Latent Semantic Analysis (pLSA)
z
d
N
D
File/class
2015/4/8
w
“maintainability”
warning
Error
CBO
McCabe
TLLOC
CC
page38
Research Question 1
• 如何选择单词与主题?
--based on SIG model
2015/4/8
page39
Research Question 2
• 为了得到词频矩阵,如何对单词进行量化?
Practice Name
Class cohesion
Criteria
modularity, maintainability
Score
class
Metrics
LCOM2 (lack of cohesion in methods)
Mark
Individual mark:
– 0 if lcom2 > 100
– 1 if lcom2 > 50
– 2 if lcom2 > 0
– 3 if lcom2 <= 0
Weight
soft
Metadata
参考5.1.3
Company Logo
Page25
Research Question 3
• 如何加入监督信息?如何解释主题模型在质量评估中的意
义?
---taged words
---labeled topic
---supervised LDA
---labeled LDA
---权重函数w(t)
---主题概率
2015/4/8

权重weight
page41
Research Question 3
Correctness
Reliability
Efficiency
Integrity
Usability
Maintainability
Testability
Flexibility
Portability
Reusability
C
Inverse
R
Direct
E
I
U
M
T
F
P
R
Interoperability
2015/4/8
page42
Future work
1. 专家调研
2. 相关系数计算
结果评估
1. 主题概率与权重
主题应用
1. 词频矩阵构建
2. 监督信息
3. 专家知识
主题质量模型的建立
1. 围绕ISO9126
2. 以可维护性切入
3. 借鉴squale
源代码特征选择与提取
2015/4/8
page43
Outline
1. 软件质量
2. 软件质量模型
3. 概率质量模型
4. 主题质量模型
5. Squale模型详解
2015/4/8
page44
Squale模型详解
Squale (Software Quality Enhancement) is an open-source platform
that helps monitoring software quality for multi-language applications.
It currently supports Java out-of-the-box, and can also analyse C/C++ .
Squale is partially funded by the French FUI (Fonds unique
interministériel ), labeled by the Systematic Paris-Region competitive
cluster and supported by its FLOSS group.
2015/4/8
page45
Squale模型详解
2015/4/8
page46
Squale模型详解
可以从图中看出squale模型共分为measures,pratice,critersion,factor 四
层。其中低层的若干个属性组成高层的一个属性,依次类推直到最高
层factor层。
2015/4/8
page47
Squale模型详解
2015/4/8
page48
Squale模型详解
2015/4/8
page49
Squale评价体系
Practice analysis
• metric analysis: based on computed metrics.
—— Inheritance Depth,Source comments rate
• model analysis :based on model analysis.
—— Encapsulation,Classes without method
• rules checking :analysis based on programming rules.
—— Formatting standard,Naming standard
• human analysis :based on human expertise.
—— Documentation quality,Code organization
• dynamic analysis :based on tests analysis.
—— Robustness tests,Functional limits testing
2015/4/8
page50
Squale评价体系
Practice marks
Practice global marks for a project are computed, in most cases, in two
steps:
• Individual mark: Each element (method, class, or package in
object-oriented programs) targeted by a practice is given a mark
with respect to its measures. For example, the two metrics
composing the comment rate practice, cyclomatic complexity and
source line of code, are defined at the method level; thus a comment
rate mark is computed for each method.
• Global mark A global mark for the practice is computed using a
weighted average of the previous individual marks.
2015/4/8
page51
Squale评价体系
Individual mark
Two kinds of formulae exist for computing individual
marks, namely discrete and continuous formulae. An
individual mark is computed from measures in multiple
ranges into a single mark in the range [0; 3].
2015/4/8
page52
Squale评价体系
Global mark
The computation of the practice mark is a two-step process. First a
weighting function is applied to each individual mark:
Then the inverse function:
Thus the global mark for a practice is:
This formula translates individual marks into a new space where low marks
have significantly more weight than others. The average of the weighted marks
will reflect the more important weight of the low marks.
2015/4/8
page53
Squale评价体系
2015/4/8
page54
Squale模型详解
2015/4/8
page55
Squale模型详解
2015/4/8
page56
Squale模型详解
2015/4/8
page57
Squale模型详解
2015/4/8
page58
Squale模型详解
2015/4/8
page59
Squale模型详解
2015/4/8
page60
Squale模型详解
2015/4/8
page61
Download