软件演化的Halsread度量和评估

 2022-01-23 09:01

论文总字数:44420字

摘 要

本文用自行研制的halstead软件复杂度度量工具,解析Java应用程序的Halstead复杂度,通过分析Java应用程序不同层级(系统层,类层,方法层)的Halstead复杂度数据,以及这些数据在软件版本演化中的变化,验证Halstead复杂度度量法对于度量和分析软件质量的重要作用,分析产生演化的原因及演化的效果,识别出复杂度仍然比较高的模块且提出改进建议。

Halstead复杂度是1977年提出的计算机软件的第一个分析“定律”,该复杂度主要用于度量面向过程的语言,但其操作符和操作数的计算一直存在争议。本文将传统Halstead复杂度度量应用于面向对象的Java语言中,提出了一种基于抽象语法树的计算方法来进行Java应用程序的复杂度计算,并进行了工具实现和实验分析,验证了该计算方法的可行性。将Halstead复杂度的应用扩展到了面向对象的Java语言中。

【关键词】Halstead, 复杂度,Java, 软件演化

HALSTEAD METRICS ON SOFTWARE EVOLUTION

Abstract

In this thesis, the Halstead metrics of softwares was investigated using a specially designed software Halstead complexity measuring tool. Based on the information obtained from the oftware Halstead complexity measuring tool, the evolution between different versions of the software and this evolution’s cause and effects was analysed. The high compleity modules was identified and suggestions of improvement was raised.

Halstead complexity was proposed in 1977. It is the first “law” to the analysis of computer software. The complexity is mainly used to measure the programs which are built up by the procedure oriented languages, and its calculating methods for the operators and operands were controversial. In this paper, the Halstead complexity is applied to measure the complexity of Java applications, an abstract syntax tree based calculating method is proposed, a Halstead complexity measurement tool is implemented and verified by experiments. This work extends the application of Halstead complexity, and proves the feasibility of the measurement of Java programs.

【KEY WORDS】 Halstead, complexity, Java, software evolution

目 录

摘要...................................................................................................................................Ⅰ

Abstract..............................................................................................................................Ⅱ

  1. 绪论.....................................................................................................................3

1.1 引言......................................................................................................................3

1.2 软件复杂度研究现状..........................................................................................3

1.3 Halstead复杂度.................................................................................................7

1.3.1 Halstead度量法介绍.................................................................................7

1.3.2 针对Java程序的Halstead复杂度操作符和操作数的分类规则..........9

1.4 本文研究的目的和意义....................................................................................10

1.5 本文研究的主要内容........................................................................................10

  1. 工具设计关键技术介绍...................................................................................10

2.1 使用eclipse AST统计程序中的操作数和操作符...........................................10

2.1.1 eclipse定义的AST的结构.....................................................................10

2.1.2 AST的获取与访问..................................................................................12

2.2 仿win8界面设计...............................................................................................14

2.2.1 CustomImgPanel类..................................................................................14

2.2.2 MainButton类..........................................................................................15

2.2.3 MyPasswordField类.................................................................................17

2.2.4 MyTextField类.........................................................................................18

2.3 Java程序图表的生成..........................................................................................18

  1. Halstead复杂度度量工具的设计与实现.........................................................22

3.1 工具设计............................................................................................................22

3.1.1 工具整体结构.........................................................................................22

3.1.2 工具模块设计.........................................................................................22

3.2 工具实现............................................................................................................23

3.2.1 界面可视化模块.....................................................................................23

3.2.1.1 项目导入模块..............................................................................24

3.2.1.2 图表展示模块..............................................................................25

3.2.2 数据处理模块.........................................................................................27

3.2.2.1 代码解析模块..............................................................................27

3.2.2.2 数据收集模块..............................................................................28

3.2.3 数据库部分.............................................................................................30

  1. Halstead复杂度度量工具的运行与结果分析.................................................31

4.1 工具运行展示....................................................................................................31

4.1.1 单版本分析运行过程展示.....................................................................31

4.1.2 双版本分析运行过程展示.....................................................................35

4.2 结果分析............................................................................................................39

结论...................................................................................................................................39

致谢...................................................................................................................................41

参考文献...........................................................................................................................42

附录...................................................................................................................................43

  1. 绪 论

1.1 引言

剩余内容已隐藏,请支付后下载全文,论文总字数:44420字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;