Keywords:design patterns, reverse engineering, refactoring, object-oriented, tool
The concept of design patterns emerges in software engineering field in the last few years. Patterns convey complete and well-thought analysis or design experiences in a rigorous form, therefore, software practitioners communicate abstract concepts effectively by using patterns. It is not an easy task, however, to introduce patterns into existing object-oriented systems. First of all, learning and understanding patterns is not an easy task and usually takes much time and practice. Secondly, there are increasingly more patterns developed by software practitioners and researchers.
Thirdly, it is a non-trivial task to modify an existing system in order to introduce design patterns into it. To solve these problems, we propose to develop a tool to help software developers or maintainers by identifying semi-patterns in the existing code using reverse engineering techniques and modifying the code through refactorings so that certain semi-patterns are transformed to design patterns automatically. Semi-patterns are very similar to a pattern, but represent an inferior design. Our supporting tool will reduce time and cost of learning and introducing design patterns into existing code for software engineers.
本研究將開發一個自動化輔助工具,協助軟體工程師分析現有的物件導向系統,藉由程式碼中物件間的關係,找出適合轉換為設計樣式的物件組合,提出加入設計樣式的建議,並且協助其進行原有程式碼之再生工程(或謂再因素化refactoring),進而減少軟體工程師學習設計樣式與重新撰寫程式碼所花費的時間或可能引進之錯誤,又可獲得使用設計樣式所帶來的好處,使原先的系統更具擴展性及可再用性。
本研究的研究步驟共分為三個階段:第一階段是研究如何由程式碼中將準樣式(semi-patterns)反向工程,亦即定義準樣式的反向工程所依據之特徵,第二階段是研究如何將含準樣式之程式碼轉換為符合設計樣式之程式碼,亦即定義轉換之再因素化(refactor)步驟,第三階段是系統實作與驗證。我們將以結構性設計樣式與Java程式碼為研究範圍。我們之所以選擇結構性設計樣式,主要是因為這類設計樣式較適宜於進行靜態分析為主之反向工程。另外兩類的設計樣式除了靜態分析外,必須進行相當之動態分析,應是下一階段之研究目標。