跳到主要內容

簡易檢索 / 詳目顯示

研究生: 陳震洋
Zeng-Yang Chen
論文名稱: 利用資料挖掘技術輔助軟體重構之研究
Using Data Mining Technique to Improve Software Refactoring
指導教授: 陳彥良
Y.L. Chen
張瑞益
Ray-I Chang
口試委員:
學位類別: 碩士
Master
系所名稱: 管理學院 - 資訊管理學系
Department of Information Management
畢業學年度: 92
語文別: 中文
論文頁數: 71
中文關鍵詞: 軟體工程資料挖掘關聯規則軟體重構
外文關鍵詞: association rules, software engineering, software refactoring, data mining
相關次數: 點閱:22下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 軟體的開發,首先得有一個良好的設計,然後才能開始撰碼。但是,隨著時間流逝,人們會不斷的修改程式碼,使得原本依據設計所得的系統其整體結構逐漸衰弱。程式碼品質於是慢慢沈淪,撰寫程式碼的工作從嚴謹的工程慢慢變成了恣意而行的胡亂行為。為了改進逐漸變的雜亂無章的程式碼,重構因此而誕生了。重構是一種過程,「在不改變程式碼外在行為的前提下,對(物件導向)程式系統做出修改,以改進程式的內部結構」,哪怕你手上有一個糟糕的設計,甚至是一堆混亂的程式碼,你也可以藉由重構將它加工成設計良好的產物。重構藉由嗅出(找出)程式碼中的壞味道[2],進而對這些壞味道出現的地方進行調整以改進程式的內部結構。但是一個軟體可能由數以萬行的程式碼所組成,由人工的方式來嗅出這些壞味道將會耗費相當大的人力以及成本。藉由統計及人工智慧的科學技術,資料挖掘(Data Mining)將資料做深入分析,能在龐大的資料庫中尋找出有價值的隱藏事件,其在各個領域方面有越來越多的應用,且成果顯著。因此本研究利用資料挖掘技術中的關連規則,嗅出挖掘出隱藏於程式碼中的壞味道,分別是Divergent change、shotgun surgery、middle man、feature envy、message chain、lazy class,以及speculative generality等七種,來幫助重構者進行軟體重構。


    目錄 第一章 緒論 1 一、研究動機 1 二、研究目的 2 三、研究步驟 2 第二章 文獻探討 3 一、重構 3 1. 何謂重構 3 2. 何處需要重構? 3 3. 程式碼中的壞味道 4 壞味道一:Duplicated Code: 5 壞味道二:Long Method(過長的函式): 5 壞味道三:Large class(過大類別) 6 壞味道四:Long parameter list(過長參數列) 6 壞味道五:Divergent change(發散式變化) 7 壞味道六:shotgun surgery 8 壞味道七:Feature envy 9 壞味道八:Data clump(資料泥團) 9 壞味道九:Primitive obsession 10 壞味道十:Switch statement 11 壞味道十一:parallel Inheritance hierarchy 12 壞味道十二:lazy class 12 壞味道十三:Speculative generality 12 壞味道十四:Temporary field(令人迷惑的暫時欄位) 13 壞味道十五:Message chain(過渡耦合的訊息鏈) 13 壞味道十六:Middle man(中間轉手人) 14 壞味道十七:Inappropriate Intimacy(狎暱關係) 14 壞味道十八:Alternative classes with different interfaces 15 壞味道十九:Incomplete library class 15 壞味道二十:Data class 16 壞味道二十一:refused bequest 16 壞味道二十二:comments(註解) 16 二、資料挖掘 17 1.資料挖掘的意義 17 2.資料挖掘的模型與方法 19 第三章 針對重構之關聯式規則樣式建立 31 一、問題說明 31 二、交易(Transaction)的建立: 33 三、所能發掘之程式碼壞味道 35 第四章 實驗測試 37 一、資料前處理 37 二、利用關聯規則進行壞味道之偵測 43 實驗測試一:以範例程式為測試碼 43 實驗測試二-以實驗系統的原始碼為測試碼 51 三、實驗結果討論 54 四、與相關研究之比較 56 第五章 結論與貢獻 59 結論 59 研究貢獻 59 未來研究方向 60 參考文獻 61

    1. W.F. Opdyke, “Refactoring: A Program Restructuring Aid in Designing Object-Oriented Application Frameworks,” PhD thesis, Univ. of Illinois at Urbana-Champaign, 1992.
    2. M. Fowler, Refactoring: Improving the Design of Existing Programs. Addison-Wesley, 1999.
    3. D.M. Coleman, D. Ash, B. Lowther, and P.W. Oman, “Using Metrics to Evaluate Software System Maintainability,” Computer, vol. 27, no. 8, pp. 44-49, Aug. 1994.
    4. T. Guimaraes, “Managing Application Program Maintenance Expenditure,” Comm. ACM, vol. 26, no. 10, pp. 739-746, 1983.
    5. B.P. Lientz and E.B. Swanson, Software Maintenance Management: A Study of the Maintenance of Computer Application Software in 487 Data Processing Organizations. Addison-Wesley, 1980.
    6. E.J. Chikofsky and J.H. Cross, “Reverse Engineering and Design Recovery: A Taxonomy,” IEEE Software, vol. 7, no. 1, pp. 13-17, 1990.
    7. W.F. Opdyke, “Refactoring: A Program Restructuring Aid in Designing Object-Oriented Application Frameworks,” PhD thesis, Univ. of Illinois at Urbana-Champaign, 1992.
    8. Y. Kataoka, M.D. Ernst, W.G. Griswold, and D. Notkin, “Automated Support for Program Refactoring Using Invariants,” Proc. Int’l Conf. Software Maintenance, pp. 736-743, 2001.
    9. M. Balazinska, E. Merlo, M. Dagenais, and B. Lagu¨ e, and K. Kontogiannis, “Advanced Clone-Analysis to Support Object-Oriented System Refactoring,” Proc. Working Conf. Reverse Eng., pp. 98-107, 2000
    10. S. Ducasse, M. Rieger, and S. Demeyer, “A Language Independent Approach for Detecting Duplicated Code,” Proc. Int’l Conf. Software Maintenance, pp. 109-118, 1999.
    11. T. Tourwe´ and T. Mens, “Identifying Refactoring Opportunities Using Logic Meta Programming,” Proc. European Conf. Software Maintenance and Reeng., pp. 91-100, 2003.
    12. E. van Emden and L. Moonen, “Java Quality Assurance by Detecting Code Smells,” Proc. Working Conf. Reverse Eng., pp. 97- 108, 2002.
    13. F. Simon, F. Steinbru¨ ckner, and C. Lewerentz, “Metrics Based Refactoring,” Proc. European Conf. Software Maintenance and Reeng., pp. 30-38, 2001.
    14. Ho, T., “Discovering and Using Knowledge from Unsupervised Data”, Decision Support Systems,21,1997,29-42
    15. Fayyad,U.,Piatetsky-Shapiro,G. and Smyth P., “from Data Mining to Knowledge Discovery in Databases”,AI Magazine,37-54,1996
    16. Agrawal, R., Imielinski, T. and Swami, A., “Mining Association Rules BetweenSets of Items in Large Database”, Proc. of the 1993 ACM SIGMOD,Washington, 207-216, 1993.
    17. Ian, H. W. and Eibe, F., Data Mining –Practical Machine Learning Tool andTechniques with Java Implementations, Morgan Kaufmann, 2000.
    18. Jiawei Han, Jian Pei, Yiwen Yin, Runying Mao, “Mining Frequent Patterns without Candidate Generation: A Frequent-Pattern Tree Approach”, Data Mining and Knowledge Discovery, 8, 53-87, 2004.
    19. http://www.netbeans.org/
    20. http://www.stack.nl/~dimitri/doxygen/index.html
    21. J.U. Pipka, “Refactoring in a ‘Test First’-World,” Proc. Third Int’l Conf. eXtreme Programming and Flexible Processes in Software Eng.,2002.
    22. Amir Michail, “Data mining library reuse patterns using generalized association rules”, Software Engineering, 2000. Proceedings of the 2000 International Conference on , 4-11 June 2000 Pages:167 - 176
    23. Amir Michail, “Codeweb: data mining library reuse patterns”, Software Engineering, 2001. ICSE 2001. Proceedings of the 23rd International Conference on , 12-19 May 2001 Pages:827 – 828
    24. Amir Michail, “Data mining library reuse patterns in user-selected applications”, Automated Software Engineering, 1999. 14th IEEE International Conference on. , 12-15 Oct. 1999 Pages:24 – 33
    25. Amir Michail and David Notkin, “Illustrating object-oriented library reuse by example: a tool-based approach”, Automated Software Engineering, 1998. Proceedings. 13th IEEE International Conference on , 13-16 Oct. 1998 Pages:200 - 203
    26. Agrawal, R., Imielinski, T. and Swami, A.,”Mining Association Rules Between Sets of Items in Large Database”, Proc. of the 1993 ACM SIGMOD, Washington, 207-216, 1993
    27. Tjortjis, C.; Sinos, L.; Layzell, P.; “Facilitating program comprehension by mining association rules from source code” Program Comprehension, 2003. 11th IEEE International Workshop on , 10-11 May 2003 Pages:125 – 132
    28. Montes de Oca, C.; Carver, D.L. “Identification of data cohesive subsystems using data mining techniques” Software Maintenance, 1998. Proceedings. International Conference on , 16-20 Nov. 1998 Pages:16 - 23
    29. 陳玉豐,「資料挖掘在實證醫學上之研究-以闌尾切除、疝氣、糖尿病、胃出血為例」,碩士論文,中國醫藥學院醫務管理研究所,2003
    30. 李昇暾,「顧客關係管理-以資料採礦深化顧客關係管理」,ARC 遠擎管理顧問公司,2001
    31. Michael J. A. Berry,Gordon S. Linoff,”Data Mining 資料採礦理論與實務”,吳旭志.賴淑貞譯,2001
    32. 梁水金,「建立一個Web-based 資料挖掘系統提供藥物交互作用資訊查詢」,碩士論文,私立逢甲大學資訊工程研究所,2002

    QR CODE
    :::