Top Refactorings 2

Posted by Tim Ottinger Thu, 26 Jun 2008 01:10:00 GMT

This has been done before by another mentor, and it was fun. I’ve been watching my use of refactoring tools, and here is my top five list of seven most-used refactorings:

  1. Rename
  2. Introduce Variable
  3. Extract Method
  4. Inline variable
  5. Inline method
  6. Move Method
  7. Change method signature

You might guess that I’m doing a fair amount of refactoring on legacy code.

I was suprised how much I’m using introduce/inline variable, but quite often I’m doing that to make a block of code ready for method extraction. Having broken out small methods, I sometimes find a larger method to extract, and then I inline the use of smaller methods. It’s sometimes hard to find the right level of generality.

I’d have trouble imagining that the first three weren’t everyone’s favorite refactorings.

Comments

Leave a response

  1. Avatar
    Ariel 19 minutes later:

    How did you tally the score? Since you are working on legacy code, I am surprised that “Extract Class” does not appear on this list. Then again, I’m sure it would if this were a top 10 :)

  2. Avatar
    James Carr about 1 hour later:

    I’ve been finding myself introducing strategy and visitor a lot lately… I think the top 3 in this list are so common I do them without thinking. :)

Comments