Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-21153

Evaluate which refactoring we want to support

    XMLWordPrintable

    Details

      Description

      Martin Fowlers book about refactoring gives a deep inside into  different refactorings. We should decide which ones we want to implement. What are the dependencies of this refactorings etc.. 

      Normally you make a local change and then fix up all the global changes. For the global changes we need the symbols database. The local changes can need the AST but some are so simple that it should work without. Because they are very similar they can share much code. So creating building blocks could be quite useful if we see code duplication. We should think about UI elements too because in many cases we need to select multiple elements.

      The book is listing following refactoring:

      Chapter 6. Composing Methods .............................................................................. 89
      Extract Method........................................................................................................ 89
      Inline Method........................................................................................................... 95
      Inline Temp.............................................................................................................. 96
      Replace Temp with Query .................................................................................... 97
      Introduce Explaining Variable............................................................................. 101
      Split Temporary Variable..................................................................................... 104
      Remove Assignments to Parameters ............................................................... 107
      Replace Method with Method Object ................................................................ 110
      Substitute Algorithm ............................................................................................. 113
      Chapter 7. Moving Features Between Objects.................................................... 115
      Move Method ........................................................................................................ 115
      Move Field ............................................................................................................. 119
      Extract Class ......................................................................................................... 122
      Inline Class............................................................................................................ 125
      Hide Delegate ....................................................................................................... 127
      Remove Middle Man............................................................................................ 130
      Introduce Foreign Method................................................................................... 131
      Introduce Local Extension................................................................................... 133
      Chapter 8. Organizing Data .................................................................................... 138
      Self Encapsulate Field......................................................................................... 138
      Replace Data Value with Object ........................................................................ 141
      Change Value to Reference ............................................................................... 144
      Change Reference to Value ............................................................................... 148
      Replace Array with Object .................................................................................. 150
      Duplicate Observed Data .................................................................................... 153
      Change Unidirectional Association to Bidirectional ........................................ 159
      Change Bidirectional Association to Unidirectional ........................................ 162
      Replace Magic Number with Symbolic Constant ............................................ 166
      Encapsulate Field................................................................................................. 167
      Encapsulate Collection........................................................................................ 168
      Replace Record with Data Class....................................................................... 175
      Replace Type Code with Class .......................................................................... 176
      Replace Type Code with Subclasses ............................................................... 181
      Replace Type Code with State/Strategy........................................................... 184
      Replace Subclass with Fields............................................................................. 188
      Chapter 9. Simplifying Conditional Expressions ................................................. 192

      Decompose Conditional ...................................................................................... 192
      Consolidate Conditional Expression................................................................. 194
      Consolidate Duplicate Conditional Fragments ................................................ 196
      Remove Control Flag........................................................................................... 197
      Replace Nested Conditional with Guard Clauses ........................................... 201
      Replace Conditional with Polymorphism .......................................................... 205
      Introduce Null Object ........................................................................................... 209
      Introduce Assertion.............................................................................................. 216
      Chapter 10. Making Method Calls Simpler........................................................... 220
      Rename Method................................................................................................... 221
      Add Parameter...................................................................................................... 222
      Remove Parameter.............................................................................................. 223
      Separate Query from Modifier............................................................................ 225
      Parameterize Method .......................................................................................... 228
      Replace Parameter with Explicit Methods........................................................ 230
      Preserve Whole Object ....................................................................................... 232
      Replace Parameter with Method ....................................................................... 235
      Introduce Parameter Object ............................................................................... 238
      Remove Setting Method...................................................................................... 242
      Hide Method.......................................................................................................... 245
      Replace Constructor with Factory Method....................................................... 246
      Encapsulate Downcast........................................................................................ 249
      Replace Error Code with Exception .................................................................. 251
      Replace Exception with Test .............................................................................. 255
      Chapter 11. Dealing with Generalization.............................................................. 259
      Pull Up Field .......................................................................................................... 259
      Pull Up Method ..................................................................................................... 260
      Pull Up Constructor Body.................................................................................... 263
      Push Down Method.............................................................................................. 266
      Push Down Field .................................................................................................. 266
      Extract Subclass................................................................................................... 267
      Extract Superclass ............................................................................................... 272
      Extract Interface ................................................................................................... 277
      Collapse Hierarchy............................................................................................... 279
      Form Template Method....................................................................................... 280
      Replace Inheritance with Delegation................................................................. 287
      Replace Delegation with Inheritance................................................................. 289
      Chapter 12. Big Refactorings ................................................................................. 293
      Tease Apart Inheritance...................................................................................... 294
      Convert Procedural Design to Objects ............................................................. 300
      Separate Domain from Presentation................................................................. 302
      Extract Hierarchy.................................................................................................. 306

       

      I would propose that we add an user story for every refactoring we want to implement .

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            kkohne Kai Köhne
            Reporter:
            bubke Marco Bubke
            PM Owner:
            Tino Pyssysalo Tino Pyssysalo
            RnD Owner:
            Alessandro Portale Alessandro Portale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes