跳到主要內容

簡易檢索 / 詳目顯示

研究生: 陳昱仁
Yu-Jen Chen
論文名稱: 重複性程式碼檢測之外掛模組設計
指導教授: 鄭永斌
Yung-Pin Cheng
口試委員:
學位類別: 碩士
Master
系所名稱: 資訊電機學院 - 資訊工程學系在職專班
Executive Master of Computer Science & Information Engineering
論文出版年: 2016
畢業學年度: 104
語文別: 中文
論文頁數: 42
中文關鍵詞: 重複性程式碼重複性程式碼檢測
外文關鍵詞: Duplicate Code, Clone Code, Clone Detection
相關次數: 點閱:15下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 重複性程式碼(Duplicate Code/Clone Code)係指在原始碼中某一段與其他相異片段具有相同結構或功能的程式碼,有時亦被稱作複製程式碼(Code Clone)或是克隆(Clone);重複性程式碼時常出現在應用程式開發至一定程度或某個階段時。根據Deissenboeck等人的研究中發現,在一個軟體系統中可能包含10~50%以上的重複性程式碼,由此可知在程式設計的領域中普遍地存在重複性程式碼的問題。然而,在一個設計結構不良的軟體系統當中,最為人所詬病的部份就是重複性程式碼,若原始碼中含有過多的重複性程式碼勢必將造成整個系統架構的呈現相當凌亂且難以維護修改;因此,要如何消除重複性程式碼成為改良程式設計的一個重要課題。
    軟體工程發展迄今,消除重複性程式碼的重要性已日益顯著,目前已有許多研究提出檢測重複性程式碼的方法並發展成許多良好的工具,如CCFinder、CloneDR或CodeRush外掛模組(Plug-In)中的Duplicate Code…等;此外,微軟也在開發工具Visual Studio 2010開始內建尋找重複性程式碼的功能。
    儘管消除重複性程式碼與過去相較已漸受程式開發人員所重視,但檢測工具的發展時至今日對程式開發人員而言,仍無較完善好用的工具;因此,本研究將提出一個方法並實作一個整合開發環境的外掛套件來協助程式開發人員們可以快速找到他們所關注的程式是否有包含重複性程式碼及其所在位置與相關資訊,藉此以減少程式開發人員在大量程式碼中找尋重複性程式碼的所需投入的時間成本。


    Duplicate code (Clone code; Clone) is a fragmental code that occurs more than once in the source code. Existing research suggests that a considerable fraction (10-50%) of the source code of large-scale software system is duplicate code. Inappropriate code duplication may increase maintenance costs. Therefore clone detection is one of the fundamental issues in software engineering. It can be widely applied in many areas, such as software quality, refactoring, patent, plagiarism, and so on.
    In order to improve the maintainability of software and reduce code clones, many code clone detection tools have been proposed. These tools are implemented into different platform, and also have some issues under user interface. Thus, in this paper we propose a new detection tool that implement as a plug-in lay on the Eclipse platform to improve user interface. Besides, user can use this tool to detect code clones more convenient and easier. In addition, this tool can help programmers to trace clone code directly and modify the clone code so that it can increase the efficiency of software.

    摘要 i Abstract ii 第一章、緒論 1 1-1 研究動機 1 1-2 問題描述 2 第二章、研究背景與相關研究 4 2-1 重複性程式碼 5 2-2 檢測方法 9 2-3 檢測流程 13 第三章、CloneFinder – 重複性程式碼檢測工具 16 3-1 問題分析 16 3-2 設計理念 21 3-3 系統架構 22 第四章、實驗分析 25 第五章、結論與未來展望 29 5-1 結論 29 5-2 未來展望 29 參考文獻 31

    [1] F. Deissenboeck, B. Hummel, E. Juergens, “Code Clone Detection in Practice”, ICSE ’10, Cape Town, South Africa, May 2010.
    [2] Martin Fowler, Kent Beck, John Brant, William Opdyke, don Roberts 著,重構─改善既有程式的設計, 2/e (Refactoring: Improving The Design of Existing Code),侯捷、熊節譯,碁峰,台北,民國九十七年。
    [3] J. Johnson, Identifying Redundancy in Source Code Using Fingerprints, in: Proceedings of the 1993 Conference of the Centre for Advanced Studies on Collaborative Research, CASCON 1993, pp. 171–183 (1993).
    [4] J. Johnson, Visualizing Textual Redundancy in Legacy Source, in: Proceedings of the 1994 Conference of the Centre for Advanced Studies on Collaborative research, CASCON 2004, pp. 171-183 (1994).
    [5] S. Ducasse, M. Rieger and S. Demeyer, A Language Independent Approach for Detecting Duplicated Code, in:Proceedings of the 15th International Conference on Software Maintenance, ICSM 1999, pp. 109-118 (1999).
    [6] M. Rieger. Effective Clone DetectionWithout Language Barriers, Ph.D. Thesis, University of Bern, Switzerland, 2005.
    [7] C.K. Roy and J.R. Cordy, NICAD: Accurate Detection of Near-Miss Intentional Clones Using Flexible Pretty-Printing and Code Normalization, in: Proceedings of the 16th IEEE International Conference on Program Comprehension,ICPC 2008, pp. 172-181 (2008).
    [8] C.K. Roy and J.R. Cordy, An Empirical Study of Function Clones in Open Source Software Systems, in: Proceedings of the 15th Working Conference on Reverse Engineering, WCRE 2008, pp. 81-90 (2008).
    [9] B. Baker, A Program for Identifying Duplicated Code, in: Proceedings of Computing Science and Statistics:24th Symposium on the Interface, Vol. 24:4957, 24:49-57 (1992).
    [10] B. Baker, On Finding Duplication and Near-Duplication in Large Software Systems, in: Proceedings of the 2nd Working Conference on Reverse Engineering, WCRE 1995, pp. 86-95 (1995).
    [11] I. Baxter, A. Yahin, L. Moura and M. Anna, Clone Detection Using Abstract Syntax Trees, in: Proceedings of the 14th International Conference on Software Maintenance, ICSM 1998, pp. 368-377 (1998).
    [12] Project Bauhaus. URL http://www.bauhaus-stuttgart.de Last accessed November 2008.
    [13] W. Yang, Identifying Syntactic Differences Between Two Programs, SoftwarePractice and Experience,
    21(7):739-755 (1991).
    [14] R. Koschke, R. Falke and P. Frenzel, Clone Detection Using Abstract Syntax Suffix Trees, in: Proceedings of the 13th Working Conference on Reverse Engineering, WCRE 2006, pp. 253-262 (2006).
    [15] R. Falke, R. Koschke and P. Frenzel, Empirical Evaluation of Clone Detection Using Syntax Suffix Trees,
    Empirical Software Engineering, Vol. 13: 601-643 (2008).
    [16] R. Tairas and J. Gray, Phoenix-Based Clone Detection Using Suffix Trees, in: Proceedings of the 44th Annual Southeast Regional Conference, ACM-SE 2006, pp. 679-684 (2006).
    [17] J. Mayrand, C. Leblanc and E. Merlo. Experiment on the Automatic Detection of Function Clones in a Software System Using Metrics, in: Proceedings of the 12th International Conference on Software Maintenance, ICSM 1996, pp. 244-253 (1996).
    [18] K. Kontogiannis, R. DeMori, E. Merlo, M. Galler, and M. Bernstein, Pattern Matching for Clone and Concept Detection, Journal of Automated Software Engineering, 3(1-2):77-108 (1996).
    [19] R. Komondoor and S. Horwitz, Using Slicing to Identify Duplication in Source Code, in: Proceedings of the 8th International Symposium on Static Analysis, SAS 2001, pp. 40-56 (2001).
    [20] M. Gabel, L. Jiang and Z. Su, Scalable Detection of Semantic Clones, in: Proceedings of the 30th International Conference on Software Engineering, ICSE 2008, pp. 321-330 (2008).
    [21] A. Leit˜ao, Detection of Redundant Code Using R2D2, Software Quality Journal, 12(4):361-382 (2004).

    QR CODE
    :::