(3.80.6.131) 您好!臺灣時間:2021/05/15 01:13
字體大小: 字級放大   字級縮小   預設字形  
回查詢結果

詳目顯示:::

我願授權國圖
: 
twitterline
研究生:蔡方培
研究生(外文):Fang-Pei Tsai
論文名稱:具可延伸性的軟體重構工具
論文名稱(外文):An Extensible Software Refactoring Tool
指導教授:陳俊良陳俊良引用關係
指導教授(外文):Chuen-Liang Chen
學位類別:碩士
校院名稱:國立臺灣大學
系所名稱:資訊工程學研究所
學門:工程學門
學類:電資工程學類
論文種類:學術論文
論文出版年:2004
畢業學年度:92
語文別:中文
論文頁數:85
中文關鍵詞:軟體維護編譯器自動化重構
外文關鍵詞:GCCcompilerautomated refactoringsoftware maintenance
相關次數:
  • 被引用被引用:0
  • 點閱點閱:146
  • 評分評分:
  • 下載下載:0
  • 收藏至我的研究室書目清單書目收藏:0
重構(refactoring)一詞,指的是在不改變軟體行為的前提下,改善軟體內部的設計。傳統的軟體設計著重於正式寫碼前的設計工作,但隨著軟體工程經驗的累積,人們感受到寫碼前的設計總是無法預測未來的需求,而隨著軟體的改版和弁鉦K加,程式的結構漸趨複雜而難以掌握。
重構觀念使人們在程式碼寫好以後,回過頭檢討當初的設計,並且著手改進。這種程式碼的修改,著重的是程式碼的結構設計,而非弁鄔坁熔K加。重構工具的成熟,使人們更樂於捲起袖子動手重構,因為重構工具已經成它a為程式員免去瑣碎的細節。
本論文回顧了重構技術的發展,在檢討過現有的重構工具之後,我們認為現有的半自動化(semi-automated)重構工具仍有進步的空間。現存重構工具仍然只能如同編輯器一般,在接受使用者編輯指令時,執行單一而特定的重構動作。在本論文中,我們提出了全自動化重構工具的概念,讓工具為程式員自動找出整個軟體中有待重構的程式片段,而且在程式員授意後,高效地自動完成重構動作。為了讓自動化的重構更為可行,我們把可延伸性(extensibility)視為首要之務,一方面讓重構工具結合專家經驗,一方面也設計了一套富有彈性的重構工具產生流程。最後實作的部分,則以我們在 GCC(GNU Compiler Collection)上的經驗為基礎,設計並實現了若干個重構案例的自動轉換。
自動化重構的技術仍有很大的進步空間,相信本論文提出的架構能夠和未來的軟體正規化理論順利結合在一起,加速具實用價值的自動化重構工具之問世。
Refactorings are a set of behavior-preserving transformations that can be applied to a program after it is coded. Traditional software design technology focused on the design before coding the software. However, with the growing of our experience of software engineering, we have realized that the requirements of software in the future cannot be predicted during the phase of pre-coding design. In addition, as the software upgrades, more functionalities are added, and the structure of the software becomes more and more complicated and, evantually, out of our control.
People modify the codes and change the design via the concept of refactorings. The modification is structural, not functional. With the help of refactoring tools, some technical details during the refactoring phase can be accomplished by the computer, hence people will be glad to refactor their codes more often.
In this thesis, the technical issues of refactoring tools are reviewed. We think that the existing semi-automated refactoring tools can be improved. The existing refactoring tools work just like an editor: given one command, one specific refactoring actioin is performed. We propose the concept of a full-automated refactoring tool in this thesis. According to this idea, the tool searches the code fragments that needed to be refactored in a fully automatic fashion, and after the examination by the programmer, the tool finishes refactoring with high efficiency. To make it more feasible, we let extensibility have the highest priority over other issues. On the one hand, the tool is combined with experience from experts; on the other hand, a flexible generation process of a refactoring tool is designed. Finally, an implemention of our architecture is presented according to our working experience on GCC(GNU Compiler Collection), where the automated transformation of several refactoring cases are designed and realized.
There is still long way to go for the technology of automated refactoring. We believe that the architecture proposed by this thesis could be combined with the theories of software formalization in the future to speed up the development of more practical refactoring tools.
第1章 序論 1
1.1. 什麼是重構 1
1.2. 重構觀念的興起 2
1.3. 重構技術的催生 3
1.3.1. 物件導向分析與設計 3
1.3.2. 模式:分析模式/設計模式 4
1.3.3. 程式碼維護 5
1.4. 重構技術的現況 5
1.4.1. 重構工具 5
1.4.2. 支援的語言 7
1.5. 所需的新技術與補強方向 7
1.6. 本研究之目標 8
1.7. 本論文之結構 9
第2章 背景知識與相關研究 11
2.1. Java 程式語言 11
2.1.1. Java 與重構 12
2.2. 程式語言的編譯 12
2.2.1. 選擇 GCC 為實作平台 14
2.3. 編譯器產生器 14
2.4. 重構工具研究 15
2.4.1. 前置條件的相關主題 15
2.4.2. 重構操作的串聯 17
2.4.3. 互動介面的成果 17
2.5. 重構理論研究 18
2.5.1. 良好的程式風格 18
2.5.2. 正規化的模式表述 19
第3章 系統分析 21
3.1. 下一代的編譯器 21
3.2. 最佳化與重構 22
3.3. tree 結構與RTL 24
3.4. 程式碼演進的討論 25
3.5. 三種方式的重構 26
3.5.1. 程式設計經驗 26
3.5.2. 程式碼編輯器 27
3.5.3. 編譯器輔助自動化的重構 28
3.5.4. 討論 29
3.6. 自動化重構的技術原則 29
3.6.1. 以「系統」實現「經驗」 29
3.6.2. 與現有的開發工具緊密結合 30
3.6.3. 區分角色 30
第4章 系統架構 – 重構編譯器 33
4.1. 重構編譯器的概念 33
4.2. 重構引擎的產生流程 35
4.2.1. 和編譯器產生器比較 35
4.2.2. 與 GCC 後端比較 37
4.2.3. 小結 38
4.3. 運作方式 38
4.4. 輸入與輸出語言 40
4.4.1. 設計原則 41
4.4.2. 關鍵要素 41
4.4.3. 討論 42
第5章 案例討論 45
5.1. 簡化條件式 45
5.1.1. 條件式合併 46
5.1.2. 條件式整平 48
5.2. 最佳化的反運算 53
5.3. 討論 55
第6章 實作 57
6.1. GCC 主要流程 57
6.1.1. GCC 前端 59
6.1.2. GCC 後端 59
6.1.3. 討論 60
6.2. tree 資料結構總覽 60
6.3. 程式碼巡訪與列印 62
6.4. GCC 上的重構編譯器 63
6.5. 原始碼搜尋 65
6.5.1. 二回合的轉換 65
6.5.2. 子節點與編號之配對 68
6.5.3. 多重搜尋規則 69
6.6. 特殊技巧 70
6.6.1. 使用 C++ 目的檔 70
6.6.2. tree 存取工具 70
6.6.3. tree 的展編(expansion)程序 72
6.6.4. 傾印 tree 資料結構 74
6.7. tree 的綜合討論 76
第7章 結論 79
7.1. 成果 79
7.2. 未來展望 79
第8章 參考文獻 83
[1]Martin Fowler: “Refactoring, improving the design of existing code.” Addison-Wesley, 1999.
[2]Willam F. Opdyke: “Refactoring object-oriented frameworks.” Ph. D. thesis, University of Illinois at Urbana-champaign, 1992. See ftp://st.cs.uiuc.edu/pub/papers/refactoring/opdyke-thesis.ps.Z
[3]Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides [Gang of Four]: “Design Pattern: Elements of Reusable Object-Oriented Software.” Addison-Wesley, 1995.
[4]Joshua Kerievsky, “Refactoring to patterns,” draft, version 1.13, Industrial Logic, Inc. URL: http://industriallogic.com
[5]Martin Fowler and Kendall Scott, “UML Distilled, second edition: A Brief Guide to the Standard Object Modeling language.” Addison-Wesley, 2000.
[6]Tom Mens, Serge Demeyer, Bart Du Bois, Hans Stenten, Pieter Van Gorp, “Refactoring: Current Research and Future Trends,” ETAPS 2003 Workshop on Language Descriptions, Tools and Applications, 2003
[7]Martin Fowler, “Analysis Patterns: Reusable Object Models,” Addison-Wesley, 1997.
[8]Bjarne Stroustrup, “The C++ Programming Language, Third Edition,” Addison-Wesley, 1997.
[9]Bjarne Stroustrup, “The Design and Evolution of C++”, Addison-Wesley, 1994.
[10]Ken Arnold, James Gosling, David Holmes, “The Java Programming Language, Third edition,” Addison-Wesley, 2000.
[11]The Eclipse homepage, http://www.eclipse.org
[12]Richard M. Stallman, GNU Compiler Collection Internals, Free Software Fundation. URL: http://gcc.gnu.org/onlinedocs/gccint/
[13]The GCC homepage, http://gcc.gnu.org
[14]Frank Simon, Frank Steinbrückner, Claus Lewerentz, “Metrics Based Refactoring.” In Proc. 5th European Conference on Software Maintenance and Reengineering, pages 30--38. IEEE Computer Society Press, 2001.
[15]Yoshio Kataoka, Michael D. Ernst, William G. Griswold, and David Notkin, “Automated support for program refactoring using invariants,” in ICSM 2001, Proceedings of the International Conference on Software Maintenance, (Florence, Italy), November 6-10, 2001, pp. 736-743.
[16]Xref-Tech, XRefactory (2002) http://xref-tech.com/speller/
[17]Roberts, D., J. Brant and R. Johnson, “A refactoring tool for smalltalk,” Theory and Practice of Object Systems 3(4) (1997), pp. 253~263.
[18]Borland, Jbuilder (2002) http://www.borland.comn/jbuilder/
[19]Donald E. Knuth, “Computer Programming as an Art,” Communications of the ACM, December 1974, Volume 17, Number 12.
[20]The Java homepage, http://java.sun.com
[21]Charles N. Fischer and Richard J. LeBlanc, Jr. “Crafting a compiler with C,” The Benjamin/Cummings Publishing Company, Inc.
[22]The GNU Bison homepage, http://www.gnu.org/software/bison/bison.html
[23]Johnson, S.C. 1975. “Yacc—yet another compiler compiler.” C.S. Technical Report #32. Murray Hill, N.J.: Bell Telephone Laboratories.
[24]Santanu Paul and Atul Prakash, “A framework for source code search using program patterns,” IEEE transactions on software engineering, vol. 20, no. 6, June 1994..
[25]Donald Bradley Roberts, “Practical Analysis for Refactoring,” Ph.D thesis, University of Illinois at Urbana-Champaign, 1999.
[26]Bodin, F., Sage++, “an object-oriented toolkit and class library for building, Fortran and C++ restructuring tools,” in: Proc. 2nd Object-Oriented Numerics, Conference, 1994, Sunriver, Oregon.
[27]Griswold, W. G., “Program Restructuring as an Aid to Software Maintenance,” Ph.D. thesis, University of Washington (1991).
[28]Leit~ao, A. M., “A formal pattern language for refactoring of Lisp programs,” in: Proc. 6th European Conf. Software Maintenance and Reengineering (2002), pp. 186-192.
[29]Thompson, S. and C. Reinke, “Refactoring functional programs, Technical report,” Computing Laboratory, University of Kent (2001).
[30]Opdyke, W. F., “Refactoring C++ programs, ” Technical report, Lucent Technologies/ Bell Labs (1999). URL: http://st-www.cs.uiuc.edu/users/opdyke/wfo.990201.c++.refac.html
[31]James Gosling and Henry McGilton, “White paper: The Java Language Environment,” May 1996, URL: http://java.sun.com/docs/white/langenv/
[32]Joshua Bloch, “Effective Java programming language guide,” Sun Microsystems, Inc., Mountain View, CA, 2001
[33]James Gosling, Bill Joy, Guy Steele, Gilad Bracha, “Java Language Specification, Second Edition.” The Java Series, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 2000
[34]Mens, T., “Conditional graph rewriting as a domain-independent formalism for software evolution,” in: Proc. Int''l Conf. Agtive 1999: Applications of Graph Transformations with Industrial Relevance, Lecture Notes in Computer Science 1779 (2000), pp. 127-143.
[35]Mens, T., S. Demeyer and D. Janssens, “Formalising behaviour preserving program transformations,” in: Graph Transformation, Lecture Notes in Computer Science 2505 (2002), pp. 286-301.
QRCODE
 
 
 
 
 
                                                                                                                                                                                                                                                                                                                                                                                                               
第一頁 上一頁 下一頁 最後一頁 top