簡易檢索 / 詳目顯示

研究生: 吳興亞
Wu, Hsing-Ya
論文名稱: Paster: 一個用來輔助以複製貼上整合應用程式介面範例程式碼的程式撰寫工具
Paster: A Copy-and-Paste Programming Assistant for Adapting API Example Code
指導教授: 焦惠津
Jiau, Hewijin Christine
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 電腦與通信工程研究所
Institute of Computer & Communication Engineering
論文出版年: 2013
畢業學年度: 101
語文別: 英文
論文頁數: 54
中文關鍵詞: 應用程式介面範例程式碼複用機會主義式程式撰寫
外文關鍵詞: API code example, API reuse, opportunistic programming
相關次數: 點閱:68下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 當軟體開發者使用應用程式介面(Application Programming Interface) 撰寫程式的時候,通常會使用範例程式碼當作指南來降低開發成本。在實際的應用上,機會主義式的撰寫程式方式(Opportunistic Programming) 被廣泛應用在重複使用應用程式介面程式範例,但這樣子的撰寫程式方式過於強調簡單且快速地完成程式撰寫,而忽略程式的穩健性和可維護性。機會主義式的撰寫程式方式通常伴隨著複製貼上範例程式碼,並且瑣碎地改編部分貼上的程式碼來整合程式,然而有些該顧慮的改編問題很難被軟體開發者注意到。如果這些該顧慮的改編問題被忽略了,將很容易造成難找到的程式臭蟲,迫使該軟體開發者需要花更多時間瞭解該範例程式碼。在此篇論文中,我做了一個輔助程式撰寫的工具,名為Paster。當軟體開發者在整合範例程式碼到開發中的程式碼裡時,Paster 可以用來幫忙處理那些需要被顧慮但是容易被忽略的改編問題。在此篇論文中做了一個實驗來驗證Paster 是否可以有效幫助軟體開發者進行範例程式碼的整合。實驗結果顯示Paster 透過標示出僅僅15.6%-23.1% 的程式碼,就可以指出所有整合應用程式介面範例程式時需要注意的改編問題,這些被標示出來的改編問題高達61.9%-77.8% 是軟體開發者真正需要改編的地方,並且軟體開發者可以透過Paster 所提供的改編方案來完成改編。這樣的結果說明當軟體開發者以複製貼上整合應用程式介面範例程式時,若採用Paster 作為輔助工具可以有效地降低開發成本。

    When programming with application programming interface (API), developers often use API code example to reduce the implementation effort. In practice, opportunistic programming that emphasizes speed and ease of development over code robustness and maintainability is widely used to reuse API code example. However, developers often adapt the API example code opportunistically by pasting the example code into developing code and modify the pasted code tediously without knowing the concerns of the adaptation. If the concerns are ignored, it is easy to introduce hidden bug and will lead developers to spend more effort on understanding the code example. In this thesis, I propose a tool, Paster, to handle the concerns when the API example code is being integrated into developing code. An experiment is conducted with three adaptations of representative code examples. The results show that Paster can indicate all defined adaptation problems with only highlighting 15.6%-23.1% of the pasted codes. Up to 61.9%-77.8% of the highlighted codes indeed need modifications which are suggested by Paster. These results show that Paster can reduce the effort when developers adapt API example code by copy-and-paste.

    1 Introduction 1 2 Background and Related Work 5 2.1 Investigations of Code Copying and Reuse 5 2.2 API Framework Helper 6 3 An Example Scenario of Example Code Adaptation 8 4 Process of Assisting Adaptation 12 4.1 Problem Definition 12 4.1.1 Resolve-Binding Problems 13 4.1.2 Configuration Problems 14 4.2 Process Overview 14 4.3 Analysis of the Pasted API Example Code Snippet 15 4.3.1 Information in Concerned 16 4.3.2 Critical Java Elements 18 4.4 Analysis of Developing Code 23 4.5 Adaptation Problems and Solutions 26 4.5.1 Finding Adaptation Problem Locations 26 4.5.2 Adapting Proposals 28 4.5.3 Dependency of Adaptation 31 5 Tool Implementation 33 5.1 Copy-and-Paste Listener 34 5.2 Code Analyzer 34 5.3 Annotation and Quick Fix 35 6 Evaluation 38 6.1 Experiment Setup 38 6.1.1 Process of the Experiment 39 6.1.2 Subject Selection Criteria 40 6.1.3 Metrics of the Evaluation 43 6.2 Experiment Results 44 6.3 Threats to Validity 46 7 Conclusion and Future Work 48 References 50 Vita 54

    [1] C. McMillan, M. Grechanik, D. Poshyvanyk, C. Fu, and Q. Xie, “Exemplar: A Source Code Search Engine for Finding Highly Relevant Applications,” IEEE Transactions on Software Engineering, vol. 38, no. 5, pp. 1069–1087, Aug. 2012.
    [2] J. Brandt, P. J. Guo, J. Lewenstein, M. Dontcheva, and S. R. Klemmer, “Two Studies of Opportunistic Programming: Interleaving Web Foraging, Learning, and Writing Code,” In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, pp. 1589–1598, Apr. 2009.
    [3] J. Stylos and B. Myers, “Mica: A Web-Search Tool for Finding API Components and Examples,” In Proceedings of the IEEE Symposium on Visual Languages and Human-Centric Computing, pp. 195–202, Sept. 2006.
    [4] R. Hoffmann, J. Fogarty, and D. S. Weld, “Assieme: Finding and Leveraging Implicit References in a Web Search Interface for Programmers,” In Proceedings of the ACM Symposium on User Interface Software and Technology, pp. 13–22, Oct. 2007.
    [5] M. P. Robillard, “What Makes APIs Hard to Learn? Answers from Developers,” IEEE Software, vol. 26, no. 6, pp. 27–34, Nov. 2009.
    [6] Y.-C. Wu, L. W. Mar, and H. Jiau, “CoDocent: Support API Usage with Code Example and API Documentation,” In Proceedings of the International Conference on Software Engineering Advances, pp. 135–140, May 2010.
    [7] F. Shull, F. Lanubile, and V. R. Basili, “Investigating Reading Techniques for Object-Oriented Framework Learning,” IEEE Transactions on Software Engineering, vol. 26, no. 11, pp. 1101–1118, Nov. 2000.
    [8] R. Holmes, R. Cottrell, R. J. Walker, and J. Denzinger, “The End-to-End Use of Source Code Examples: An Exploratory Study,” In Proceedings of the International Conference on Software Maintenance, pp. 555–558, Sept. 2009.
    [9] L. R. Neal, “A System for Example-Based Programming,” SIGCHI Bull., vol. 20, no. SI, pp. 63–68, Mar. 1989.
    [10] Y. Ye, G. Fischer, and B. Reeves, “Integrating Active Information Delivery and Reuse Repository Systems,” SIGSOFT Softw. Eng. Notes, vol. 25, no. 6, pp. 60–68, Nov. 2000.
    [11] S. Ducasse, M. Rieger, and S. Demeyer, “A Language Independent Approach for Detecting Duplicated Code,” In Proceedings of the IEEE International Conference on Software Maintenance, pp. 109–118, Aug. 1999.
    [12] R. Selby, “Enabling Reuse-Based Software Development of Large-Scale Systems,” IEEE Transactions on Software Engineering, vol. 31, no. 6, pp. 495–510, June 2005.
    [13] S. Morad and T. Kuflik, “Conventional and Open Source Software Reuse at Orbotech - an Industrial Experience,” In Proceedings of the IEEE International Conference on Software - Science, Technology and Engineering, pp. 110–117, 2005.
    [14] S. Jansen, S. Brinkkemper, I. Hunink, and C. Demir, “Pragmatic and Opportunistic Reuse in Innovative Start-up Companies,” IEEE Software, vol. 25, no. 6, pp. 42–49, Nov. 2008.
    [15] Z. Li, S. Lu, S. Myagmar, and Y. Zhou, “CP-Miner: Finding Copy-Paste and Related Bugs in Large-Scale Software Code,” IEEE Transactions on Software Engineering, vol. 32, no. 3, pp. 176–192, Mar. 2006.
    [16] D. Mandelin, L. Xu, R. Bodik, and D. Kimelman, “Jungloid Mining: Helping to Navigate the API Jungle,” In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 48–61, June 2005.
    [17] N. Sahavechaphan and K. Claypool, “XSnippet: Mining for Sample Code,” ACM SIGPLAN Notices, vol. 41, no. 10, pp. 413–430, Oct. 2006.
    [18] R. Holmes, R. Walker, and G. Murphy, “Approximate Structural Context Matching: An Approach to Recommend Relevant Examples,” IEEE Transactions on Software Engineering, vol. 32, no. 12, pp. 952–970, Dec. 2006.
    [19] S. Henninger, “Retrieving Software Objects in an Example-Based Programming Environment,” In Proceedings of the International ACM SIGIR conference on Research and development in information retrieval, pp. 251–260, Oct. 1991.
    [20] K. Inoue, R. Yokomori, H. Fujiwara, T. Yamamoto, M. Matsushita, and S. Kusumoto, “Component Rank: Relative Significance Rank for Software Component Search,” In Proceedings of the International Conference on Software Engineering, pp. 14–24, May 2003.
    [21] A. Michail, “Data Mining Library Reuse Patterns Using Generalized Association Rules,” In Proceedings of the International Conference on Software engineering, pp. 167–176, June 2000.
    [22] R. Holmes and R. J. Walker, “Systematizing Pragmatic Software Reuse,” ACM Transactions on Software Engineering and Methodology, vol. 21, no. 4, pp. 1–44, Feb. 2013.
    [23] R. Holmes, Pragmatic Software Reuse. PhD thesis, University of Calgary, 2008.
    [24] “JDBCTM API.” http://docs.oracle.com/javase/tutorial/jdbc/, 2013.
    [25] “Eclipse.” http://www.eclipse.org/, 2013.
    [26] “Eclipse JDT.” http://www.eclipse.org/jdt/, 2013.
    [27] “Search Code.” http://searchcode.com/, 2013.

    無法下載圖示 校內:2018-07-30公開
    校外:不公開
    電子論文尚未授權公開,紙本請查館藏目錄
    QR CODE