<div dir="ltr"><span id="gmail-docs-internal-guid-67a59fe2-7fff-7463-ae07-b70b33c5e370"><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Hello everybody, happy Saturday!</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">While using the Extract Method refactoring, I often found myself wanting to move a newly extracted method to a different category most times. It was quite tedious to first extract the method and then manually create or select the target category. Sometimes, I even forgot to move the method altogether. I realized it would be very useful if the "Extract Method" refactoring also allowed the user to specify the category for the extracted method as part of the process.</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">The refactoring first prompts the user to name the method and its parameters (as usual). Then, an additional prompt asks the user to specify the target category for the new method. By default, it suggests the current category where the extraction is taking place. If the specified category does not already exist, it will be created, and the method will be placed inside it.</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Initially, I thought the best way to implement this feature was to enhance the existing Extract Method refactoring by adding the category selection functionality. However, after telling my idea to Hernán Wilkinson, he pointed out that it might not be ideal to force the user to click an additional button during the process. Following his advice, I implemented this as a new refactoring option that coexists with the original Extract Method refactoring.</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">The new refactoring is accessible via </span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Cmd + L</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> or from the usual refactoring menu.</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Since much of the functionality is shared with the existing </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">ExtractMethodApplier</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> class, I made some adjustments. Specifically, I modified </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">requestRefactoringParameters</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> and </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">createExtractMethodNewMethodFor</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> to include the category as a parameter in the class </span><span style="color:rgb(24,128,56);font-family:"Roboto Mono",monospace;font-size:14.6667px">ExtractMethodAndSelectCategoryApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline">. </span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline">I also reorganized </span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);vertical-align:baseline">ExtractMethodApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline"> to serve as a superclass, with two subclasses: </span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);vertical-align:baseline">ExtractMethodInSameCategoryApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline"> and </span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);vertical-align:baseline">ExtractMethodAndSelectCategoryApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline">. Each subclass defines the specific parameters to request from the user during the refactoring process. References to the original </span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);vertical-align:baseline">ExtractMethodApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline"> were updated to use </span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);vertical-align:baseline">ExtractMethodInSameCategoryApplier</span><span style="background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);vertical-align:baseline">.</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Regarding the naming of the classes, I had some doubts. An alternative naming could rename </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">ExtractMethodApplier</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> (the superclass) to </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">TransferCodeApplier</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> and revert </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">ExtractMethodInSameCategoryApplier</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline"> to simply </span><span style="font-size:11pt;font-family:"Roboto Mono",monospace;color:rgb(24,128,56);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">ExtractMethodApplier</span><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">. I’m open to suggestions on this!</span></p><p dir="ltr" style="line-height:1.38;margin-top:12pt;margin-bottom:12pt"><span style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;vertical-align:baseline">Any feedback or comments are appreciated, below is the change set. </span></p></span><br class="gmail-Apple-interchange-newline"></div>