
UC San Diego UC San Diego Electronic Theses and Dissertations Title A framework for the checking and refactoring of crosscutting concepts Permalink https://escholarship.org/uc/item/9vb0z5x8 Author Shonle, Macneil Charles Publication Date 2009 Peer reviewed|Thesis/dissertation eScholarship.org Powered by the California Digital Library University of California UNIVERSITY OF CALIFORNIA, SAN DIEGO A Framework for the Checking and Refactoring of Crosscutting Concepts A dissertation submitted in partial satisfaction of the requirements for the degree Doctor of Philosophy in Computer Science by Macneil Charles Shonle Committee in charge: Professor William G. Griswold, Co-Chair Professor Sorin L. Lerner, Co-Chair Professor James D. Hollan Professor Ingolf Krueger Professor Jens Palsberg 2009 Copyright c Macneil Charles Shonle, 2009 All rights reserved. The dissertation of Macneil Charles Shonle is approved, and it is acceptable in quality and form for publication on microfilm and electronically: Co-Chair Co-Chair University of California, San Diego 2009 iii DEDICATION With love to my parents, my wife Anna, and my son Ansel. And in loving memory to Steven John Metsker, Arthur W. Chou, and Joseph Amadee Goguen. iv EPIGRAPH Yes we can. —Barack Obama The secret of genius is to carry the spirit of the child into old age, which means never losing your enthusiasm. —Aldous Huxley v TABLE OF CONTENTS Signature Page ................................... iii Dedication ...................................... iv Epigraph ....................................... v Table of Contents .................................. vi List of Figures .................................... ix List of Tables .................................... x Acknowledgements ................................. xi Vita and Publications ................................ xiii Abstract of the Dissertation ............................. xiv Chapter 1 Introduction ............................. 1 1.1 Solutions for Crosscutting .................. 2 1.1.1 Language-Based Solutions .............. 2 1.1.2 Tool-Based Solutions ................. 6 1.2 Overview of the Arcum Approach .............. 8 1.3 Outline ............................ 11 Chapter 2 The Arcum Approach ........................ 12 2.1 Refactoring using Eclipse ................... 13 2.2 Refactoring using Arcum ................... 15 2.3 The Arcum Language ..................... 19 2.3.1 The Concept Construct ................ 19 2.3.2 The Interface Declaration ............... 22 2.3.3 The Option Declaration ................ 23 2.3.4 Mappings ....................... 25 2.4 The Arcum Development Process .............. 26 Chapter 3 Arcum’s Design and Implementation ................ 28 3.1 Monotonic Fixed-Point Solver ................ 29 3.2 Transformation Algorithm .................. 33 3.2.1 Pattern Matching ................... 34 3.2.2 Node Generation ................... 34 vi Chapter 4 Case Study of Arcum ........................ 37 4.1 Comparisons to Eclipse and AspectJ ............. 38 4.1.1 Task 1: Application of AttributeConcept ....... 38 4.1.2 Task 2: Message Log Redirection .......... 39 4.1.3 Task 3: Remove Control Coupling .......... 40 4.2 Class Library Migration .................... 41 4.2.1 Canonicalization ................... 43 4.2.2 Removing Puns: De-Canonicalization ........ 43 4.3 Debuggability ......................... 44 4.4 User-Defined Semantics ................... 45 4.4.1 When Simple Solutions are too General ....... 46 4.4.2 Checking Uses of Reflection ............. 46 4.4.3 Detecting Library-Specific Errors .......... 49 4.4.4 Java Metadata Annotations .............. 50 4.5 Software Architectural Design Enforcement ......... 52 4.5.1 Finer-Grained Access Control ............ 52 4.5.2 Detecting Common Errors .............. 53 4.6 Extended Example: The Visitor Pattern ........... 54 4.6.1 Visitor Arcum Option Implementation ........ 56 4.6.2 Variant: Cycle Risks ................. 59 4.6.3 Variant: Reflection using the DJ Library ....... 59 4.6.4 Refactoring Special Cases .............. 61 4.6.5 Discussion of the Development Process ....... 63 Chapter 5 User Study of Arcum ........................ 65 5.1 Study Description ....................... 67 5.1.1 Study Participants .................. 68 5.1.2 Study Tasks ...................... 69 5.1.3 Performance of the Tasks ............... 71 5.1.4 Threats to Validity .................. 73 5.2 Reasoning About Crosscutting ................ 73 5.2.1 Using Build Errors as a Guide ............ 74 5.2.2 Making Direct Queries with Arcum ......... 75 5.2.3 Confusing Definition with Reference ........ 77 5.2.4 Using Reference Materials .............. 79 5.3 Abstractions of Crosscutting ................. 81 5.3.1 A Decompositional Model .............. 81 5.3.2 An Overloading Model ................ 83 5.3.3 Patterns as Abstractions ............... 83 5.3.4 Other Metaphors Observed .............. 84 5.4 Development Styles ...................... 84 5.4.1 Reuse of Uses ..................... 85 5.4.2 Incremental Exploration ............... 87 vii 5.4.3 Improving Arcum Development Style ........ 89 5.5 Reasoning about Several Possibilities ............ 90 5.5.1 Thinking of Before and After ............ 90 5.5.2 Thinking of Correct and Incorrect .......... 91 5.6 Related Studies ........................ 94 5.7 Design Recommendations .................. 95 Chapter 6 Future Work ............................. 96 6.1 Future Applications ...................... 96 6.2 Extensions to the Arcum Language .............. 97 6.3 New Operations for the Environment ............. 98 Chapter 7 Conclusion ............................. 100 7.1 Contributions ......................... 101 Appendix A Syntax, Types and Built-in Predicates ............... 103 A.1 Syntax ............................. 103 A.2 Types and Built-In Predicates ................. 106 Appendix B Visitor Concept Implementation .................. 109 Appendix C User Study Materials ........................ 112 Bibliography .................................... 126 viii LIST OF FIGURES Figure 2.1: A simple internal field implementation of the altText attribute . 13 Figure 2.2: Static Map implementation of the altText attribute ......... 14 Figure 2.3: Refactoring in Arcum for Eclipse .................. 15 Figure 2.4: Mapping for the original InternalField implementation ....... 16 Figure 2.5: Overview of how Arcum transforms code .............. 18 Figure 3.1: The hasA relation ........................... 29 Figure 3.2: A broken specification for the doesNotPrint predicate ........ 31 Figure 3.3: A correct specification for the doesNotPrint predicate ........ 32 Figure 4.1: The ImplicitBoxing option ...................... 42 Figure 4.2: An example restricted use of reflection ............... 47 Figure 4.3: An accessor method, getIdentifier, usable as a Function object . 48 Figure 4.4: A static solution for Figure 4.3 that doesn’t require reflection. 48 Figure 4.5: Two descriptions of a lookup table .................. 50 Figure 4.6: The classGraph and traversalGraph relations ............ 55 Figure 4.7: Code listing for a Visitor Pattern Arcum interface .......... 57 Figure 4.8: Code listing for GoFVisitor ..................... 58 Figure 4.9: Code listing for DJVisitor ...................... 60 Figure 4.10: A single implementation can be “factored” in different ways .... 62 Figure 5.1: Arcum’s Fragments View ....................... 76 Figure 5.2: A direct example of the Reuse of Uses by group B. ......... 86 Figure 5.3: Implementations for checkInit .................... 92 Figure C.1: Language examples document provided to users .......... 113 Figure C.2: Language Reference ......................... 114 Figure C.3: Arcum User Study Instructions — Day One, page 1 ......... 115 Figure C.4: Arcum User Study Instructions — Day One, page 2 ......... 116 Figure C.5: Arcum User Study Instructions — Day One, page 3 ......... 117 Figure C.6: Arcum User Study Instructions — Day One, page 4 ......... 118 Figure C.7: Arcum User Study Instructions — Day One, page 5 ......... 119 Figure C.8: Arcum User Study Instructions — Day One, page 6 ......... 120 Figure C.9: Arcum User Study Instructions — Day One, page 7 ......... 121 Figure C.10: Arcum User Study Instructions — Day Two, page 1 ........ 122 Figure C.11: Arcum User Study Instructions — Day Two, page 2 ........ 123 Figure C.12: Participant Pre-Questionnaire — page 1 ............... 124 Figure C.13: Participant Pre-Questionnaire — page 2 ............... 125 ix LIST OF TABLES Table 2.1: Example built-in predicates. ...................... 21 Table 5.1: Participant demographics ....................... 68 Table 5.2: How each group performed the tasks over the two sessions ..... 72 Table A.1: Arcum Types .............................. 107 Table A.2: Built-In Arcum Predicates ....................... 108 x ACKNOWLEDGEMENTS Thanks first go to my wife, Anna, because she gave me the idea for this work when I asked her what “deconstructive programming” would be like. She was also the most important catalyst in my transition into becoming a full time Ph.D. student. I am also grateful that I had the opportunity to work with both Bill Griswold and Sorin Lerner. I can still remember the research meeting at Bill’s house when the ideas behind this dissertation really came together. The results were impressive enough for us to rope Sorin into joining the team. I look forward to working with you both again. And also thanks go to Karl Lieberherr, at Northeastern University, for helping me publish my first conference paper. I’d
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages148 Page
-
File Size-