Abstract
The accurate removal of code smells from source code supports activities such as refactoring, maintenance, examining code quality etc. A large number of techniques and tools are presented for the specification and detection of code smells from source code in the last decade, but they still lack accuracy and flexibility due to different interpretations of code smell definitions. Most techniques target just detection of few code smells and render different results on the same examined systems due to different informal definitions and threshold values of metrics used for detecting code smells. We present a flexible and lightweight approach based on multiple searching techniques for the detection and visualization of all 22 code smells from source code of multiple languages. Our approach is lightweight and flexible due to application of SQL queries on intermediate repository and use of regular expressions on selected source code constructs. The concept of approach is validated by performing experiments on eight publicly available open source software projects developed using Java and C# programming languages, and results are compared with existing approaches. The accuracy of presented approach varies from 86–97 % on the eight selected software projects.
Similar content being viewed by others
References
Abbes, M.; Khomh, F.; Guéhéneuc, Y.G.; Antoniol, G.: An empirical study of the impact of two antipatterns, blob and spaghetti code, on program comprehension. In: Proceedings of 15th European Conference on Software Maintenance and Reengineering, pp. 181–190 (2011)
Arcelli, F.; Tosi, C.; Zanoni, M.; Maggioni, S.: The MARPLE project: A tool for design pattern detection and software architecture reconstruction. In: 1st International Workshop on Academic Software Development Tools and Techniques (WASDeTT-1) (2008)
Chaikalis, T.; Tsantalis, N.; Chatzigeorgiou, A.: JDeodorant: identification and removal of type-checking bad smells. In: Proceeding of 12th European Conference on Software Maintenance and Reengineering, pp. 329–331 (2008)
CheckStyle. http://checkstyle.sourceforge.net
Dehagani, S.M.H.; Hajrahimi, N.: Which factors affect software projects maintenance cost more? Acta Inform. Med. 21(1), 63 (2013)
Fard, A.M.; Mesbah, A.: Jsnose: detecting javascript code smells. In: Proceedings of 13th International Working Conference on Source Code Analysis and Manipulation, pp. 116–125 (2013)
Fontana F.A., Braionea P., Zanonia M.: Automatic detection of bad smells in code: an experimental assessment. J. Object Technol. 11(2), 1–38 (2012)
Fowler M., Beck K., Brant J., Opdyke W., Robert D.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)
Kiefer C.; Bernstein A.; Tappolet J.: Mining software repositories with iSPAROL and a software evolution ontology. In: Fourth International Workshop on Mining Software Repositories (MSR), p. 10 (2007)
Lozano, A.; Wermelinger, M.; Nuseibeh, B.: Assessing the impact of bad smells using historical information. In: Ninth International Workshop on Principles of Software Evolution: in Conjunction with the 6th ESEC/FSE Joint Meeting, pp. 31–34 (2007)
Mäntylä M.V., Lassenius C.: Subjective evaluation of software evolvability using code smells: an empirical study. J. Empir. Softw. Eng. 11(3), 395–431 (2006)
Mantyla, M.; Vanhanen J.; Lassenius C.: Bad smells-humans as code critics. In: Proceedings of the International Conference on Software Maintenance, pp. 399–408, (2004)
Marinescu, R.: Detection strategies: metrics-based rules for detecting design flaws. In: Proceedings of 20th International Conference on Software Maintenance, pp. 350–359 (2004)
Moha N., Guéhéneuc Y., Duchien L., Meur A.L.: DECOR: a method for the specification and detection of code and design smells. IEEE Trans. Softw. Eng. 36(1), 20–36 (2010)
Oliveira, P.; Valente, M.T.; Paim Lima, F.: Extracting relative thresholds for source code metrics. In: Software Evolution Week: IEEE Conference on Software Maintenance, Reengineering and Reverse Engineering (CSMR-WCRE’2014), pp. 254–263. Antwerp, Belgium: IEEE Computer Society (2014)
Palomba F.; Bavota G.; Penta MD.; Oliveto R.; De Lucia A.; Poshyvanyk D.: Detecting bad smells in source code using change history information. In: Proceedings of 28th IEEE/ACM International Conference on Automated Software Engineering, pp. 268–278 (2013)
Palomba F., Bavota G., Di Penta M., Oliveto R., Poshyvanyk D., De Lucia A.: Mining version histories for detecting code smells. IEEE Trans. Softw. Eng. 41(5), 462–489 (2015)
Rasool G., Arshad Z.: A review of code smell mining techniques. J. Softw.: Evol. Process 27(11), 867–895 (2015)
Ratiu D.; Ducasse S.; Gîrba T.; Marinescu R.: Using history information to improve design flaws detection. In: Proceedings of the Eight Euromicro Working Conference on Software Maintenance and Reengineering, p. 223 (2004)
Sjoberg D.I.K., Yamashita A., Anda B.C.D., Mockus A., Dyba T.: Quantifying the effect of code smells on maintenance effort. IEEE Trans. Softw. Eng. 39(8), 1144–1156 (2013)
Sparx System Enterprise Architect Modeling tool, homepage: http://www.sparxsystems.com/
Marcus, A.; Maletic, J.: Identification of high-level concept clones in source code. In: Proceedings of 16th Annual International Conference on Automated Software Engineering, pp. 107–114 (2001)
Marinescu, R.; Ratiu, D.: Quantifying the quality of object-oriented design: the factor-strategy model. In: Proceedings of Working Conference on Reverse Engineering, pp. 192–201 (2004)
Marticorena, R.; Crespo, Y.: Parallel inheritance hierarchy: detection from a static view of the system. In: 6th International Workshop on Object Oriented Reengineering, p. 6 (2005)
Mihancea P.F.; Marinescu R.: Towards the optimization of automatic detection of design flaws in object-oriented software systems. In: Proceedings of Ninth European Conference on Software Maintenance and Reengineering, pp. 92–101 (2005)
Munro, M.J.: Product metrics for automatic identification of bad smell design problems in java source-code. In: 11th IEEE International Symposium on Software Metrics, p. 15 (2005)
Naveen R.: JSmell: a bad smell detection tool for java systems. Dissertation and theses (2009)
Nitin M.: JAVA SMELL DETECTOR, Master thesis, San Jose State University (2011)
Pettersson N., Löwe W., Nivre J.: Evaluation of accuracy in design pattern occurrence detection. Proc. IEEE Trans. Softw. Eng. 36(4), 575–590 (2010)
Rasool, G.; Asif, N.: Software artifacts recovery using abstract regular expressions. In: Proceedings of International Multitopic Conference (INMIC’2007), pp. 1–6 (2007)
Rasool G., Philippow I., Mäeder P.: Design pattern recovery based on annotations. Adv. Eng. Softw. 41(4), 519–526 (2010)
Nongpong K.: Integrating Code Smells Detection with Refactoring Tool Support. Ph.D thesis, The University of Wisconsin-Milwaukee (2012)
Gopalan R.: Automatic detection of code smells in java source code. Dissertation for Honour Degree, The University of Western Australia (2012)
Slinger, S.: Code smell detection in eclipse. Thesis report, Delft University of Technology (2005)
Sahin D., Kessentini M., Bechikh S., Deb K.: Code-smells detection as a bi-level problem. ACM Trans. Softw. Eng. Methodol. 24(1), 1–44 (2014)
Kim T.W., Kim T.G., Seu J.H.: Specification and automated detection of code smells using ocl. Int. J. Softw. Eng. Appl. 7(4), 35–44 (2013)
Kessentini W., Kessentini M., Sahraoui H., Bechikh S., Ouni A.: A cooperative parallel search-based software engineering approach for code-smells detection. IEEE Trans. Softw. Eng. 40(9), 841–861 (2014)
dos Santos Neto B.F., Ribeiro M., da Silva V.T., Braga C., de Lucena C.J.P., de Barros Costa E.: AutoRefactoring: a platform to build refactoring agents. Expert Syst. Appl. 42(3), 1652–1664 (2015)
Ganea, G.; Verebi, I.; Marinescu, R.: Continuous quality assessment with inCode. Sci. Comput. Program. 1–18 (2015). doi:10.1016/j.scico.2015.02.007
Ierusalimschy R.: A text pattern matching tool based on parsing expression grammars. Softw.: Pract. Exp. 39(3), 221–258 (2009)
InFusion Code Smells tool. http://www.intooitus.com/products/infusion [Accessed on 15-01-2016]
Khamis, N.; Witte, R.; Rilling, J.: Automatic quality assessment of source code comments: the JavadocMiner. In: Hopfe, C.J., Rezgui, Y., Métais, E., Preece, A., Li, H. (eds.) Natural Language Processing and Information Systems. Lecture Notes in Computer Science, vol. 6177, pp. 68–79. Springer, Berlin, Heidelberg (2010)
Lanza M., Marinescu R., Ducasse S.: Object-oriented metrics in practice, pp. 29–31. Springer, Heidelberg (2006)
Roperia N.: JSmell: A Bad Smell Detection Tool for Java Systems. California State University, Long Beach (2009)
Macia, I.; Garcia, J.; Popescu, D.; Garcia, A.; Medvidovic, N.; von Staa, A.: Are automatically-detected code anomalies relevant to architectural modularity?: an exploratory analysis of evolving systems, In: Proceedings of the 11th Annual International conference on Aspect-Oriented Software Development, pp. 167–178. ACM, Potsdam, Germany (2012)
Mantyla M.; Vanhanen J.; Lassenius C.: Bad smells in software-a taxonomy and an empirical study. In: Proceedings of ICSM, pp. 381–384 (2003)
Mens T.; Tourwe T.; Munoz F.: Beyond the refactoring browser: advanced tool support for software refactoring. In: Proceedings of the Sixth International Workshop on Principles of Software Evolution, pp. 39–44 (2003)
Web link for results: Experimental results for the eight evaluated systems, 2015. URL http://research.ciitlahore.edu.pk/Groups/SERC/CodeSmells.aspx
Rasool, G.; Mäder, P.: Flexible design pattern detection based on feature types. In: Proceedings of the 26th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 243–252 (2011)
Wohlin, C.; Runeson, P.; Höst, M.; Ohlsson, M.C.; Regnell, B.; Wesslén, A.
Tsantalis N., Chatzigeorgiou A.: Identification of move method refactoring opportunities. IEEE Trans. Softw. Eng. 35(3), 347–367 (2009)
Yamashita A., Counsell S.: Code smells as system-level indicators of maintainability: an empirical study. J. Syst. Softw. 86(10), 2639–2653 (2013)
Yamashita A.; Moonen L.: Exploring the impact of inter-smells relationships in the maintainability of a system: an empirical study. In: Proceedings of International Conference on Software Engineering, pp. 682–691 (2013)
Zhang M., Hall T., Baddoo N.: Code bad smells: a review of current knowledge. J. Softw. Maint. Evol.: Res. Pract. 23(3), 179–202 (2011)
Zhang, M.; Hall, T.; Baddoo, N.; Wernick, P.: Do bad smells indicate trouble in code?. In: Proceedings of the 2008 Workshop on Defects in Large Software Systems, pp. 43–44 (2008)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Rasool, G., Arshad, Z. A Lightweight Approach for Detection of Code Smells. Arab J Sci Eng 42, 483–506 (2017). https://doi.org/10.1007/s13369-016-2238-8
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s13369-016-2238-8