The work of decomposing long methods into smaller ones is commonly assisted by the Extract Method refactoring technique. However, local variable usages can make code extraction difficult. Therefore, Replace Method with Method Object refactoring technique lets the developer create a field for each variable, and then code extractions can be performed without worrying about variable dependences. However, this can lead to classes having many fields used by a few of its methods. Moreover, the considered fields may not correctly describe the actual object state, making the class harder to understand. This paper proposes a data dependence analysis approach for guiding the Replace Method with Method Object refactoring technique, with the aim of reducing the set of variables becoming fields while properly handling data dependence. The resulting class is easier to understand, having less fields holding the state, while using local variables and parameters to confine all the other data dependence details.

Assisting Replace Method with Method Object: Selecting Fields and Preserving Data Access

Fornaia A.;Tramontana E.
2018-01-01

Abstract

The work of decomposing long methods into smaller ones is commonly assisted by the Extract Method refactoring technique. However, local variable usages can make code extraction difficult. Therefore, Replace Method with Method Object refactoring technique lets the developer create a field for each variable, and then code extractions can be performed without worrying about variable dependences. However, this can lead to classes having many fields used by a few of its methods. Moreover, the considered fields may not correctly describe the actual object state, making the class harder to understand. This paper proposes a data dependence analysis approach for guiding the Replace Method with Method Object refactoring technique, with the aim of reducing the set of variables becoming fields while properly handling data dependence. The resulting class is easier to understand, having less fields holding the state, while using local variables and parameters to confine all the other data dependence details.
2018
978-1-5386-2666-5
Data dependence; Modularity; Refactoring; Software evolution; Software quality
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.11769/365905
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 2
  • ???jsp.display-item.citation.isi??? 1
social impact