A Survey and Evaluating Types of Code Amells in Software Pprogram Code Rrefactoring Process

Document Type : Original Article

Authors

Software group, Computer , network and communication faculty, Imam Hossein Comprehensive University, Tehran, Iran

Abstract

Code smells are common characteristics in programming that may indicate the presence of an issue within the program. Detecting and identifying code smells is one of the key factors in software development, as it can improve quality of the program and make it easier to maintain and extend the code over time. Passive defense in software refers to a set of measures taken to increase the security and reduce the vulnerability of software against threats. These measures include secure design, the use of appropriate architectural  patterns, and avoiding unnecessary complexity in the software code. It is obvious that one of the most  effective ways to increase the quality of the software is to reconstructing or refactoring the code, which has a direct relationship with identification and repair of code smells. So far, a lot of research has been done in the field of identifying and removing code smells of software systems. However, among them, four types of code smell include; Long method, feature envy, large class and data class have attracted the most attention of researchers. In this article, by reviewing 58 code smells found in the software source code, they are  classified into eight categories: Bloaters, Abusers, Change preventers, Dispensables, Couplers, Obfuscators, Data dealers and other code smells that are not placed in the mentioned categories, and while examining each one, they are presented as a new taxonomy. This article helps developers and software   development teams to produce high quality and more efficient softwares by identifying and resolving code smells.
 

Keywords


Smiley face

[1]   Y. Zhang, C. Ge, H. Liu, and K. Zheng, “Code smell detection based on supervised learning models: A survey,” Neurocomputing, vol. 565, p. 127014, 2024, https://doi.org/10.1016/j.neucom.2023.127014
[2]   A. Abdou and N. Darwish, “Severity classification of software code smells using machine learning techniques: A comparative study,” J. Softw. (Malden), vol. 36, no. 1, p. e2454, 2024, https://doi.org/10.1002/smr.2454
[3]   M. Fowler, “Refactoring: improving the design of existing code.” Addison-Wesley Professional, 2018.
[4]   F. A. Fontana, M. V. Mäntylä, M. Zanoni, and A. Marino, “Comparing and experimenting machine learning techniques for code smell detection,” Empir. Softw. Eng., vol. 21, pp. 1143-1191, 2016, http://dx.doi.org/10.1007/s10664-015-9378-4
[5]   C. Marinescu, R. Marinescu, P. Mihancea, D. Ratiu, and R. Wettel, “iPlasma: An Integrated Platform for Quality Assessment of Object-Oriented Design.[C],” IEEE Int. Conf. Softw. Maint. Ind. Tool Vol., 2005: DBLP.
[6]   F. Palomba, R. Oliveto, and A. De Lucia, “Investigating code smell co-occurrences using association rule learning: A replicated study,” 2017 IEEE Workshop Mach. Learn. Tech. Softw. Qual. Eval. (MaLTeSQuE), 2017: IEEE, pp. 8-13, https://doi.org/10.1109/MALTESQUE.2017.7882010
[7]   A. Garg, M. Gupta, G. Bansal, B. Mishra, and V. Bajpai, “Do bad smells follow some pattern?,” Proc. Int. Congr. Inf. Commun. Technol. (ICICT), 2016: Springer, pp. 39-46, http://dx.doi.org/10.1007/978-981-10-0767-5_5
[8]   J. Wang, J. Chen, and J. Gao, “ECC Multi-Label Code Smell Detection Method Based on Ranking Loss,” J. Comput. Res. Dev., vol. 58, no. 1, pp. 178-188, 2021, https://dx.doi.org/10.7544/issn1000-1239.2021.20190836
[9]   K. Kaur and S. Jain, “Evaluation of machine learning approaches for change-proneness prediction using code smells,” Proc. 5th Int. Conf. Front. Intell. Comput.  (FICTA), 2017: Springer, pp. 561-572, http://dx.doi.org/10.1007/978-981-10-3153-3_56
[10] R. Wieman, “Anti-pattern Scanner: an approach to detect anti-patterns and design violations.” LAP Lambert Academic Publishing, 2011.
[11] T. F. M. Sirqueira, A. H. M. Brandl, E. J. P. Pedro, R. de Souza Silva, and M. A. P. Araujo, “Code smell analyzer: a tool to teaching support of refactoring techniques source code,” IEEE Lat. Am. Trans., vol. 14, no. 2, pp. 877-884, 2016, https://doi.org/10.1109/TLA.2016.7437235
[12] G. Szőke, C. Nagy, L. J. Fülöp, R. Ferenc, and T. Gyimóthy, “FaultBuster: An automatic code smell refactoring toolset,” 2015 IEEE 15th Int. Work. Conf. Source Code Anal. Manip. (SCAM), 2015: IEEE, pp. 253-258, https://doi.org/10.1109/SCAM.2015.7335422
[13] A. AbuHassan, M. Alshayeb, and L. Ghouti, “Software smell detection techniques: A systematic literature review,” J. Softw. (Malden), vol. 33, no. 3, p. e2320, 2021, https://doi.org/10.1002/smr.2320
[14] M. Jerzyk and L. Madeyski, “Code Smells: A Comprehensive Online Catalog and Taxonomy,” in Developments in Information and Knowledge Management Systems for Business Applications: Volume 7: Springer, 2023, pp. 543-576.
[15] S. Dewangan, R. S. Rao, A. Mishra, and M. Gupta, “A novel approach for code smell detection: an empirical study,” IEEE Access, vol. 9, pp. 162869-162883, 2021, https://doi.org/10.1109/ACCESS.2021.3133810
[16] G. Lacerda, F. Petrillo, M. Pimenta, and Y. G. Guéhéneuc, “Code smells and refactoring: A tertiary systematic review of challenges and observations,” J. Syst. Softw., vol. 167, p. 110610, 2020, https://doi.org/10.1016/j.jss.2020.110610
[17] R. Sandouka and H. Aljamaan, “Python code smells detection using conventional machine learning models,” PeerJ Comput. Sci., vol. 9, p. e1370, 2023, https://doi.org/10.7717/peerj-cs.1370
[18] N. Vatanapakorn, C. Soomlek, and P. Seresangtakul, “Python code smell detection using machine learning,” 2022 26th Int. Comput. Sci. Eng. Conf. (ICSEC), 2022: IEEE, pp. 128-133, https://doi.org/10.1109/ICSEC56337.2022.10049330
[19] A. S. Abdou and N. R. Darwish, “Early prediction of software defect using ensemble learning: A comparative study,” Int. J. Comput. Appl., vol. 179, no. 46, pp. 29-40, 2018, http://dx.doi.org/10.5120/ijca2018917185
[20] E. V. de Paulo Sobrinho, A. De Lucia, and M. de Almeida Maia, “A systematic literature review on bad smells–5 w's: which, when, what, who, where,” IEEE Trans. Softw. Eng., vol. 47, no. 1, pp. 17-66, 2018, https://doi.org/10.1109/TSE.2018.2880977
[21] Y. Tian, K. Li, T. Wang, Q. Jiao, G. Li, Y. Zhang, and H. Liu, “Survey on Code Smells. Ruan Jian Xue Bao,” J. Softw., vol. 34, no. 1, pp. 150-170, 2023, http://dx.doi.org/10.13328/j.cnki.jos.006431
[22] F. L. Caram, B. R. D. O. Rodrigues, A. S. Campanelli, and F. S. Parreiras, “Machine learning techniques for code smells detection: a systematic mapping study,” Int. J. Softw. Eng. Knowl. Eng., vol. 29, no. 02, pp. 285-316, 2019, https://doi.org/10.1142/S021819401950013X
[23] M. I. Azeem, F. Palomba, L. Shi, and Q. Wang, “Machine learning techniques for code smell detection: A systematic literature review and meta-analysis,” Inf. Softw. Technol., vol. 108, pp. 115-138, 2019, https://doi.org/10.1016/j.infsof.2018.12.009
[24] S. S. Rathore and S. Kumar, “A study on software fault prediction techniques,” Artif. Intell. Rev., vol. 51, pp. 255-327, 2019, https://doi.org/10.1007/s10462-017-9563-5
[25] S. Jain and A. Saha, “Improving performance with hybrid feature selection and ensemble machine learning techniques for code smell detection,” Sci. Comput. Program., vol. 212, p. 102713, 2021, https://doi.org/10.1016/j.scico.2021.102713
[26] M. Tufano, F. Palomba, G. Bavota, R. Oliveto, M. Di Penta, A. De Lucia, and D. Poshyvanyk, “When and why your code starts to smell bad,” 2015 IEEE/ACM 37th IEEE Int. Conf. Softw. Eng., 2015, vol. 1: IEEE, pp. 403-414, https://doi.org/10.1109/ICSE.2015.59
[27] A. Gupta, B. Suri, and S. Misra, “A systematic literature review: code bad smells in java source code,” 17th Int. Conf. Comput. Sci. Appl. (ICCSA), 2017: Springer, pp. 665-682, http://dx.doi.org/10.1007/978-3-319-62404-4_49
[28] D. Mahalakshmi, P. Kasinathan, D. Elangovan, C. R. Bhat, M. Balamurugan, and S. Sivakumar, “Code Smell Detection using Hybrid Machine Learning Algorithms,” 2023 5th Int. Conf. Inventive Res. Comput. Appl. (ICIRCA), 2023: IEEE, pp. 633-638, https://doi.org/10.1109/ICIRCA57980.2023.10220911
[29] S. Subedi, “Intelligent Code Smell Detection System Using Deep Learning,” Pulchowk Campus, 2021.
[30] M. Fowler, “Refactoring: Improving the Design of Existing Code.” Addison Wesley, 1999.
[31] F. Palomba, G. Bavota, M. Di Penta, F. Fasano, R. Oliveto, and A. De Lucia, “On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation,” Proc. 40th Int. Conf. Softw. Eng., 2018, pp. 482-482, https://doi.org/10.1145/3180155.3182532
[32] A. Tahir, S. Counsell, and S. G. MacDonell, “An empirical study into the relationship between class features and test smells,” 2016 23rd Asia-Pacific Softw. Eng. Conf. (APSEC), 2016: IEEE, pp. 137-144, https://doi.org/10.1109/APSEC.2016.029
[33] N. Tsantalis and A. Chatzigeorgiou, “Identification of move method refactoring opportunities,” IEEE Trans. Softw. Eng., vol. 35, no. 3, pp. 347-367, 2009, https://doi.org/10.1109/TSE.2009.1
[34] N. Moha, Y.-G. Guéhéneuc, L. Duchien, and A.-F. Le Meur, “Decor: A method for the specification and detection of code and design smells,” IEEE Trans. Softw. Eng., vol. 36, no. 1, pp. 20-36, 2009, https://doi.org/10.1109/TSE.2009.50
[35] D. A. Tamburri, F. Palomba, A. Serebrenik, and A. Zaidman, “Discovering community patterns in open-source: a systematic approach and its evaluation,” Empir. Softw. Eng., vol. 24, pp. 1369-1417, 2019, https://doi.org/10.1007/s10664-018-9659-9
[36] F. Khomh, M. D. Penta, Y.-G. Guéhéneuc, and G. Antoniol, “An exploratory study of the impact of antipatterns on class change-and fault-proneness,” Empir. Softw. Eng., vol. 17, pp. 243-275, 2012, http://dx.doi.org/10.1007/s10664-011-9171-y
[37] J. Garcia, D. Popescu, G. Edwards, and N. Medvidovic, “Toward a catalogue of architectural bad smells,” Archit. Adapt. Softw. Syst., 2009: Springer, pp. 146-162, https://doi.org/10.1007/978-3-642-02351-4_10
[38] G. Suryanarayana, G. Samarthyam, and T. Sharma, “Refactoring for software design smells: managing technical debt.” Morgan Kaufmann, 2014.
[39] T. Sharma, M. Fragkoulis, and D. Spinellis, “House of cards: Code smells in open-source c# repositories,” 2017 ACM/IEEE Int. Symp. Empir. Softw. Eng. Meas. (ESEM), 2017: IEEE, pp. 424-429, https://doi.org/10.1109/ESEM.2017.57
[40] E. Jabrayilzade, O. Gürkan, and E. Tüzün, “Towards a taxonomy of inline code comment smells,” 2021 IEEE 21st Int. Work. Conf. Source Code Anal. Manip. (SCAM), 2021: IEEE, pp. 131-135, https://doi.org/10.1109/SCAM52516.2021.00024
[41] R. C. Martin, “Clean code: a handbook of agile software craftsmanship.” Pearson Education, 2009.
[42] V. Arnaoudova, M. Di Penta, G. Antoniol, and Y.-G. Guéhéneuc, “A new family of software anti-patterns: Linguistic anti-patterns,” 2013 17th Eur. Conf. Softw. Maint. Reeng., 2013: IEEE, pp. 187-196, https://doi.org/10.1109/CSMR.2013.28
[43] A. Vetro, L. Ardito, G. Procaccianti, and M. Morisio, “Definition, implementation and validation of energy code smells: an exploratory study on an embedded system,” Third Int. Conf. Smart Grids Green Commun. IT Energy-aware Technol., 2013, pp. 34-39.
[44] C. U. Smith and L. G. Williams, “More new software performance antipatterns: Even more ways to shoot yourself in the foot,” Comput. Meas. Group Conf., 2003: Citeseer, pp. 717-725.
[45] C. U. Smith and L. G. Williams, “New software performance antipatterns: More ways to shoot yourself in the foot,” Int. CMG Conf., 2002, pp. 667-674.
[46] M. Tufano, F. Palomba, G. Bavota, M. Di Penta, R. Oliveto, A. De Lucia, and D. Poshyvanyk, “An empirical investigation into the nature of test smells,” Proc. 31st IEEE/ACM Int. Conf. Autom. Softw. Eng., 2016, pp. 4-15, https://doi.org/10.1145/2970276.2970340
[47] H. Mumtaz, M. Alshayeb, S. Mahmood, and M. Niazi, “A survey on UML model smells detection techniques for software refactoring,” J. Softw. (Malden), vol. 31, no. 3, p. e2154, 2019, https://doi.org/10.1002/smr.2154
[48] T. Arendt and G. Taentzer, “UML model smells and model refactorings in early software development phases,” Universitat Marburg, 2010.
[49] E. Doğan and E. Tüzün, “Towards a taxonomy of code review smells,” Inf. Softw. Technol., vol. 142, p. 106737, 2022, https://doi.org/10.1016/j.infsof.2021.106737
[50] F. Palomba, D. A. Tamburri, A. Serebrenik, A. Zaidman, F. A. Fontana, and R. Oliveto, “Poster: How Do Community Smells Influence Code Smells?,” 2018 IEEE/ACM 40th Int. Conf. Softw. Eng. Companion (ICSE-Companion), 2018: IEEE, pp. 240-241.
[51] K. A. Qamar, E. Sülün, and E. Tüzün, “Towards a taxonomy of bug tracking process smells: A quantitative analysis,” 2021 47th Euromicro Conf. Softw. Eng. Adv. Appl. (SEAA), 2021: IEEE, pp. 138-147, https://doi.org/10.1109/SEAA53835.2021.00026
[52] T. Sharma, M. Fragkoulis, and D. Spinellis, “Does your configuration code smell?,” Proc. 13th Int. Conf. Min. Softw. Repos., 2016, pp. 189-200, https://doi.org/10.1145/2901739.2901761
[53] T. Sharma, “Presentation smells: How not to prepare your conference presentation,” ed, 2016.
[54] F. Hermans, M. Pinzger, and A. Van Deursen, “Detecting and visualizing inter-worksheet smells in spreadsheets,” 2012 34th Int. Conf. Softw. Eng. (ICSE), 2012: IEEE, pp. 441-451, https://doi.org/10.1109/ICSE.2012.6227171
[55] B. Karwin, “SQL Antipatterns: Avoiding the pitfalls of database programming,” Pragmat. Bookshelf, pp. 15-155, 2010.
[56] D. Almeida, J. C. Campos, J. Saraiva, and J. C. Silva, “Towards a catalog of usability smells,” Proc. 30th Annu. ACM Symp. Appl. Comput., 2015, pp. 175-181, https://doi.org/10.1145/2695664.2695670
[57] A. Carette, M. A. A. Younes, G. Hecht, N. Moha, and R. Rouvoy, “Investigating the energy impact of android smells,” 2017 IEEE 24th Int. Conf. Softw. Anal. Evol. Reeng. (SANER), 2017: IEEE, pp. 115-126, https://doi.org/10.1109/SANER.2017.7884614
[58] M. Ghafari, P. Gadient, and O. Nierstrasz, “Security smells in android,” 2017 IEEE 17th Int. Work. Conf. Source Code Anal. Manip. (SCAM), 2017: IEEE, pp. 121-130, https://doi.org/10.1109/SCAM.2017.24
[59] M. Stijlaart and V. Zaytsev, “Towards a taxonomy of grammar smells,” Proc. 10th ACM SIGPLAN Int. conf. Softw. Lang. Eng., 2017, pp. 43-54, https://doi.org/10.1145/3136014.3136035
[60] N. Kryvinska, M. Greguš, and S. Fedushko, “Developments in Information and Knowledge Management Systems for Business Applications: Volume 7.” Springer Nature, 2023.
[61] K. Alkharabsheh, Y. Crespo, E. Manso, and J. A. Taboada, “Software design smell detection: a systematic mapping study,” Softw. Qual. J., vol. 27, pp. 1069-1148, 2019, https://doi.org/10.1007/s11219-018-9424-8
[62] M. V. Mäntylä and C. Lassenius, “Subjective evaluation of software evolvability using code smells: An empirical study,” Empir. Softw. Eng., vol. 11, pp. 395-431, 2006, http://dx.doi.org/10.1007/s10664-006-9002-8
[63] A. Al-Shaaby, H. Aljamaan, and M. Alshayeb, “Bad smell detection using machine learning techniques: a systematic literature review,” Arab. J. Sci. Eng., vol. 45, no. 4, pp. 2341-2369, 2020, https://doi.org/10.1007/s13369-019-04311-w
[64] M. Mantyla, “Bad smells in software-a taxonomy and an empirical study,” PhD thesis, Helsinki University of Technology, 2003.
[65] A. Kaur, “A systematic literature review on empirical analysis of the relationship between code smells and software quality attributes,” Arch. Comput. Methods Eng., vol. 27, no. 4, pp. 1267-1296, 2020, https://doi.org/10.1007/s11831-019-09348-6
[66] A. Kaur, S. Jain, S. Goel, and G. Dhiman, “WITHDRAWN: Prioritization of code smells in object-oriented software: A review,” ed: Elsevier, 2021. https://doi.org/10.1016/j.matpr.2020.11.218
[67] F. Sabir, F. Palma, G. Rasool, Y. G. Guéhéneuc, and N. Moha, “A systematic literature review on the detection of smells and their evolution in object‐oriented and service‐oriented systems,” Softw. Pract. Exp., vol. 49, no. 1, pp. 3-39, 2019, https://doi.org/10.1002/spe.2639
[68] R. Marticorena, C. López, and Y. Crespo, “Extending a taxonomy of bad code smells with metrics,” Proc. 7th Int. Workshop Object Oriented Reeng. (WOOR), 2006: Citeseer, p. 6.
[69] P. Khamkhiaw, C. Doungsa-ard, and P. Phannachitta, “The Source Code Maintenance Time Classifications from Code Smell,” Int. Conf. Emerg. Internetwork. Data Web Technol., 2023: Springer, pp. 22-32, https://doi.org/10.1007/978-3-031-26281-4_3
[70] M. S. Haque, J. Carver, and T. Atkison, “Causes, impacts, and detection approaches of code smell: a survey,” Proc. ACMSE 2018 Conf., 2018, pp. 1-8, https://doi.org/10.1145/3190645.3190697
[71] M. Martin and R. C. Martin, “Agile principles, patterns, and practices in C.” Pearson Education, 2006.
[72] W. C. Wake, “Refactoring workbook.” Addison-Wesley Professional, 2004.
[73] G. Saranya, D. Mishra, V. Srikar, C. Abhilash, and S. Dooda, “Code Smell Detection Using a Weighted Cockroach Swarm Optimization Algorithm,” 2023 14th Int. Conf. Comput. Commun. Netw. Technol. (ICCCNT), 2023: IEEE, pp. 1-8, https://doi.org/10.1109/ICCCNT56998.2023.10306683
[74] S. Jain and A. Saha, “Rank-based univariate feature selection methods on machine learning classifiers for code smell detection,” Evol. Intell., vol. 15, no. 1, pp. 609-638, 2022, https://doi.org/10.1007/s12065-020-00536-z
[75] L. Bamizadeh, B. Kumar, A. Kumar, and S. Shirwaikar, “Design and Implementation of a Web-Based Application for Code Smells Repository,” Tehnički glasnik, vol. 15, no. 3, pp. 371-380, 2021, https://doi.org/10.31803/tg-20210207102610
[76] Z. Yu and V. Rajlich, “Hidden dependencies in program comprehension and change propagation,” Proc. 9th Int. Workshop Program Comprehension (IWPC) 2001: IEEE, pp. 293-299, https://doi.org/10.1109/WPC.2001.921739
[77] S. McConnell, “Code complete.” Pearson Education, 2004.
[78] M. Alharbi and M. Alshayeb, “A Comparative Study of Automated Refactoring Tools,” IEEE Access, 2024, https://doi.org/10.1109/ACCESS.2024.3361314
[79] T. Mens and T. Tourwé, “A survey of software refactoring,” IEEE Trans. Softw. Eng., vol. 30, no. 2, pp. 126-139, 2004, https://doi.org/10.1109/TSE.2004.1265817
  • Receive Date: 01 June 2024
  • Revise Date: 24 August 2024
  • Accept Date: 23 February 2025
  • Publish Date: 19 April 2025