Extract Local Variable

The following table summarizes collected extract local variable refactoring. We use a participant's ID to indicate his/her simple refactoring and use ID' to indicate his/her complex refactoring.
 ID Simple Complex Consistent
 6 correct correct true
 7 correct correct false
 10 correct incorrect false
 11 correct incorrect false
 12 correct incorrect false
 13 correct incorrect true
 14 correct correct false
 15 correct  

 
In total, we collected fourteen extract local variable refactoring. These refactorings fell into six different refactoring workflow patterns. These following two patterns were adopted by more than one participant.
  • Two refactorings (10 and 15) first created a new local variable declaration, copied the expression to extract, pasted the expression to the declaration, and finally replaced the expression to extract with a reference to the local variable. This pattern is illustrated by the red transitions in the following finite state machine.
  • Three refactorings (2, 14, and 11') first cut the expression to extract, pasted the expression nearby, created a new local variable declaration before the pasted expression, and finally added reference at the location where the expression originally was. This pattern is illustrated by the blue transitions in the following finite state machine.
  • Three refactorings (7, 12' and 13) first cut the expression to extract, added reference at the the location where the expression originally was,  created a new local variable declaration, and finally pasted the expression in the declaration. This pattern is illustrated by the green transitions in the following finite state machine.


In addition to above patterns, we collected the following four workflow patterns that were adopted by less participant:
  • Two refactorings (6 and 6') first created a new local variable declaration, cut the expression to extract, pasted the expression to the local variable declaration, and finally added reference at the location where the extracted expression originally was.
  • One refactoring (7) first cut the expression to extract, created a new local variable declaration, pasted the expression to the local variable declaration, add finally added reference to the local variable at the location where the extracted expression originally was.
  • One refactoring (11) first created a new local variable declaration, cut the expression to extract, added a reference to the local variable at the location where the cut expression originally was, and finally pasted the expression to the local variable declaration.
  • One refactoring (10') first copied the expression to extract, pasted it nearby, added a local variable declaration before the pasted expression, and finally replaced the expression with the local variable reference.
  • One refactoring (14) first cut the expression to extract, added a reference at the location where the extracted expression originally was, created a new local variable declaration, and  finally pasted the expression to the local variable declaration.
Comments