Skip to main content

2016 | OriginalPaper | Buchkapitel

Deriving Extract Method Refactoring Suggestions for Long Methods

verfasst von : Roman Haas, Benjamin Hummel

Erschienen in: Software Quality. The Future of Systems- and Software Development

Verlag: Springer International Publishing

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

The extract method is a common way to shorten long methods in software development. Before developers can use tools that support the extract method, they need to invest time in identifying a suitable refactoring candidate. This paper addresses the problem of finding the most appropriate refactoring candidate for long methods written in Java. The approach determines valid refactoring candidates and ranks them using a scoring function that aims to improve readability and reduce code complexity. We use length and nesting reduction as complexity indicators. The number of parameters needed by the candidate influences the score. To suggest candidates that are consistent with the structure of the code, information such as comments and blank lines are also considered by the scoring function. We evaluate our approach to three open source systems using a user study with ten experienced developers. Our results show that they would actually apply 86 % of suggestions for an extract method refactoring.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Literatur
1.
Zurück zum Zitat Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)MATH Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)MATH
2.
Zurück zum Zitat Kanemitsu, T., Higo, Y., Kusumoto, S.: A visualization method of program dependency graph for identifying extract method opportunity. In: Proceedings of the 4th Workshop on Refactoring Tools, pp. 8–14. ACM (2011) Kanemitsu, T., Higo, Y., Kusumoto, S.: A visualization method of program dependency graph for identifying extract method opportunity. In: Proceedings of the 4th Workshop on Refactoring Tools, pp. 8–14. ACM (2011)
3.
Zurück zum Zitat Marticorena, R., Lpez, C., Crespo, Y., Prez, F.J.: Refactoring generics in JAVA: a case study on extract method. In: 14th European Conference on Software Maintenance and Reengineering (CSMR), pp. 212–221. IEEE (2010) Marticorena, R., Lpez, C., Crespo, Y., Prez, F.J.: Refactoring generics in JAVA: a case study on extract method. In: 14th European Conference on Software Maintenance and Reengineering (CSMR), pp. 212–221. IEEE (2010)
4.
Zurück zum Zitat Martin, R.C.: Clean Code: A Handbook of Agile Software Craftsmanship. Prentice Hall, Upper Saddle River (2009) Martin, R.C.: Clean Code: A Handbook of Agile Software Craftsmanship. Prentice Hall, Upper Saddle River (2009)
5.
Zurück zum Zitat Maruyama, K.: Automated method-extraction refactoring by using block-based slicing. In: ACM SIGSOFT Software Engineering Notes, vol. 26, pp. 31–40. ACM (2001) Maruyama, K.: Automated method-extraction refactoring by using block-based slicing. In: ACM SIGSOFT Software Engineering Notes, vol. 26, pp. 31–40. ACM (2001)
6.
Zurück zum Zitat Murphy-Hill, E., Black, A.P.: Why don’t people use refactoring tools?. In: Proceedings of the 1st Workshop on Refactoring Tools, pp. 60–61 (2007) Murphy-Hill, E., Black, A.P.: Why don’t people use refactoring tools?. In: Proceedings of the 1st Workshop on Refactoring Tools, pp. 60–61 (2007)
7.
Zurück zum Zitat Murphy-Hill, E., Black, A.P.: Breaking the barriers to successful refactoring: observations and tools for extract method. In: Proceedings of the 30th International Conference on Software Engineering, pp. 421–430. IEEE (2008) Murphy-Hill, E., Black, A.P.: Breaking the barriers to successful refactoring: observations and tools for extract method. In: Proceedings of the 30th International Conference on Software Engineering, pp. 421–430. IEEE (2008)
8.
Zurück zum Zitat Opdyke, W.F.: Refactoring object-oriented frameworks. Ph.D. thesis. University of Illinois at Urbana-Champaign (1992) Opdyke, W.F.: Refactoring object-oriented frameworks. Ph.D. thesis. University of Illinois at Urbana-Champaign (1992)
9.
Zurück zum Zitat Sharma, T.: Identifying extract-method refactoring candidates automatically. In: Proceedings of the 5th Workshop on Refactoring Tools, pp. 50–53. ACM (2012) Sharma, T.: Identifying extract-method refactoring candidates automatically. In: Proceedings of the 5th Workshop on Refactoring Tools, pp. 50–53. ACM (2012)
10.
Zurück zum Zitat Silva, D., Terra, R., Valente, M.T.: Recommending automated extract method refactorings. In: Proceedings of the 22nd International Conference on Program Comprehension, pp. 146–156. ACM (2014) Silva, D., Terra, R., Valente, M.T.: Recommending automated extract method refactorings. In: Proceedings of the 22nd International Conference on Program Comprehension, pp. 146–156. ACM (2014)
11.
Zurück zum Zitat Steidl, D., Eder, S.: Prioritizing maintainability defects based on refactoring recommendations. In: Proceedings of the 22nd International Conference on Program Comprehension, pp. 168–176. ACM (2014) Steidl, D., Eder, S.: Prioritizing maintainability defects based on refactoring recommendations. In: Proceedings of the 22nd International Conference on Program Comprehension, pp. 168–176. ACM (2014)
12.
Zurück zum Zitat Streitel, F.: Incremental language independent static data flow analysis. Master’s thesis, Technical University of Munich (2014) Streitel, F.: Incremental language independent static data flow analysis. Master’s thesis, Technical University of Munich (2014)
13.
Zurück zum Zitat Tsantalis, N. Chatzigeorgiou, A.: Identification of extract method refactoring opportunities. In: 13th European Conference on Software Maintenance and Reengineering, pp. 119–128. IEEE (2009) Tsantalis, N. Chatzigeorgiou, A.: Identification of extract method refactoring opportunities. In: 13th European Conference on Software Maintenance and Reengineering, pp. 119–128. IEEE (2009)
14.
Zurück zum Zitat Wilking, D., Kahn, U.F., Kowalewski, S.: An empirical evaluation of refactoring. e-Informatica 1(1), 27–42 (2007) Wilking, D., Kahn, U.F., Kowalewski, S.: An empirical evaluation of refactoring. e-Informatica 1(1), 27–42 (2007)
15.
Zurück zum Zitat Yang, L., Liu, H., Niu, Z.: Identifying fragments to be extracted from long methods. In: Asia-Pacific Software Engineering Conference, pp. 43–49. IEEE (2009) Yang, L., Liu, H., Niu, Z.: Identifying fragments to be extracted from long methods. In: Asia-Pacific Software Engineering Conference, pp. 43–49. IEEE (2009)
Metadaten
Titel
Deriving Extract Method Refactoring Suggestions for Long Methods
verfasst von
Roman Haas
Benjamin Hummel
Copyright-Jahr
2016
DOI
https://doi.org/10.1007/978-3-319-27033-3_10