Improving Code Effectiveness Through Refactoring: A Case Study

Main Article Content

Abdullah Almogahed
Manal Othman
Mazni Omar
Samera Obaid Barraood
Abdul Rehman Gilal

Abstract

Software refactoring is a crucial practice in modern software development methodologies, such as Agile and DevOps, as it enables teams to iteratively improve and evolve their codebases while minimizing the risk of introducing bugs or regressions. It fosters a culture of continuous improvement and code hygiene, ultimately leading to more robust, maintainable, and scalable software systems. However, research examining the impact of refactoring on code effectiveness is scarce. This study, therefore, seeks to investigate the impact of refactoring methods on the code’s effectiveness. The study was carried out in four distinct phases: refactoring methods selection, case study selection, software metric selection for evaluating the effectiveness of the code, and refactoring methods implementation. The five most prevalent refactoring methods (Extract Subclass, Extract Class, Introduce Parameter Object, Extract Method, and Move Method) were chosen and implemented in the jHotDraw case study. The refactoring methods were implemented 86 times across five experiments in the jHotDraw case study. The results indicate that Extract Subclass, Extract Class, and Introduce Parameter Object have a significant positive impact on code effectiveness, while Extract Method and Move Method do not affect code effectiveness. Practitioners and software designers can utilize this knowledge to make informed assessments regarding refactoring methods and produce software systems that are more reliable and effective.

Article Details

How to Cite
Almogahed, A., Othman, M., Omar, M., Barraood, S. O., & Gilal, A. R. (2025). Improving Code Effectiveness Through Refactoring: A Case Study. Journal of Informatics and Web Engineering, 4(3), 427–440. https://doi.org/10.33093/jiwe.2025.4.3.26
Section
Thematic (AI-Enhanced Computing and Digital Transformation)

References

M. Fowler and K. Beck, Refactoring: Improving the Design of Existing Code, 2nd ed. Boston, MA, USA: Addison-Wesley Professional, 2019.

A. Almogahed, H. Mahdin, M. Omar, N. H. Zakaria, G. Muhammad, and Z. Ali, “Optimized refactoring mechanisms to improve quality characteristics in object-oriented systems,” IEEE Access, vol. 11, pp. 99143–99158, 2023, doi: 10.1109/ACCESS.2023.3313186.

E. A. AlOmar et al., “How do developers refactor code to improve code reusability?,” in Lecture Notes in Computer Science, vol. 12541. Cham, Switzerland: Springer, 2020, doi: 10.1007/978-3-030-64694-3_16.

H. Mumtaz, P. Singh, and K. Blincoe, “Identifying refactoring opportunities for large packages by analyzing maintainability characteristics in Java OSS,” J. Syst. Softw., vol. 202, no. 111717, 2023, doi: 10.1016/j.jss.2023.111717.

C. Abid, V. Alizadeh, M. Kessentini, N. Ferreira, and D. Dig, “30 years of software refactoring research: A systematic literature review,” arXiv preprint arXiv:2007.02194, 2020, doi: 10.48550/arXiv.2007.02194.

Y. Zhao, Y. Yang, Y. Zhou, and Z. Ding, “DEPICTER: A design-principle guided and heuristic-rule constrained software refactoring approach,” IEEE Trans. Reliab., vol. 71, no. 2, pp. 698–715, Jun. 2022, doi: 10.1109/TR.2022.3159851.

G. Lacerda, F. Petrillo, M. Pimenta, and Y. Gael, “Code smells and refactoring: A tertiary systematic review of challenges and observations,” J. Syst. Softw., vol. 167, no. 110610, 2020, doi: 10.1016/j.jss.2020.110610.

E. Fernandes et al., “Refactoring effect on internal quality attributes: What haven’t they told you yet?,” Inf. Softw. Technol., vol. 126, 2020, doi: 10.1016/j.infsof.2020.106347.

Almogahed, M. Omar, and N. H. Zakaria, “Recent studies on the effects of refactoring in software quality: Challenges and open issues,” in Proc. 2nd Int. Conf. Emerg. Smart Technol. Appl. (eSmarTA), 2022, pp. 1–7, doi: 10.1109/eSmarTA56775.2022.9935361.

A. Almogahed et al., “Revisiting scenarios of using refactoring techniques to improve software systems quality,” IEEE Access, vol. 11, pp. 28800–28819, 2023, doi: 10.1109/ACCESS.2022.3218007.

A. Almogahed et al., “Empirical investigation of the diverse refactoring effects on software quality: The role of refactoring tools and software size,” in Proc. 3rd Int. Conf. Emerg. Smart Technol. Appl. (eSmarTA), 2023, pp. 1–6, doi: 10.1109/eSmarTA59349.2023.10293407.

F. Palomba, A. Zaidman, R. Oliveto, and D. A. Lucia, “An exploratory study on the relationship between changes and refactoring,” in Proc. 25th Int. Conf. Program Comprehension (ICPC), IEEE, 2017, doi: 10.1109/ICPC.2017.38.

G. Bavota et al., “An experimental investigation on the innate relationship between quality and refactoring,” J. Syst. Softw., vol. 107, pp. 1–14, 2015, doi: 10.1016/j.jss.2015.05.024.

A.S. Nyamawe, “Mining commit messages to enhance software refactorings recommendation: A machine learning approach,” Mach. Learn. Appl., vol. 9, 2022, doi: 10.1016/j.mlwa.2022.100316.

V. Alizadeh et al., “RefBot: Intelligent software refactoring bot,” in Proc. 34th IEEE/ACM Int. Conf. Autom. Softw. Eng. (ASE), 2019, pp. 823–834, doi: 10.1109/ASE.2019.00081.

L. Sousa et al., “Characterizing and identifying composite refactorings: Concepts, heuristics and patterns,” in Proc. 17th Int. Conf. Mining Softw. Repositories (ICSE), 2020, Seoul, Korea, doi: 10.1145/3379597.3387477.

A. Almogahed, M. Omar, and N. H. Zakaria, “Categorization refactoring techniques based on their effect on software quality attributes,” Int. J. Innov. Technol. Exploring Eng. (IJITEE), vol. 8, no. 8S, pp. 439–445, 2019. [Online]. Available: https://www.ijitee.org/wp-content/uploads/papers/v8i8s/H10760688S19.pdf

A. Almogahed et al., “Empirical studies on software refactoring techniques in the industrial setting,” Turkish J. Comput. Math. Educ. (TURCOMAT), vol. 12, no. 3, pp. 1705–1716, 2021, doi: 10.17762/turcomat.v12i3.995.

A. Almogahed et al., “Software security measurements: A survey,” in Proc. Int. Conf. Intell. Technol. Syst. Service Internet Everything (ITSS-IoE), 2022, pp. 1–6, doi: 10.1109/ITSS-IoE56359.2022.9990968.

A. Almogahed, M. Omar, and N. H. Zakaria, “Impact of software refactoring on software quality in the industrial environment: A review of empirical studies,” in Proc. Knowl. Manag. Int. Conf. (KMICe), Sarawak, Malaysia, 2018, pp. 229–234. [Online]. Available: http://soc.uum.edu.my/kmice/proceedings/proc/2018/pdf/CR61.pdf

R. Faqih et al., “Empirical analysis of CI/CD tools usage in GitHub Actions workflows,” J. Informatics Web Eng., vol. 3, no. 2, pp. 251–261, 2024, doi: 10.33093/jiwe.2024.3.2.18.

D. Feitosa et al., “Code reuse in practice: Benefiting or harming technical debt,” J. Syst. Softw., vol. 167, no. 110848, 2020, doi: 10.1016/j.jss.2020.110848.

N. Makitalo et al., “On opportunistic software reuse,” Computing, vol. 102, pp. 2385–2408, 2020, doi: 10.1007/s00607-020-00833-6.

E. A. AlOmar et al., “Refactoring for reuse: An empirical study,” Innov. Syst. Softw. Eng., vol. 18, pp. 105–135, 2022, doi: 10.1007/s11334-021-.

R. Moser et al., “A case study on the impact of refactoring on quality and productivity in an agile team,” in Proc. 2nd IFIP Central Eur. Conf. Softw. Eng. Tech. (CEE-SET), 2007, pp. 252–266, doi: 10.1007/978-3-540-85279-7_20.

C. Dibble and P. Gestwicki, “Refactoring code to increase readability and maintainability: A case study,” J. Comput. Sci. Colleges, vol. 30, no. 1, pp. 41–51, 2014. [Online]. Available: https://dl.acm.org/doi/abs/10.5555/2667369.2667378

N. Niu et al., “Traceability-enabled refactoring for managing just-in-time requirements,” in Proc. IEEE 22nd Int. Requirements Eng. Conf. (RE), 2014, pp. 133–142, doi: 10.1109/RE.2014.6912255.

C. Abid et al., “X-SBR: On the use of the history of refactorings for explainable search-based refactoring and intelligent change operators,” IEEE Trans. Softw. Eng., vol. 48, no. 10, pp. 3753–3770, Oct. 2022, doi: 10.1109/TSE.2021.3105037.

R. Malhotra and J. Jain, “Analysis of refactoring effect on software quality of object-oriented systems,” in Proc. Int. Conf. Innov. Comput. Commun., 2019, pp. 197–212, doi: 10.1007/978-981-13-2354-6.

I. Alazzam, B. Abuata, and G. Mhediat, “Impact of refactoring on OO metrics: A study on extract class, extract superclass, encapsulate field and pull-up method,” Int. J. Mach. Learn. Comput., vol. 10, no. 1, 2020, doi: 10.18178/ijmlc.2020.10.1.913.

A. Almogahed and M. Omar, “Refactoring techniques for improving software quality: A practitioners’ perspectives,” J. Inf. Commun. Technol. (JICT), vol. 20, no. 4, pp. 511–539, 2021, doi: 10.32890/jict2021.20.4.3.

J. Abid et al., “How does refactoring impact security when improving quality? A security-aware refactoring approach,” IEEE Trans. Softw. Eng., vol. 48, no. 3, pp. 864–878, Mar. 2022, doi: 10.1109/TSE.2020.3005995.

Al Dallal and A. Abdin, “Empirical evaluation of the impact of object-oriented code refactoring on quality attributes: A systematic literature review,” IEEE Trans. Softw. Eng., vol. 44, no. 1, pp. 44–69, 2018, doi: 10.1109/TSE.2017.2658573.

S. Kaur and P. Singh, “How does object-oriented code refactoring influence software quality? Research landscape and challenges,” J. Syst. Softw., vol. 157, no. 110394, 2019, doi: 10.1016/j.jss.2019.110394.

A. Almogahed et al., “A refactoring classification framework for efficient software maintenance,” IEEE Access, vol. 11, pp. 78904–78917, 2023, doi: 10.1109/ACCESS.2023.3298678.

A. Almogahed et al., “A refactoring categorization model for software quality improvement,” PLoS ONE, vol. 18, no. 11, e0293742, 2023, doi: 10.1371/journal.pone.0293742.

A. Almogahed et al., “Multi-classification refactoring framework using Hopfield neural network for sustainable software development,” IEEE Access, vol. 13, pp. 31785–31808, 2025, doi: 10.1109/ACCESS.2025.3542087.

Almogahed et al., “Code refactoring for software reusability: An experimental study,” in Proc. 4th Int. Conf. Emerg. Smart Technol. Appl. (eSmarTA), 2024, pp. 1–6, doi: 10.1109/eSmarTA62850.2024.10638872.

G. Szoke et al., “Empirical study on refactoring large-scale industrial systems and its effects on maintainability,” J. Syst. Softw., vol. 129, pp. 107–126, 2017, doi: 10.1016/j.jss.2016.08.071.

Y. Lin et al., “Interactive and guided architectural refactoring with search-based recommendation,” in Proc. 24th ACM SIGSOFT Int. Symp. Found. Softw. Eng., 2016, pp. 535–546, doi: 10.1145/2950290.2950317.

E. Ammerlaan, W. Veninga, and A. Zaidman, “Old habits die hard: Why refactoring for understandability does not give immediate benefits,” in Proc. 22nd IEEE Int. Conf. Softw. Anal. Evol. Reeng. (SANER), 2015, pp. 504–507, doi: 10.1109/SANER.2015.7081865.

M. Gatrell and S. Counsell, “The effect of refactoring on change and fault-proneness in commercial C# software,” Sci. Comput. Program., vol. 102, pp. 44–56, 2015, doi: 10.1016/j.scico.2014.12.002.

A. Ouni et al., “A multi-objective refactoring approach to introduce design patterns and fix anti-patterns,” in Proc. North Amer. Search-Based Softw. Eng. Symp. (NASBASE), 2015. [Online]. Available: https://kir.ics.es.osaka-u.ac.jp/lab-db/betuzuri/archive/990/990.pdf

M. Wahler, U. Drofenik, and W. Snipes, “Improving code maintainability: A case study on the impact of refactoring,” in Proc. IEEE Int. Conf. Softw. Maint. Evol. (ICSME), 2016, pp. 493–501, doi: 10.1109/ICSME.2016.52.

R. S. Bashir et al., “A methodology for impact evaluation of refactoring on external quality attributes of a software design,” in Proc. Int. Conf. Front. Inf. Technol. (FIT), 2017, pp. 183–188, doi: 10.1109/FIT.2017.00040.

A. Chavez et al., “How does refactoring affect internal quality attributes? A multi-project study,” in Proc. 31st Brazilian Symp. Softw. Eng., 2017, pp. 74–83, doi: 10.1145/3131151.313117.

B. Mourad et al., “Exploring the impact of clone refactoring on test code size in object-oriented software,” in Proc. 16th IEEE Int. Conf. Mach. Learn. Appl. (ICMLA), 2017, pp. 586–592, doi: 10.1109/ICMLA.2017.00098.

A. Almogahed, M. Omar, and N. H. Zakaria, “Refactoring codes to improve software security requirements,” Procedia Comput. Sci., vol. 204, pp. 108–115, 2022, doi: 10.1016/j.procs.2022.08.013.

H. Mumtaz et al., “An empirical study to improve software security through the application of code refactoring,” Inf. Softw. Technol., vol. 96, pp. 112–125, 2018, doi: 10.1016/j.infsof.2017.11.010.

B. Alshammari, C. Fidge, and D. Corney, “A hierarchical security assessment model for object-oriented programs,” in Proc. 11th Int. Conf. Quality Softw., 2011, pp. 218–227, doi: 10.1109/QSIC.2011.31.

Rajput and A. Chug, “An inclusive survey on automation of refactoring: Challenges and opportunities,” Int. J. Syst. Assur. Eng. Manag., 2025, doi: 10.1007/s13198-025-02914-1.

Y. Zhang et al., “Move method refactoring recommendation based on deep learning and LLM-generated information,” Inf. Sci., vol. 697, p. 121753, 2025, doi: 10.1016/j.ins.2024.121753.

jHotDraw Files. [Online]. Available: https://sourceforge.net/projects/jhotdraw/files (accessed Jan. 12, 2025).

Bansiya and C. G. Davis, “A hierarchical model for object-oriented design quality assessment,” IEEE Trans. Softw. Eng., vol. 28, no. 1, pp. 4–17, 2002, doi: 10.1109/32.979986.

Metrics 3 – Eclipse Metrics Plugin Continued ‘Again’. [Online]. Available: https://github.com/qxo/eclipse-metrics-plugin (accessed Sep. 9, 2024).

JDeodorant. [Online]. Available: https://marketplace.eclipse.org/content/jdeodorant (accessed Apr. 5, 2025).