DISSERTATION APPROVAL the Abstract And
Total Page:16
File Type:pdf, Size:1020Kb
DISSERTATION APPROVAL The abstract and dissertation of Emerson Murphy-Hill for the Doctor of Philoso- phy in Computer Science were presented on February 26, 2009, and accepted by the dissertation committee and the doctoral program. COMMITTEE APPROVALS: Andrew P. Black, Chair Stephane´ Ducasse Mark Jones Susan Palmiter Suresh Singh Douglas Hall Representative of the Office of Graduate Studies DOCTORAL PROGRAM APPROVAL: Wu-chi Feng, Director Computer Science Ph.D. Program ABSTRACT An abstract of the dissertation of Emerson Murphy-Hill for the Doctor of Philoso- phy in Computer Science presented February 26, 2009. Title: Programmer Friendly Refactoring Tools Tools that perform semi-automated refactoring are currently under-utilized by programmers. If more programmers adopted refactoring tools, software projects could make enormous productivity gains. However, as more advanced refactor- ing tools are designed, a great chasm widens between how the tools must be used and how programmers want to use them. This dissertation begins to bridge this chasm by exposing usability guidelines to direct the design of the next generation of programmer-friendly refactoring tools, so that refactoring tools fit the way program- mers behave, not vice-versa. PROGRAMMER FRIENDLY REFACTORING TOOLS by EMERSON MURPHY-HILL A dissertation submitted in partial fulfillment of the requirements for the degree of DOCTOR OF PHILOSOPHY in COMPUTER SCIENCE Portland State University 2009 To Tetey Acknowledgements This research could not have been accomplished without the help of countless others. First and foremost, thanks to my advisor, Andrew P. Black, for always providing en- lightening guidance and advice. Thanks to the members of my thesis committee, each of whom contributed to this work: Stephane´ Ducasse, Doug Hall, Mark Jones, Susan Palmiter, and Suresh Singh. Thanks to the National Science Foundation for partially funding this research under grant CCF-0520346. Thanks to Ken Brown at the Port- land State Bookstore for donating gift cards as rewards for experiment participants. Thanks to the Computer Science department’s staff for the continuous support and encouragement: Shiva Gudeti, Beth Holmes, Kathi Lee, Rene Remillard, and Bar- bara Sabath. Thanks to my research colleagues Chris Parnin and Danny Dig for their hard work during parts of this research. Thanks to Gail Murphy, Mik Kersten, Leah Findlater, Markus Keller, and Peter Weißgerber for use of their data. Thanks for Ser- gio Antoy, Andrew Black, Mark Jones, and Len Shapiro for inviting their students to participate in my experiments. Thanks to Robert Bauer, Paul Berry, Dan Brown, Cynthia Brown, Christian Bird, Tim Chevalier, Rob DeLine, Iavor Diatchki, Akshay Dua, Rafael Fernandez-Moctezuma,´ Shiva Gudeti, Tom Harke, Anthony Hornof, Brian Huffman, Ed Kaiser, Rashawn Knapp, Jim Larson, Chuan-kai Lin, Ralph Lon- don, Bart Massey, Kathryn Mohror, Andrew McCreight, David Novick, Nick Pilk- ington, Philip Quitslund, Claudia Rocha, Suresh Singh, Tim Sheard, Jeremy Stein- hauer, Aravind Subhash, Kal Toth, Eric Wheeler, Candy Yiu, and many anonymous reviewers for detailed, insightful criticism. Thanks to Barry Anderson, Robert Bow- iii didge, Margaret Burnett, Jonathan Edwards, Joshua Kerievsky, Gregor Kiczales, Bill Opdyke, Bill Pugh, Jacek Ratzinger, and Vineet Sinha, Mathieu Verbaere, for their suggestions. Thanks to the participants of the Software Engineering seminar at UIUC for their suggestions. Special thanks to participants of my studies and interviews, without whom this research would have been impossible. Contents Acknowledgements ii Contents iv List of Tables xi List of Figures xiv 1 A Roadmap1 2 Refactoring Theory3 2.1 Contributions ............................. 3 2.2 What is Refactoring? ......................... 3 2.3 When Should Programmers Refactor?................ 6 2.4 Refactoring Tools........................... 7 2.5 A Model of How Programmers Use Refactoring Tools . 13 2.6 The Structure of this Dissertation................... 15 3 Refactoring Practice 18 3.1 Introduction.............................. 18 3.2 Contributions ............................. 19 3.3 The Data that We Analyzed...................... 20 3.4 Findings on Refactoring Behavior .................. 22 CONTENTS v 3.4.1 Toolsmiths and Users Differ ................. 22 3.4.2 Programmers Repeat Refactorings.............. 24 3.4.3 Programmers Often Do Not Configure Refactoring Tools . 27 3.4.4 Commit Messages Do Not Predict Refactoring . 29 3.4.5 Floss Refactoring is Common ................ 33 3.4.6 Refactorings are Frequent................... 35 3.4.7 Refactoring Tools are Underused............... 36 3.4.8 Different Refactorings are Performed with and without Tools 40 3.5 Discussion............................... 41 3.5.1 Tool-Usage Behavior..................... 41 3.5.2 Detecting Refactoring..................... 42 3.5.3 Refactoring Practice ..................... 43 3.5.4 Limitations of this Study................... 44 3.5.5 Study Details......................... 45 3.6 Conclusions.............................. 45 4 A Problem with Refactoring Tools 46 4.1 Contributions ............................. 46 4.2 Usability, Guidelines, and the Value of Guidelines Specific to Refac- toring ................................. 47 4.3 Why Usability is Important to Refactoring Tools........... 48 4.4 Related Work ............................. 49 4.5 An Exploratory Study of Refactoring................. 50 4.5.1 The Extract Method Refactoring............... 50 4.5.2 Methodology ......................... 52 4.5.3 Results ............................ 53 4.6 A Survey about Refactoring Behavior ................ 55 4.7 Usable Floss Refactoring Tools.................... 55 CONTENTS vi 4.7.1 Principles for Tools that Support Floss Refactoring . 56 4.7.2 Tools for Floss Refactoring.................. 57 5 The Identification Step 60 5.1 Contributions ............................. 62 5.2 Guidelines and Related Work..................... 63 5.2.1 Visualizations......................... 63 5.2.2 Editor Annotations...................... 67 5.3 Tool Description............................ 70 5.3.1 Ambient View......................... 70 5.3.2 Active View.......................... 73 5.3.3 Explanation View....................... 74 5.3.4 Details of Stench Blossom.................. 75 5.4 Evaluation............................... 76 5.4.1 Subjects............................ 77 5.4.2 Methodology ......................... 78 5.4.3 Results ............................ 80 5.4.3.1 Quantitative Results................ 80 5.4.3.2 How Smells were Identified without Stench Blossom 83 5.4.3.3 How Smells were Identified with Stench Blossom . 86 5.4.3.4 Suggestions for Tool Improvements . 87 5.4.4 Threats to Validity ...................... 88 5.4.5 Discussion........................... 91 5.5 Future Work.............................. 92 5.6 Conclusions.............................. 92 6 The Selection Step 93 6.1 Contributions ............................. 93 CONTENTS vii 6.2 Tool Description............................ 94 6.2.1 Selection Assist........................ 94 6.2.2 Box View........................... 95 6.3 Evaluation............................... 96 6.3.1 Subjects............................ 96 6.3.2 Methodology ......................... 97 6.3.3 Results ............................ 97 6.3.4 Threats to Validity ...................... 100 6.3.5 Discussion........................... 101 6.4 Guidelines............................... 102 6.5 Related Work: Alternative Selection Techniques . 103 6.6 Generalization to Other Refactorings . 104 6.6.1 A Running Example ..................... 105 6.6.2 Two More Selection Guidelines . 105 6.6.3 Tool Description: Refactoring Cues . 106 6.7 Conclusions.............................. 110 7 The Initiation Step 111 7.1 Contributions ............................. 111 7.2 Guidelines............................... 111 7.3 Related Work: Alternative Tool Initiation Techniques . 114 7.4 Tool Description............................ 114 7.5 Evaluation............................... 117 7.5.1 Previous Studies: Pie Menus vs. Linear Menus . 117 7.5.2 Memorability Study: Pie Menus with and without Placement Rules ............................. 119 7.5.2.1 Methodology.................... 119 7.5.2.2 Subjects ...................... 122 CONTENTS viii 7.5.2.3 Results....................... 122 7.5.2.4 Threats to Validity . 123 7.5.2.5 Discussion ..................... 124 7.5.3 Summary: A Comparison................... 124 7.6 Future Work.............................. 125 7.7 Conclusions.............................. 126 8 The Configuration Step 127 8.1 Contributions ............................. 127 8.2 Guidelines............................... 128 8.3 Related Work: Alternative Configuration Techniques . 130 8.4 Tool Description............................ 130 8.5 Evaluations .............................. 131 8.5.1 Analytical Study: Refactoring Cues vs. Traditional Tools . 131 8.5.1.1 Analysis by Stepwise Comparison . 132 8.5.1.2 Threats to Validity . 135 8.5.1.3 Discussion ..................... 136 8.5.2 Opinion Study: Pie Menus, Refactoring Cues, Hotkeys, and Linear Menus......................... 136 8.5.2.1 Methodology.................... 136 8.5.2.2 Subjects ...................... 138 8.5.2.3 Results....................... 139 8.5.2.4 Threats to Validity . 140 8.5.2.5 Discussion ..................... 140 8.5.3 Summary: A Comparison................... 140 8.6 Future Work.............................. 140 8.7 Conclusions.............................