Login | Register

Automatic Motivation Detection for Extract Method Refactoring Operations


Automatic Motivation Detection for Extract Method Refactoring Operations

Aalizadeh, Mohammad Sadegh (2021) Automatic Motivation Detection for Extract Method Refactoring Operations. Masters thesis, Concordia University.

[thumbnail of Aalizadeh_MCompSc_S2021.pdf]
Text (application/pdf)
Aalizadeh_MCompSc_S2021.pdf - Accepted Version
Available under License Spectrum Terms of Access.


Refactoring is a common maintenance practice that enables developers to improve the internal
structure of a software system without altering its external behaviour. In this study
we propose a novel method to automatically detect 11 motivations driving the application
of EXTRACT METHOD refactoring operations. We conduct a large-scale study on
325 open-source Java repositories to automatically detect the motivations of 346K EXTRACT
METHOD refactoring instances. Previous studies have been merely based on surveys,
manual analysis of pull requests or commit-messages to detect the motivations of
developers. In this study we develop motivation detection rules to automatically extract
the developer motivations based on the context of a refactoring operation in the commit.
We find that the top four motivations for EXTRACT METHOD refactoring is to introduce
reusable methods, remove duplication, facilitate the implementation of new features and
bug fixes, and decompose long methods to improve their readability. There is an association
between the removal of duplication and the introduction of reusable methods in
the refactoring instances with multiple motivations. The findings of this study provide essential
feedback and insight for the research community, refactoring recommendation tool
builders, and project managers, to better understand why and how developers perform EXTRACT
METHOD refactorings and help them build refactoring tools tailored to the needs
and practices of developers.

Divisions:Concordia University > Gina Cody School of Engineering and Computer Science > Computer Science and Software Engineering
Item Type:Thesis (Masters)
Authors:Aalizadeh, Mohammad Sadegh
Institution:Concordia University
Degree Name:M. Comp. Sc.
Program:Computer Science
Date:1 August 2021
Thesis Supervisor(s):Tsantalis, Nikolaos
Keywords:Refactoring, Extract Method, Motivation
ID Code:988716
Deposited By: Mohammad Sadegh Aalizadeh
Deposited On:29 Nov 2021 16:16
Last Modified:29 Nov 2021 16:16


Aalizadeh, M. S. (2021). Motivation extractor. https://github.com/mosaliza/
Abid, C., Kessentini, M., Alizadeh, V., Dhouadi, M., and Kazman, R. (2020). How does
refactoring impact security when improving quality? a security-aware refactoring approach.
IEEE Transactions on Software Engineering, pages 1–1.
AlOmar, E., Mkaouer, M. W., and Ouni, A. (2019a). Can refactoring be self-affirmed?
an exploratory study on how developers document their refactoring activities in commit
messages. In 2019 IEEE/ACM 3rd InternationalWorkshop on Refactoring (IWoR), pages
AlOmar, E. A., Mkaouer, M. W., and Ouni, A. (2021). Toward the automatic classification
of self-affirmed refactoring. Journal of Systems and Software, 171:110821.
AlOmar, E. A., Mkaouer, M. W., Ouni, A., and Kessentini, M. (2019b). On the impact of
refactoring on the relationship between quality attributes and design metrics. In 2019
ACM/IEEE International Symposium on Empirical Software Engineering and Measurement
(ESEM), pages 1–11.
AlOmar, E. A., Rodriguez, P. T., Bowman, J., Wang, T., Adepoju, B., Lopez, K., Newman,
C., Ouni, A., and Mkaouer, M. W. (2020). How do developers refactor code to improve
code reusability? In International Conference on Software and Software Reuse, pages
261–276. Springer.
Arcelli, D., Cortellessa, V., and Di Pompeo, D. (2018). Performance-driven software model
refactoring. Information and Software Technology, 95:366–397.
Bavota, G., De Lucia, A., Di Penta, M., Oliveto, R., and Palomba, F. (2015). An experimental
investigation on the innate relationship between quality and refactoring. J. Syst.
Softw., 107(C):1–14.
Bogart, A., AlOmar, E. A., Mkaouer, M. W., and Ouni, A. (2020). Increasing the trust in
refactoring through visualization. In Proceedings of the IEEE/ACM 42nd International
Conference on Software Engineering Workshops, pages 334–341
Charalampidou, S., Ampatzoglou, A., Chatzigeorgiou, A., Gkortzis, A., and Avgeriou, P.
(2017). Identifying extract method refactoring opportunities based on functional relevance.
IEEE Transactions on Software Engineering, 43(10):954–974.
Chávez, A., Ferreira, I., Fernandes, E., Cedrim, D., and Garcia, A. (2017). How does
refactoring affect internal quality attributes? a multi-project study. In Proceedings of the
31st Brazilian Symposium on Software Engineering, SBES’17, page 74–83, New York,
NY, USA. Association for Computing Machinery.
Chen, J., Xiao, J.,Wang, Q., Osterweil, L. J., and Li, M. (2016). Perspectives on refactoring
planning and practice: An empirical study. Empirical Softw. Engg., 21(3):1397–1436.
Chen, Z., Kwon, Y.-W., and Song, M. (2018). Clone refactoring inspection by summarizing
clone refactorings and detecting inconsistent changes during software evolution. Journal
of Software: Evolution and Process, 30(10):e1951.
Derezi´nska, A. (2017). A structure-driven process of automated refactoring to design patterns.
In International Conference on Information Systems Architecture and Technology,
pages 39–48. Springer.
Dig, D., Comertoglu, C., Marinov, D., and Johnson, R. (2006). Automated detection of
refactorings in evolving components. In Thomas, D., editor, ECOOP 2006 – Object-
Oriented Programming, pages 404–428, Berlin, Heidelberg. Springer Berlin Heidelberg.
Dig, D. and Johnson, R. (2006). How do apis evolve? a story of refactoring. Journal of
software maintenance and evolution: Research and Practice, 18(2):83–107.
Ferreira, I. V. (2018). Assessing the Bug-Proneness of Refactored Code: Longitudinal
Multi-Project Studies. PhD thesis, PUC-Rio.
Hora, A. C. and Robbes, R. (2020). Characteristics of method extractions in java: a large
scale empirical study. Empir. Softw. Eng., 25(3):1798–1833.
Ivers, J., Ozkaya, I., Nord, R. L., and Seifried, C. (2020). Next generation automated software
evolution refactoring at scale. In Proceedings of the 28th ACM Joint Meeting on
European Software Engineering Conference and Symposium on the Foundations of Software
Engineering, ESEC/FSE 2020, page 1521–1524, New York, NY, USA. Association
for Computing Machinery.
Kaur, P. and Mittal, P. (2017). Impact of clones refactoring on external quality attributes
of open source softwares. International Journal of Advanced Research in Computer
Science, 8(5).
Kaya, M., Conley, S., Othman, Z. S., and Varol, A. (2018). Effective software refactoring
process. In 2018 6th International Symposium on Digital Forensic and Security (ISDFS),
pages 1–6.
Kim, M. and Notkin, D. (2009). Discovering and representing systematic code changes. In
Proceedings of the 31st International Conference on Software Engineering, ICSE ’09,
page 309–319, New York, NY, USA. Association for Computing Machinery.
Kim, M., Zimmermann, T., and Nagappan, N. (2014). An empirical study of refactoringchallenges
and benefits at microsoft. IEEE Trans. Softw. Eng., 40(7):633–649.
Kourie, D. G. and Watson, B. W. (2012). Procedures and recursion. In The Correctnessby-
Construction Approach to Programming, pages 161–195. Springer.
Levenshtein, V. I. (1966). Binary codes capable of correcting deletions, insertions and
reversals. Soviet Physics Doklady, 10(8):707–710. Doklady Akademii Nauk SSSR,
V163 No4 845-848 1965.
Lin, Y., Radoi, C., and Dig, D. (2014). Retrofitting concurrency for android applications
through refactoring. In Proceedings of the 22nd ACM SIGSOFT International Symposium
on Foundations of Software Engineering, pages 341–352.
Liu, W. and Liu, H. (2016). Major motivations for extract method refactorings: analysis
based on interviews and change histories. Frontiers of Computer Science, 10(4):644–
LUO, T., bo GUO, Y., hui HAO, Y., and LI, H. (2011). Method verifying the correctness
of code refactoring program. Journal on Communications, 32(11A):152.
Mazinanian, D., Tsantalis, N., Stein, R., and Valenta, Z. (2016). Jdeodorant: clone refactoring.
In Proceedings of the 38th international conference on software engineering
companion, pages 613–616.
Mohan, M. and Greer, D. (2017). Multirefactor: automated refactoring to improve software
quality. In International Conference on Product-Focused Software Process Improvement,
pages 556–572. Springer.
Nasagh, R. S., Shahidi, M., and Ashtiani, M. (2021). A fuzzy genetic automatic refactoring
approach to improve software maintainability and flexibility. Soft Computing,
Negara, S., Chen, N., Vakilian, M., Johnson, R. E., and Dig, D. (2013). A comparative
study of manual and automated refactorings. In Proceedings of the 27th European
Conference on Object-Oriented Programming, ECOOP’13, pages 552–576, Berlin, Heidelberg.
Nyamawe, A. S., Liu, H., Niu, N., Umer, Q., and Niu, Z. (2019). Automated recommendation
of software refactorings based on feature requests. In 2019 IEEE 27th International
Requirements Engineering Conference (RE), pages 187–198. IEEE.
Nyamawe, A. S., Liu, H., Niu, N., Umer, Q., and Niu, Z. (2020). Feature requests-based
recommendation of software refactorings. Empirical Software Engineering, 25(5):4315–
Nyamawe, A. S., Liu, H., Niu, Z.,Wang,W., and Niu, N. (2018). Recommending refactoring
solutions based on traceability and code metrics. IEEE Access, 6:49460–49475.
Opdyke, W. F. (1990). Refactoring : An aid in designing application frameworks and
evolving object-oriented systems. Proc. SOOPPA ’90 : Symposium on Object-Oriented
Programming Emphasizing Practical Applications.
Paixão, M., Uchôa, A., Bibiano, A. C., Oliveira, D., Garcia, A., Krinke, J., and Arvonio,
E. (2020). Behind the Intents: An In-Depth Empirical Study on Software Refactoring
in Modern Code Review, page 125–136. Association for Computing Machinery, New
York, NY, USA.
Pantiuchina, J., Zampetti, F., Scalabrino, S., Piantadosi, V., Oliveto, R., Bavota, G., and
Penta, M. D. (2020). Why developers refactor source code: A mining-based study. ACM
Trans. Softw. Eng. Methodol., 29(4).
Perkins, J. H. (2005). Automatically generating refactorings to support api evolution. In
proceedings of the 6th ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for
Software Tools and Engineering, pages 111–114.
Pinto, G., Torres, W., Fernandes, B., Castor, F., and Barros, R. S. (2015). A large-scale
study on the usage of java’s concurrent programming constructs. Journal of Systems and
Software, 106:59–81.
Prete, K., Rachatasumrit, N., Sudan, N., and Kim, M. (2010). Template-based reconstruction
of complex refactorings. In Proceedings of the 2010 IEEE International Conference
on Software Maintenance, ICSM ’10, page 1–10, USA. IEEE Computer Society.
Seng, O., Stammel, J., and Burkhart, D. (2006). Search-based determination of refactorings
for improving the class structure of object-oriented systems. In Proceedings of the 8th
annual conference on Genetic and evolutionary computation, pages 1909–1916.
Silva, D., Silva, J., De Souza Santos, G. J., Terra, R., and Valente, M. T. O. (2020). Refdiff
2.0: A multi-language refactoring detection tool. IEEE Transactions on Software
Engineering, pages 1–1.
Silva, D., Terra, R., and Valente, M. T. (2014). Recommending automated extract method
refactorings. In Proceedings of the 22nd International Conference on Program Comprehension,
ICPC 2014, page 146–156, New York, NY, USA. Association for Computing
Silva, D., Tsantalis, N., and Valente, M. T. (2016). Why we refactor? confessions of github
contributors. In Proceedings of the 2016 24th ACM SIGSOFT International Symposium
on Foundations of Software Engineering, FSE 2016, page 858–870, New York, NY,
USA. Association for Computing Machinery.
Silva, D. and Valente, M. T. (2017). Refdiff: Detecting refactorings in version histories. In
2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR),
pages 269–279.
Silva, I. P., Alves, E. L., and Machado, P. D. (2018). Can automated test case generation
cope with extract method validation? In Proceedings of the XXXII Brazilian Symposium
on Software Engineering, pages 152–161.
Sothornprapakorn, S., Hayashi, S., and Saeki, M. (2018). Visualizing a tangled change
for supporting its decomposition and commit construction. In 2018 IEEE 42nd Annual
Computer Software and Applications Conference (COMPSAC), volume 01, pages 74–
Stefano, M. D., Pecorelli, F., Tamburri, D. A., Palomba, F., and Lucia, A. D. (2020). Refactoring
recommendations based on the optimization of socio-technical congruence. In
2020 IEEE International Conference on Software Maintenance and Evolution (ICSME),
pages 794–796.
Tairas, R. and Gray, J. (2012). Increasing clone maintenance support by unifying clone
detection and refactoring activities. Information and Software Technology, 54(12):1297–
Tanhaei, M. (2020). A model transformation approach to perform refactoring on software
architecture using refactoring patterns based on stakeholder requirements. AUT Journal
of Mathematics and Computing, 1(2):179–216.
Tarlinder, A. (2016). Developer testing: Building quality into software. Addison-Wesley
Tsantalis, N. and Chatzigeorgiou, A. (2011). Identification of extract method refactoring
opportunities for the decomposition of methods. Journal of Systems and Software,
Tsantalis, N., Guana, V., Stroulia, E., and Hindle, A. (2013). A multidimensional empirical
study on refactoring activity. In Proceedings of the 2013 Conference of the Center for
Advanced Studies on Collaborative Research, CASCON ’13, pages 132–146, Riverton,
NJ, USA. IBM Corp.
Tsantalis, N., Ketkar, A., and Dig, D. (2020). Refactoringminer 2.0. IEEE Transactions on
Software Engineering, pages 1–1.
Tsantalis, N., Mansouri, M., Eshkevari, L. M., Mazinanian, D., and Dig, D. (2018). Accurate
and efficient refactoring detection in commit history. In Proceedings of the 40th International
Conference on Software Engineering, ICSE ’18, pages 483–494, New York,
Tsantalis, N., Mazinanian, D., and Krishnan, G. P. (2015). Assessing the refactorability of
software clones. IEEE Transactions on Software Engineering, 41(11):1055–1090.
Vashisht, H., Bharadwaj, S., and Sharma, S. (2018). Analysing of impact of code refactoring
on software quality attributes. IJ Scientific Research and Engineering Trends,
Vassallo, C., Grano, G., Palomba, F., Gall, H. C., and Bacchelli, A. (2019). A large-scale
empirical exploration on refactoring activities in open source software projects. Science
of Computer Programming, 180:1–15.
Wang, Y. (2009). What motivate software engineers to refactor source code? evidences
from professional developers. In 2009 IEEE International Conference on Software Maintenance,
pages 413–416.
Xu, S., Sivaraman, A., Khoo, S.-C., and Xu, J. (2017). Gems: An extract method refactoring
recommender. In 2017 IEEE 28th International Symposium on Software Reliability
Engineering (ISSRE), pages 24–34.
Yang, L., Liu, H., and Niu, Z. (2009). Identifying fragments to be extracted from long
methods. In 2009 16th Asia-Pacific Software Engineering Conference, pages 43–49.
Yue, R., Gao, Z., Meng, N., Xiong, Y., Wang, X., and Morgenthaler, J. D. (2018). Automatic
clone recommendation for refactoring based on the present and the past. In 2018
IEEE International Conference on Software Maintenance and Evolution (ICSME), pages
115–126. IEEE.
All items in Spectrum are protected by copyright, with all rights reserved. The use of items is governed by Spectrum's terms of access.

Repository Staff Only: item control page

Downloads per month over past year

Research related to the current document (at the CORE website)
- Research related to the current document (at the CORE website)
Back to top Back to top