Research on Detection Technology of Duplicated Code
- Author
- LiJianZhong
- Advisor
- LiuJianBin
- School
- Shantou University
- Major
- Computer Software and Theory
- Classification
- TP311.52 Software Development
- Degree
- Master's thesis
- Year
- 2005
- Downloads
- 165
- Citations
- 5
- Detection of duplicated code
- Program refactoring
- Cyclomatic Complexity
- Procedure Blueprint
- Abstract Logic Structure Diagram (AISD)
Abstract
Software continuously becomes more and more difficult to understand and maintain with time elapsing. Refactoring is a key technique to acquire software quality, which is to restructure and reorganize software without changing its external observable behaviour. However, "Where did Refactoring Come From" is one key issue to refactoring.Duplicated code is the worst "bad smells". Kontogiannis metrics is a technique of detecting the duplicated code. However, false matches will be taken place on account of two reasons, when this technique is used to detect the duplicated code. The first is that the complexity of the control flow between if statement and loops statement cannot be distinguished by the McCabe metrics, which is used by the Kontogiannis metrics. The second is that the Kontogiannis metrics doesn’t make judgement of the types of the returns of the two compared methods. In this paper. Kontogiannis metrics is improved by introducing two new variables so that the accuracy of detecting the duplicated code is raised and the false matches are reduced. And a technique based-on process blueprint is proposed, which measures the software cyclomatic complexity. This technique simplifies the process of the measuring and easy to implement. It is more efficient than the traditional method.Kontogiannis metrics search for duplicates using the knowledge that two clones have similar structural and functional properties, so it can recongnize the similar functions. The parameterized string matching method proposed by Baker can detect duplicated blocks. However, its ability to solve problem is limited for the space complexity. In order to reduce the space complexity of the arithmetic and avoid transforming the source code to p-suffix tree, the method is improved based-on process blueprint.Duplicated code can be detected accurately by integrating two different techniques organically in the same context. Based on process blueprint, we can avoid transforming the source code to not only abstract syntax tree but also p-suffix tree. So that more effective technology is provided for the localization of automatic refactoring.
Table of contents
Summary 6-7
ABSTRACT 7-8
first chapter 8-11
1.1 Introduction
1.2 Research motivation
1.3 the reconstructed position 1.3.1 8-9
1 .3.2 the repeating code detection 9
1.3.3 Process Blueprint
1.4 This work 9-10
1. 5 papers organization 10-11
repeat code Overview 11-14
2.1 duplicate code generated 11
2. nbsp 2 duplicate code in the program; 11-12
2.3 detect duplicate code the 12-13
2.3.1 pure text-based approach 12
2.3.2 parameterized matching method 12
2.3.3 syntax tree-based methods 12-13
2.4 Summary 13-14
Chapter metric-based duplicate code detection technology and its improvement 14-23
3.1 software metrics 14-17
.1.1 metric definition 14-15
3.1.2 measurable goals 15
3.1.3 software metrics theory 15-16
3.1.4 measurement criteria assessment 16-17 Number of
3.2 metric theory of duplicate code detection 17-22
3.2.1 based similar analysis metrics 17-18
3.2.2 Method Code 18-19
3.2.3 the Kontogiannis metric method improved nbsp Research 19
3.2.4 instance; 19-22
3.3 discussion 22
3.4 Summary 22-23 < br /> Chapter based process blueprint duplicate code detection and loop complexity metrics 23-32
the 4.1 process blueprint Overview 23
4.2 based on process blueprint duplicate code detection process the 23-24
4.3 MCCABE measure, methods the 24-26 4.3.1 the structure of the control flow graph
25 < br /> 4.3.2 loop control flow graph complexity calculation 25-26
4.4 based the process blueprint loop complexity metrics 26-28 <br / > 4.5 Example research 28-30
4.6 discussion 30-31
4.7 Summary 31-32
fifth the chapter detection based on the parametric process blueprint repeat code 32-39
5.1 parameterized matching elm measured technology the theory 32
5.2 based on the process of monitoring graph parametric duplicate code detection 32-37
5.2.1 based on abstract diagram of duplicate code detection 33-36
5.2.2 algorithm analysis the 36-37 5.3 Case Study
37-38
5.4 discussion 38
5.5 Summary 38 -39
Chapter duplicate code refactoring detection tool design 39-60 the
defined in 6.1 reconstructed 39
6.2 the Mathematical Preliminaries 39-40
6.3 Analysis function (ANALYSIS FUNCTIONS) 40-43
6.3.1 original analysis functions 40-41 < br /> 6.3.2 derived analysis function 41-42
6.3.3 first-order predicate logic (First Order Predicate Logic) 42-43
6. 4 Repeat code refactoring 43-44
6.4.1 reconstructed in the same class repeated code 43-44
6.4.2 brothers class duplicate code duplicate code in 44
6.4.3 related classes 44
6.5 Reconstruction Method 44-53
6.5.1 Move Field 44-45
6.5.2 the Move Method method the 45-46
6.5.3 Extract Method methods 46-47
6.5.4 Parameterize Method method 47-49
6.5.5 Pull Up Method 49-50
6.5.6 Form Template Method 50-51
6.5.7 Extract Superclass 51-52
6.5.8 Extract Class 52-53
6.6 repeated the code automatic detection tool design 53-54
6.7 tool system structure 54-55
6.8 tools function module 55-59
6.8.1 code analysis interface 6.8.2 duplicate code detector 55
55-58
6.8.3 data Management Center 58-59
6.9 Summary 59-60
Chapter VII Conclusion and Outlook 60-61
Reference 61-63
Acknowledgements 63