Login | Register

JsDiffer: Refactoring Detection in JavaScript

Title:

JsDiffer: Refactoring Detection in JavaScript

Shiblu, Mosabbir Khan (2022) JsDiffer: Refactoring Detection in JavaScript. Masters thesis, Concordia University.

[thumbnail of Refactoring Detection in JavaScript]
Text (Refactoring Detection in JavaScript) (application/pdf)
Shiblu_MA_F2022.pdf - Accepted Version
Restricted to Repository staff only
Available under License Spectrum Terms of Access.
2MB

Abstract

Refactoring refers to any code changes that improve the maintainability of the software system. Identifying such activities helps to understand the evolution and the relationship between two versions of a system. Therefore, automatic detection of refactorings applied in a system by comparing the source code between two snapshots has been an active research topic. Current state-of-the-art refactoring detection tools RefactoringMiner 2.0, however only supports programs written in Java language. On the other hand, JavaScript, despite being the most popular language, is supported by only one refactoring detection tool - RefDiff 2.0 which cannot detect variable level refactorings such as rename variable, rename parameter, etc. In this study, we present JsDiffer, which supports 18 different refactoring operations including several variable-related refactorings in JavaScript projects. Although the tool is inspired by RefactoringMiner, it differs quite a lot from RefactoringMiner in terms of structural mapping. We evaluated JsDiffer by constructing an oracle of 341 refactoring instances mined from 18 open-source JavaScript projects and compared it with RefDiff 2.0. Our results indicate that JsDiffer can achieve precision and recall of 96% and 44% respectively. Although RefDiff 2.0 turned out to be the better of the two tools for JavaScript projects, our approach shows promising results in the detection of Rename Variable refactorings where it achieves a precision of 88%.

Divisions:Concordia University > Gina Cody School of Engineering and Computer Science > Computer Science and Software Engineering
Item Type:Thesis (Masters)
Authors:Shiblu, Mosabbir Khan
Institution:Concordia University
Degree Name:M. Comp. Sc.
Program:Computer Science
Date:November 2022
Thesis Supervisor(s):Tsantalis, Nikolaos
Keywords:JavaScript Refactorings Detection RefactoringMiner Refactoring JsDiffer Js Refactoring Detector automatic refactoring detection Diff Source code static analysis commit history
ID Code:991306
Deposited By: Mosabbir Khan Shiblu
Deposited On:21 Jun 2023 14:39
Last Modified:21 Jun 2023 14:39

References:

[1] Abdullah Almogahed, Mazni Omar, and Nur Haryani Zakaria. Refactoring codes to
improve software security requirements. Procedia Computer Science, 204:108–115,
2022.
[2] Wellisson GP da Silva, Lisane Brisolara, Ulisses B Corrêa, and Luigi Carro. Evalua-
tion of the impact of code refactoring on embedded software efficiency. In Proceed-
ings of the 1st Workshop de Sistemas Embarcados, pages 145–150, 2010.
[3] Luis Cruz, Rui Abreu, and Jean-Noël Rouvignac. Leafactor: Improving energy ef-
ficiency of android apps via automatic refactoring. In 2017 IEEE/ACM 4th Inter-
national Conference on Mobile Software Engineering and Systems (MOBILESoft),
pages 205–206. IEEE, 2017.
[4] Raimund Moser, Pekka Abrahamsson, Witold Pedrycz, Alberto Sillitti, and Giancarlo
Succi. A case study on the impact of refactoring on quality and productivity in an
agile team. In IFIP Central and East European Conference on Software Engineering
Techniques, pages 252–266. Springer, 2007.
[5] Shaweta Kumar and Sanjeev Bansal. Comparative study of test driven development
with traditional techniques. Int. J. Soft Comp. & Eng, 3(1):352–360, 2013.
[6] Chaima Abid, Vahid Alizadeh, Marouane Kessentini, Thiago do Nascimento Ferreira,
and Danny Dig. 30 years of software refactoring research: a systematic literature
review. arXiv preprint arXiv:2007.02194, 2020.
[7] Sarah Fakhoury, Devjeet Roy, Adnan Hassan, and Vernera Arnaoudova. Improving
source code readability: theory and practice. In 2019 IEEE/ACM 27th International
Conference on Program Comprehension (ICPC), pages 2–12. IEEE, 2019.
[8] Anthony Peruma, Mohamed Wiem Mkaouer, Michael J Decker, and Christian D New-
man. An empirical investigation of how and why developers rename identifiers. In
Proceedings of the 2nd International Workshop on Refactoring, pages 26–33, 2018.
[9] Bin Lin, Csaba Nagy, Gabriele Bavota, and Michele Lanza. On the impact of refac-
toring operations on code naturalness. In 2019 IEEE 26th International Conference
on Software Analysis, Evolution and Reengineering (SANER), pages 594–598. IEEE,
2019.
52
[10] Diego Cedrim, Alessandro Garcia, Melina Mongiovi, Rohit Gheyi, Leonardo Sousa,
Rafael de Mello, Baldoino Fonseca, Márcio Ribeiro, and Alexander Chávez. Un-
derstanding the impact of refactoring on smells: A longitudinal study of 23 software
projects. In Proceedings of the 2017 11th Joint Meeting on Foundations of Software
Engineering, pages 465–475, 2017.
[11] Martina Iammarino, Fiorella Zampetti, Lerina Aversano, and Massimiliano Di Penta.
Self-admitted technical debt removal and refactoring actions: Co-occurrence or more?
In 2019 IEEE International Conference on Software Maintenance and Evolution (IC-
SME), pages 186–190. IEEE, 2019.
[12] Walter Lucas, Rodrigo Bonifácio, Edna Dias Canedo, Diego Marcílio, and Fernanda
Lima. Does the introduction of lambda expressions improve the comprehension of
java programs? In Proceedings of the XXXIII Brazilian Symposium on Software
Engineering, pages 187–196, 2019.
[13] Emerson Murphy-Hill, Chris Parnin, and Andrew P. Black. How we refactor, and how
we know it. IEEE Transactions on Software Engineering, 38(1):5–18, 2012.
[14] Stas Negara, Nicholas Chen, Mohsen Vakilian, Ralph Johnson, and Danny Dig. A
comparative study of manual and automated refactorings. volume 7920, pages 552–
576, 07 2013.
[15] Miryung Kim, Thomas Zimmermann, and Nachiappan Nagappan. A field study of
refactoring challenges and benefits. In Proceedings of the ACM SIGSOFT 20th Inter-
national Symposium on the Foundations of Software Engineering, pages 1–11, 2012.
[16] Miryung Kim, Thomas Zimmermann, and Nachiappan Nagappan. An empirical study
of refactoringchallenges and benefits at microsoft. IEEE Transactions on Software
Engineering, 40(7):633–649, 2014.
[17] Danilo Silva, Nikolaos Tsantalis, and Marco Tulio Valente. Why we refactor? con-
fessions 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, 2016. Association for Computing Machinery.
[18] Miryung Kim, Dongxiang Cai, and Sunghun Kim. An empirical investigation into the
role of api-level refactorings during software evolution. In Proceedings of the 33rd
International Conference on Software Engineering, pages 151–160, 2011.
[19] Peter Weißgerber and Stephan Diehl. Are refactorings less error-prone than other
changes? In Proceedings of the 2006 international workshop on Mining software
repositories, pages 112–118, 2006.
[20] Gabriele Bavota, Bernardino De Carluccio, Andrea De Lucia, Massimiliano Di Penta,
Rocco Oliveto, and Orazio Strollo. When does a refactoring induce bugs? an empir-
ical study. In 2012 IEEE 12th International Working Conference on Source Code
Analysis and Manipulation, pages 104–113. IEEE, 2012.
53
[21] Andre Hora, Danilo Silva, Marco Tulio Valente, and Romain Robbes. Assessing
the threat of untracked changes in software evolution. In Proceedings of the 40th
International Conference on Software Engineering, pages 1102–1113, 2018.
[22] Quinten David Soetens, Romain Robbes, and Serge Demeyer. Changes as first-class
citizens: A research perspective on modern software tooling. ACM Computing Sur-
veys (CSUR), 50(2):1–38, 2017.
[23] Mehran Mahmoudi, Sarah Nadi, and Nikolaos Tsantalis. Are refactorings to blame?
an empirical study of refactorings in merge conflicts. In 2019 IEEE 26th International
Conference on Software Analysis, Evolution and Reengineering (SANER), pages 151–
162. IEEE, 2019.
[24] Johannes Henkel and Amer Diwan. Catchup! capturing and replaying refactorings to
support api evolution. In Proceedings of the 27th international conference on Soft-
ware engineering, pages 274–283, 2005.
[25] Zhenchang Xing and Eleni Stroulia. The jdevan tool suite in support of object-
oriented evolutionary development. In Companion of the 30th International Con-
ference on Software Engineering, ICSE Companion ’08, page 951–952, New York,
NY, USA, 2008. Association for Computing Machinery.
[26] Eman Abdullah AlOmar, Hussein AlRubaye, Mohamed Wiem Mkaouer, Ali Ouni,
and Marouane Kessentini. Refactoring practices in the context of modern code re-
view: An industrial case study at xerox. In 2021 IEEE/ACM 43rd International Con-
ference on Software Engineering: Software Engineering in Practice (ICSE-SEIP),
pages 348–357. IEEE, 2021.
[27] Nikolaos Tsantalis, Ameya Ketkar, and Danny Dig. Refactoringminer 2.0. IEEE
Transactions on Software Engineering, 2020.
[28] Danilo Silva, João Silva, Gustavo Jansen De Souza Santos, Ricardo Terra, and Marco
Tulio O. Valente. Refdiff 2.0: A multi-language refactoring detection tool. IEEE
Transactions on Software Engineering, pages 1–1, 2020.
[29] Leo Brodie. Thinking Forth. Punchy Publishing, 2004.
[30] W. F. OPDYKE. Refactoring : An aid in designing application frameworks and evolv-
ing object-oriented systems. Proc. SOOPPA ’90 : Symposium on Object-Oriented
Programming Emphasizing Practical Applications, 1990.
[31] T. Mens and T. Tourwe. A survey of software refactoring. IEEE Transactions on
Software Engineering, 30(2):126–139, 2004.
[32] Raimund Moser, Alberto Sillitti, Pekka Abrahamsson, and Giancarlo Succi. Does
refactoring improve reusability? In International conference on software reuse, pages
287–297. Springer, 2006.
54
[33] Dirk Wilking, Umar Farooq Kahn, and Stefan Kowalewski. An empirical evaluation
of refactoring. e Informatica Softw. Eng. J., 1(1):27–42, 2007.
[34] Gabriele Bavota, Andrea De Lucia, Massimiliano Di Penta, Rocco Oliveto, and Fabio
Palomba. An experimental investigation on the innate relationship between quality
and refactoring. Journal of Systems and Software, 107:1–14, 2015.
[35] Diego Cedrim, Leonardo Sousa, Alessandro Garcia, and Rohit Gheyi. Does refac-
toring improve software structural quality? a longitudinal study of 25 projects. In
Proceedings of the 30th Brazilian Symposium on Software Engineering, pages 73–82,
2016.
[36] Jevgenija Pantiuchina, Michele Lanza, and Gabriele Bavota. Improving code: The
(mis) perception of quality metrics. In 2018 IEEE International Conference on Soft-
ware Maintenance and Evolution (ICSME), pages 80–91. IEEE, 2018.
[37] Eman Abdullah AlOmar, Mohamed Wiem Mkaouer, Ali Ouni, and Marouane Kessen-
tini. 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. IEEE, 2019.
[38] Francesca Arcelli Fontana, Pietro Braione, and Marco Zanoni. Automatic detection
of bad smells in code: An experimental assessment. J. Object Technol., 11(2):5–1,
2012.
[39] Fabio Palomba, Gabriele Bavota, Massimiliano Di Penta, Rocco Oliveto, Andrea
De Lucia, and Denys Poshyvanyk. Detecting bad smells in source code using change
history information. In 2013 28th IEEE/ACM International Conference on Automated
Software Engineering (ASE), pages 268–278. IEEE, 2013.
[40] Wiem Mkaouer, Marouane Kessentini, Adnan Shaout, Patrice Koligheu, Slim
Bechikh, Kalyanmoy Deb, and Ali Ouni. Many-objective software remodulariza-
tion using nsga-iii. ACM Transactions on Software Engineering and Methodology
(TOSEM), 24(3):1–45, 2015.
[41] Gabriele Bavota, Andrea De Lucia, Andrian Marcus, and Rocco Oliveto. Recom-
mending refactoring operations in large software systems. In Recommendation Sys-
tems in Software Engineering, pages 387–419. Springer, 2014.
[42] Ali Ouni, Marouane Kessentini, Houari Sahraoui, Katsuro Inoue, and Kalyanmoy
Deb. Multi-criteria code refactoring using search-based software engineering: An
industrial case study. ACM Transactions on Software Engineering and Methodology
(TOSEM), 25(3):1–53, 2016.
[43] Don Roberts, John Brant, and Ralph Johnson. A refactoring tool for smalltalk. Theory
and Practice of Object systems, 3(4):253–263, 1997.
55
[44] Davood Mazinanian, Nikolaos Tsantalis, Raphael Stein, and Zackary Valenta.
Jdeodorant: clone refactoring. In Proceedings of the 38th international conference
on software engineering companion, pages 613–616, 2016.
[45] Miryung Kim, Matthew Gee, Alex Loh, and Napol Rachatasumrit. Ref-finder: A
refactoring reconstruction tool based on logic query templates. In Proceedings of
the Eighteenth ACM SIGSOFT International Symposium on Foundations of Software
Engineering, FSE ’10, page 371–372, New York, NY, USA, 2010. Association for
Computing Machinery.
[46] Nikolaos Tsantalis, Matin Mansouri, Laleh M. Eshkevari, Davood Mazinanian, and
Danny Dig. Accurate and efficient refactoring detection in commit history. In Pro-
ceedings of the 40th International Conference on Software Engineering, ICSE ’18,
pages 483–494, New York, NY, USA, 2018. ACM.
[47] Iman Hemati Moghadam, Mel Ó Cinnéide, Faezeh Zarepour, and Mohamad Aref
Jahanmir. Refdetect: A multi-language refactoring detection tool based on string
alignment. IEEE Access, 9:86698–86727, 2021.
[48] Jacek Ratzinger, Thomas Sigmund, and Harald C Gall. On the relation of refactorings
and software defect prediction. In Proceedings of the 2008 international working
conference on Mining software repositories, pages 35–38, 2008.
[49] Gustavo Soares, Rohit Gheyi, Dalton Serey, and Tiago Massoni. Making program
refactoring safer. IEEE software, 27(4):52–57, 2010.
[50] Rrezarta Krasniqi and Jane Cleland-Huang. Enhancing source code refactoring de-
tection with explanations from commit messages. pages 512–516, 02 2020.
[51] Xi Ge and Emerson Murphy-Hill. Manual refactoring changes with automated refac-
toring validation. In Proceedings of the 36th International Conference on Software
Engineering, ICSE 2014, page 1095–1105, New York, NY, USA, 5 2014. Association
for Computing Machinery.
[52] Xi Ge, Saurabh Sarkar, Jim Witschey, and Emerson Murphy-Hill. Refactoring-aware
code review. In 2017 IEEE Symposium on Visual Languages and Human-Centric
Computing (VL/HCC), pages 71–79, 2017.
[53] Xi Ge, Quinton DuBose, and Emerson Murphy-Hill. Reconciling manual and auto-
matic refactoring. Proceedings - International Conference on Software Engineering,
pages 211–221, 06 2012.
[54] Stephen R. Foster, William G. Griswold, and Sorin Lerner. Witchdoctor: Ide support
for real-time auto-completion of refactorings. In Proceedings of the 34th International
Conference on Software Engineering, ICSE ’12, page 222–232, Zurich, Switzerland,
6 2012. IEEE Press.
56
[55] Serge Demeyer, Stéphane Ducasse, and Oscar Nierstrasz. Finding refactorings via
change metrics. In Proceedings of the 15th ACM SIGPLAN conference on Object-
oriented programming, systems, languages, and applications, OOPSLA ’00, page
166–177, New York, NY, USA, 10 2000. Association for Computing Machinery.
[56] G. Antoniol, M. Di Penta, and E. Merlo. An automatic approach to identify class
evolution discontinuities. In Proceedings. 7th International Workshop on Principles
of Software Evolution, 2004., pages 31–40, 2004.
[57] Peter Weissgerber and Stephan Diehl. Identifying refactorings from source-code
changes. In 21st IEEE/ACM International Conference on Automated Software En-
gineering (ASE’06), pages 231–240, 2006.
[58] Toshihiro Kamiya, Shinji Kusumoto, and Katsuro Inoue. Ccfinder: A multilinguistic
token-based code clone detection system for large scale source code. IEEE Trans.
Softw. Eng., 28(7):654–670, July 2002.
[59] Danny Dig, Can Comertoglu, Darko Marinov, and Ralph Johnson. Automated detec-
tion of refactorings in evolving components. 07 2006.
[60] A.Z. Broder. On the resemblance and containment of documents. In Proceedings.
Compression and Complexity of SEQUENCES 1997 (Cat. No.97TB100171), pages
21–29, 1997.
[61] Benjamin Biegel, Quinten David Soetens, Willi Hornig, Stephan Diehl, and Serge
Demeyer. Comparison of similarity metrics for refactoring detection. In Proceed-
ings of the 8th Working Conference on Mining Software Repositories, MSR ’11, page
53–62, New York, NY, USA, 2011. Association for Computing Machinery.
[62] Benjamin Biegel and Stephan Diehl. Highly configurable and extensible code clone
detection. In 2010 17th Working Conference on Reverse Engineering, pages 237–241,
2010.
[63] Zhenchang Xing and Eleni Stroulia. Refactoring detection based on umldiff change-
facts queries. In 2006 13th Working Conference on Reverse Engineering, pages 263–
274, 2006.
[64] Zhenchang Xing and Eleni Stroulia. Differencing logical uml models. Autom. Softw.
Eng., 14:215–259, 07 2007.
[65] Zhenchang Xing and Eleni Stroulia. Umldiff: An algorithm for object-oriented design
differencing. In Proceedings of the 20th IEEE/ACM International Conference on
Automated Software Engineering, ASE ’05, page 54–65, New York, NY, USA, 2005.
Association for Computing Machinery.
[66] Kyle Prete, Napol Rachatasumrit, Nikita Sudan, and Miryung Kim. Template-based
reconstruction of complex refactorings. In 2010 IEEE International Conference on
Software Maintenance, pages 1–10, 2010.
57
[67] Martin Fowler. Refactoring: Improving the Design of Existing Code. Addison-
Wesley, Boston, MA, USA, 1999.
[68] Gustavo Soares, Rohit Gheyi, Emerson Murphy-Hill, and Brittany Johnson. Compar-
ing approaches to analyze refactoring activity on software repositories. J. Syst. Softw.,
86(4):1006–1022, April 2013.
[69] Danilo Silva and Marco Tulio Valente. Refdiff: Detecting refactorings in version
histories. In 2017 IEEE/ACM 14th International Conference on Mining Software
Repositories (MSR), pages 269–279, 2017.
[70] Liang Tan and Christoph Bockisch. A survey of refactoring detection tools. In Soft-
ware Engineering (Workshops), pages 100–105, 2019.
[71] Nikolaos Tsantalis, Victor Guana, Eleni Stroulia, and Abram Hindle. A multidimen-
sional empirical study on refactoring activity. In Proceedings of the 2013 Conference
of the Center for Advanced Studies on Collaborative Research, CASCON ’13, page
132–146, USA, 2013. IBM Corp.
[72] Benjamin Biegel, Quinten David Soetens, Willi Hornig, Stephan Diehl, and Serge
Demeyer. Comparison of similarity metrics for refactoring detection. In Proceed-
ings of the 8th Working Conference on Mining Software Repositories, MSR ’11, page
53–62, New York, NY, USA, 2011. Association for Computing Machinery.
[73] Oscar Chaparro, Gabriele Bavota, Andrian Marcus, and Massimiliano Di Penta. On
the impact of refactoring operations on code quality metrics. In 2014 IEEE Interna-
tional Conference on Software Maintenance and Evolution, pages 456–460, 2014.
[74] Gerard Salton and Michael J. McGill. Introduction to Modern Information Retrieval.
McGraw-Hill, Inc., USA, 1986.
[75] Michele Tufano, Fabio Palomba, Gabriele Bavota, Massimiliano Di Penta, Rocco
Oliveto, Andrea De Lucia, and Denys Poshyvanyk. There and back again: Can you
compile that snapshot? Journal of Software: Evolution and Process, 29, 2017.
[76] Rodrigo Brito and Marco Tulio Valente. Refdiff4go: Detecting refactorings in go.
SBCARS ’20, page 101–110, New York, NY, USA, 2020. Association for Computing
Machinery.
[77] Hassan Atwi, Bin Lin, Nikolaos Tsantalis, Yutaro Kashiwa, Yasutaka Kamei, Naoy-
asu Ubayashi, Gabriele Bavota, and Michele Lanza. Pyref: refactoring detection in
python projects. In 2021 IEEE 21st International Working Conference on Source
Code Analysis and Manipulation (SCAM), pages 136–141. IEEE, 2021.
[78] Angana Chakraborty and Sanghamitra Bandyopadhyay. Fogsaa: Fast optimal global
sequence alignment algorithm. Scientific reports, 3(1):1–9, 2013.
58
[79] Tiago L Alves, Christiaan Ypma, and Joost Visser. Deriving metric thresholds from
benchmark data. In 2010 IEEE International Conference on Software Maintenance,
pages 1–10. IEEE, 2010.
[80] Kecia AM Ferreira, Mariza AS Bigonha, Roberto S Bigonha, Luiz FO Mendes, and
Heitor C Almeida. Identifying thresholds for object-oriented software metrics. Jour-
nal of Systems and Software, 85(2):244–257, 2012.
[81] Paloma Oliveira, Marco Tulio Valente, and Fernando Paim Lima. Extracting relative
thresholds for source code metrics. In 2014 Software Evolution Week-IEEE Con-
ference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-
WCRE), pages 254–263. IEEE, 2014.
[82] Francesca Arcelli Fontana, Vincenzo Ferme, Marco Zanoni, and Aiko Yamashita.
Automatic metric thresholds derivation for code smell detection. In 2015 IEEE/ACM
6th International Workshop on Emerging Trends in Software Metrics, pages 44–53.
IEEE, 2015.
[83] Francesca Arcelli Fontana, Mika V Mäntylä, Marco Zanoni, and Alessandro Marino.
Comparing and experimenting machine learning techniques for code smell detection.
Empirical Software Engineering, 21(3):1143–1191, 2016.
[84] Danny Dig and Ralph Johnson. Automated upgrading of component-based appli-
cations. In Companion to the 21st ACM SIGPLAN symposium on Object-oriented
programming systems, languages, and applications, pages 675–676, 2006.
[85] Maurício Aniche, Christoph Treude, Andy Zaidman, Arie Van Deursen, and
Marco Aurélio Gerosa. Satt: Tailoring code metric thresholds for different software
architectures. In 2016 IEEE 16th international working conference on source code
analysis and manipulation (SCAM), pages 41–50. IEEE, 2016.
[86] Laura Moreno, Gabriele Bavota, Massimiliano Di Penta, Rocco Oliveto, Andrian
Marcus, and Gerardo Canfora. Arena: an approach for the automated generation
of release notes. IEEE Transactions on Software Engineering, 43(2):106–127, 2016.
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