Open Access Open Access  Restricted Access Subscription or Fee Access

Automatic Detection of Bad Smells from Code Changes

Maen M. Hammad(1*), Asma Labadi(2)

(1) Department of Software Engineering, The Hashemite University, Jordan
(2) Department of Software Engineering, The Hashemite University, Jordan
(*) Corresponding author



Code bad smells are indicators of code bad design that affects its quality attributes like understandability and readability. This effect has a direct impact on future maintenance tasks and code changing activities. Badly written code is hard to understand, change and test. The goal of this paper is to present an approach, supported by a tool, to automatically detect bad smells from code changes on the fly during code changing activities. An Eclipse plug-in tool (JFly) is developed to realize the approach. The tool analyzes code changes, detects bad smells and notifies developers about the location and the type of the detected bad smell. Nine bad smells are detected by JFly. A set of bad smells rules is defined, based on software metrics, to determine if code changes have one or more bad smells. JFly has been tested by different scenarios to evaluate its performance, usability and correctness. Results showed that JFly is very fast, easy to use and achieved high recall and precision values. By providing the JFly tool, developers are kept aware about code bad smells as soon as they implemented. As a result, the code is kept clean without the need to go over it periodically to check bad smells which consumes time and effort.
Copyright © 2016 Praise Worthy Prize - All rights reserved.


Code Bad Smells; Software Maintenance; Automatic Tool

Full Text:



I. Sommerville, Software Engineering: Addison-Wesley, 2010.

M. M. Lehman, J. F. Ramil, P. D. Wernick, D. E. Perry, and W. M. Turski, "Metrics and laws of software evolution-the nineties view," in Proceedings of the 4th International Software Metrics Symposium, 1997, pp. 20-32.

R. Baggen, J. P. Correia, K. Schill, and J. Visser, "Standardized code quality benchmarking for improving software maintainability," Software Quality Journal, vol. 20, no. 2, pp. 287-307, 2012.

T. Mens and S. Demeyer, Software Evolution: Springer, 2008.

M. Fowler, K. Beck, and J. Brant, Refactoring: Improving the design of existing code: Addison-Wesley Educational, 1999.

W. H. Brown, R. C. Malveau, and T. J. Mowbray, "AntiPatterns: refactoring software, architectures, and projects in crisis”, Wiley, 1998.

M. V. Mantyla and C. Lassenius, "Subjective evaluation of software evolvability using code smells: An empirical study," Empirical Software Engineering, vol. 11, no. 3, pp. 395-431, 2006.

F. Palomba, G. Bavota, M. Di Penta, R. Oliveto, and A. De Lucia, "Do they really smell bad? a study on developers' perception of bad code smells," in Proceedings of theIEEE International Conference on Software Maintenance and Evolution (ICSME'14), 2014, pp. 101-110.

D. I. K. Sjoberg, A. Yamashita, B. C. D. Anda, A. Mockus, and T. Dyba, "Quantifying the effect of code smells on maintenance effort," IEEE Transactions on Software Engineering, vol. 39, no. 8, pp. 1144-1156, 2013.

T. Mens and T. Tourwe, "A survey of software refactoring," IEEE Transactions on Software Engineering,vol. 30, no. 2, pp. 126-139, 2004.

L. Zhao and J. H. Hayes, "Rank-based refactoring decision support: two studies," Innovations in Systems and Software Engineering, vol. 7, no. 3, pp. 171-189, 2011.

R. Gopalan, "Automatic detection of code smells in Java source code," Dissertation for Honour Degree, The University of Western Australia, 2012.

N. Moha, Y.-G. Gueheneuc, L. Duchien, and A.-F. Le Meur, "DECOR: A method for the specification and detection of code and design smells," IEEE Transactions onSoftware Engineering, vol. 36, no. 1, pp. 20-36, 2010.

N. Tsantalis, T. Chaikalis, and A. Chatzigeorgiou, "JDeodorant: Identification and removal of type-checking bad smells," in Proceedings of the 12th European Conference on Software Maintenance and Reengineering (CSMR'08), 2008, pp. 329-331.

C. Marinescu, R. Marinescu, P. F. Mihancea, and R. Wettel, "iPlasma: An integrated platform for quality assessment of object-oriented design," in ICSM (Industrial and Tool Volume), 2005.

E. Murphy-Hill and A. P. Black, "An interactive ambient visualization for code smells," in Proceedings of the5th international symposium on Software visualization, 2010, pp. 5-14.

F. Fontana, M. Mangiacavalli, D. Pochiero, and M. Zanoni, "On Experimenting Refactoring Tools to Remove Code Smells," in In Scientific Workshop Proceedings of the XP2015, 2015, p. 7.

A. J. Riel, Object-oriented design heuristics vol. 335: Addison-Wesley Reading, 1996.

K. Dhambri, H. Sahraoui, and P. Poulin, "Visual detection of design anomalies," in Proceedings of the12th European Conference on Software Maintenance and Reengineering (CSMR'08), 2008, pp. 279-283.

G. Travassos, F. Shull, M. Fredericks, and V. R. Basili, "Detecting defects in object-oriented designs: using reading techniques to increase software quality," in ACM Sigplan Notices, 1999, pp. 47-56.

E. Van Emden and L. Moonen, "Java quality assurance by detecting code smells," in Proceedings of the9th Working Conference on Reverse Engineering (WCRE'02), 2002, pp. 97-106.

R. Marinescu, "Detection strategies: Metrics-based rules for detecting design flaws," in Proceedings of the20th IEEE International Conference on Software Maintenance (ICSM'04), 2004, pp. 350-359.

M. J. Munro, "Product metrics for automatic identification of "bad smell" design problems in java source-code," in Proceedings of the11th IEEE International Symposium on Software Metrics, 2005, pp. 15-15.

M. Lanza and R. Marinescu, Object-oriented metrics in practice: using software metrics to characterize, evaluate, and improve the design of object-oriented systems: Springer Science & Business Media, 2007.

F. A. Fontana, V. Ferme, and M. Zanoni, "Towards assessing software architecture quality by exploiting code smell relations," inProceedings of theIEEE/ACM 2nd International Workshop on Software Architecture and Metrics (SAM'15), 2015, pp. 1-7.

A. Tahmid, N. Nahar, and K. Sakib, "Understanding the Evolution of Code Smells by Observing Code Smell Clusters," in Proceedings of theIEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), 2016, pp. 8-11.

M. Zhang, N. Baddoo, P. Wernick, and T. Hall, "Improving the precision of fowler's definitions of bad smells," in Proceedings of the32nd Annual IEEE Software Engineering Workshop (SEW'08), 2008, pp. 161-166.

S. C. Kothari, L. Bishop, J. Sauceda, and G. Daugherty, "A pattern-based framework for software anomaly detection," Software Quality Journal, vol. 12, no. 2, pp. 99-120, 2004.

D. Rapu, S. Ducasse, T. Girba, and R. Marinescu, "Using history information to improve design flaws detection," in Proceedings of the8th European Conference on Software Maintenance and Reengineering (CSMR'04), 2004, pp. 223-232.

F. Palomba, G. Bavota, M. Di Penta, R. Oliveto, D. Poshyvanyk, and A. De Lucia, "Mining version histories for detecting code smells," IEEE Transactions onSoftware Engineering, , vol. 41, no. 5, pp. 462-489, 2015.

M. Hammad, M. Hammad, and M. Bsoul, "An approach to automatically enforce object-oriented constraints," International Journal of Computer Applications in Technology, vol. 49, no. 1, pp. 50-59, 2014.

C. Catal and B. Diri, "Software defect prediction using artificial immune recognition system," in Proceedings of the25th conference on IASTED International Multi-Conference: Software Engineering, 2007, pp. 285-290.

A. Maiga, N. Ali, N. Bhattacharya, A. Sabane, Y.-G. Gueheneuc, G. Antoniol, and E. Aimeur, "Support vector machines for anti-pattern detection," in Proceedings of the27th IEEE/ACM International Conference on Automated Software Engineering (ASE'12), 2012, pp. 278-281.

M. Kessentini, S. Vaucher, and H. Sahraoui, "Deviance from perfection is a better criterion than closeness to evil when identifying risky code," in Proceedings of theIEEE/ACM international conference on Automated software engineering (ASE'10), 2010, pp. 113-122.

F. A. Fontana, M. Zanoni, A. Marino, and M. V. Mantyla, "Code smell detection: towards a machine learning-based approach," in Proceedings of theIEEE International Conference on Software Maintenance (ICSM'13), 2013, pp. 396-399.

E. H. Alikacem and H. A. Sahraoui, "A metric extraction framework based on a high-level description language," in Proceedings of the9th IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM'09), 2009, pp. 159-167.

F. Khomh, S. Vaucher, Y.-G. Gueheneuc, and H. Sahraoui, "A bayesian approach for the detection of code and design smells," inProceedings of the9th International Conference on Quality Software (QSIC'09), 2009, pp. 305-314.

G. Rasool and Z. Arshad, "A review of code smell mining techniques," Journal of Software: Evolution and Process, vol. 27, no. 11, pp. 867-895, 2015.


Please send any question about this web site to
Copyright © 2005-2021 Praise Worthy Prize