基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文

上传人:wo7****35 文档编号:61386736 上传时间:2018-11-30 格式:DOC 页数:76 大小:2.62MB
返回 下载 相关 举报
基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文_第1页
第1页 / 共76页
基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文_第2页
第2页 / 共76页
基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文_第3页
第3页 / 共76页
基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文_第4页
第4页 / 共76页
基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文_第5页
第5页 / 共76页
点击查看更多>>
资源描述

《基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文》由会员分享,可在线阅读,更多相关《基于子图发现的设计模式识别系统——CodeMiner插件和源码解析模块的设计与实现---毕业论文(76页珍藏版)》请在金锄头文库上搜索。

1、本本 科科 毕毕 业业 论论 文文 基于子图发现的设计模式识别基于子图发现的设计模式识别系统系统 CodeMiner 插件和源码解析模块的设计与实现插件和源码解析模块的设计与实现 Design Pattern Detecting System by Subgraph Discovery The Design and Implementation of CodeMiner Plug-in and Code Analysis Module 姓 名: 学 号: 学 院:软件学院 系:软件工程 专 业:软件工程 年 级: 指导教师: 年年 月月 摘摘 要要 现代软件工业已经广泛地应用设计模式来重用成功

2、的设计实践和提高软件系统 的质量,然而受制于软件系统的规模和设计文档的缺失,开发人员无法直观地理解 现有软件系统中应用的设计模式,从源码中发现设计模式实例对于提高软件可理解 性和可维护性、软件设计重用以及软件重构具有重要意义。 为了便于在实际应用中理解、选择和实践设计模式,设计模式的特征通常以非 形式化的方式描述,在进行设计模式识别时需要对其进行形式化的表示,已有的研 究中采用不同的中间表示来描述设计模式和系统源码以及提出不同的算法来进行设 计模式识别。本文在比较目前已有的设计模式发现方法的基础上,进一步提出了一 种新的设计模式识别方法。 本文提出了一种基于子图发现和有限自动机的设计模式识别方

3、法,将抽象语义 图作为系统源码和设计模式签名的中间表示,将在系统源码中发现设计模式实例的 问题转化成在非连通图中发现同构子图的问题。设计模式签名描述了设计模式的结 构和行为特征,并转换成确定性有限自动机,有限自动机的终态代表着特定的设计 模式。子图发现算法采用有限自动机来引导设计模式候选实例的产生,从而缩小搜 索空间,提高了算法效率。 另外,本文实现了 Eclipse 插件 CodeMiner 来支持所提出的设计模式识别方法, 采用 Eclipse JDT(Java Development Toolkit)对目标系统的源码进行解析,从源码中提 取的信息构建抽象语义图,通过在 CodeMiner

4、 上对 3 个开源项目进行实验,并将实 验结果与现有的相关研究的实验结果进行比较,在可识别的设计模式种类和识别的 模式实例准确性上有明显的优势,表明本文提出的基于子图发现的设计模式识别方 法具有较高的应用价值。 关键词:关键词:设计模式;抽象语法树;Eclipse 插件 Abstract Modern software industry has widely adopted design patterns to reuse the best practices and improve the quality of software systems. However, many systems

5、are legacy and the design documents is often missing, this retard the comprehension of systems design and architecture during maintenance actives. Detecting design patterns from existing source code can improve systems internal quality attributes such as reusability and maintainability. Design patte

6、rns are normally described informally to understand and used them easily in practice; researchers need to characterize design patterns formally during design pattern detection. Related work uses several intermediate representations of software systems and design patterns, and introduces or proposes

7、some algorithms to detect design pattern instances. This paper analyzed related approaches for mining design patterns from source code in a comparative study and proposed a novel approach for design pattern detection. The paper presented an algorithm based on subgraph discovery and finite automata t

8、o recognize instances of design patterns in a software system. In the approach, the system and design patterns are both described with ASG (Abstract Syntax Graph), therefore finding a design pattern is to match ASG sub-structures with pattern signatures. Design pattern signatures describe the struct

9、ural and behavior characteristics of design patterns and are transformed into DFA (Deterministic Finite Automata), the DFA is used to guide candidate generation, which narrows the search space and improves the computational efficiency. And this paper also developed an Eclipse plug-in CodeMiner to ev

10、aluate the algorithm. Experimental evaluation on three open-source projects demonstrates the accuracy and efficiency of the proposed approach. Key words: design pattern; abstract syntax tree; Eclipse Plug-in. 目录目录 第一章第一章绪论绪论1 1.1 研究背景及选题意义研究背景及选题意义1 1.2 . 研究现状及存在问题研究现状及存在问题 2 1.3 . 主要研究内容及特色主要研究内容及特

11、色 4 1.4 本文结构安排本文结构安排 5 第二章第二章CodeMiner 的需求分析和总体架构的需求分析和总体架构6 2.1. 现有设计模式识别方法的比较现有设计模式识别方法的比较 6 2.1.1 设计模式特征的选择 6 2.1.2 中间表示形式的选择 8 2.1.3 匹配方式的选择 .8 2.2. CodeMiner 的需求分析的需求分析 9 2.2.1 功能需求分析.9 2.2.2 非功能性需求分析11 2.3. CodeMiner 的总体架构的总体架构 12 2.4. 系统相关技术概述系统相关技术概述 14 2.4.1 Eclipse 插件体系结构.14 2.4.2 借助 Eclip

12、se JDT 进行源码解析的原理17 2.5. 小结小结 20 第三章第三章CodeMiner 的设计的设计.21 3.1CodeMiner 插件插件 21 3.2源码解析源码解析 26 3.3.设计模式签名设计模式签名 30 3.3.1 结构型设计模式 .31 3.3.2 创建型设计模式 .33 3.3.3 行为型设计模式 .35 3.4.设计模式识别设计模式识别 39 3.4.1 基于子图发现的设计模式识别原理.39 3.4.2 设计模式识别的设计 42 3.5.小结小结 44 第四章第四章CodeMiner 的实现的实现.45 4.1.CodeMiner 插件工程的结构插件工程的结构 4

13、5 4.2CodeMiner 插件项目的整体实现插件项目的整体实现 46 4.3CodeMiner 插件相关扩展点的实现插件相关扩展点的实现 48 4.3.1 CodeMiner 插件操作扩展点的实现49 4.3.2 CodeMiner 插件视图扩展点的实现51 4.3.3 CodeMiner 插件透视图扩展点的实现.53 4.4.小结小结 55 第五章第五章实验结果实验结果.56 5.1.实验数据介绍实验数据介绍 56 5.1.1 JUnit 56 5.1.2 JHotDraw.56 5.1.3 JRefactory .56 5.2.实验结果分析实验结果分析 57 5.2.1 识别的设计模式

14、实例分析.57 5.2.2 设计模式变种的分析 61 5.3.小结小结 63 第六章第六章总结和展望总结和展望 .64 参考文献参考文献 66 致谢致谢68 TABLE OF CONTENTS Chapter 1: Introduction1 1.1 Background and Significance .1 1.2 Research Status and Problems 2 1.3. Main Research and Contributions of The Paper 4 1.4 Outline of Thesis 5 Chapter 2: Requirement Analysis

15、and Architecture of CodeMiner6 2.1 . Comparative Study on Design Pattern Mining Techniques 6 2.1.1 Pattern Aspects Checked.6 2.1.2 Intermediate Representations.8 2.1.3 Exact vs. Approximate Matches 8 2.2 Requirement Analysis of CodeMiner 9 2.2.1 Functional Requirements 9 2.2.2 Non-Functional Require

16、ments.11 2.3. The Overall Architecture of CodeMiner 12 2.4 . System Related Technologies Outline 14 2.4.1 Eclipse Plug-in Architecture14 2.4.2 The Theory of Code Analysis Using Eclipse JDT17 2.5 Summary 20 Chapter 3: Design of CodeMiner.21 3.1CodeMiner Plug-in 21 3.2Source Code Analysis 26 3.3.Design Pattern Signature 30 3.3.1 Structural Design Patterns.31 3.3.2 Creational Design Patterns33 3.3.3 Behavioral Design Patterns .35 3.4.Design Pattern Detection 39 3.4.1 The Theory

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 学术论文 > 毕业论文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号