Deep Learning Based Code Smell Detection
- 20 August 2019
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Software Engineering
- Vol. PP (00985589) , 1
Abstract
Code smells are structures in the source code that suggest the possibility of refactorings. Consequently, developers may identify refactoring opportunities by detecting code smells. However, manual identification of code smells is challenging and tedious. To this end, a number of approaches have been proposed to identify code smells automatically or semi-automatically. Most of such approaches rely on manually designed heuristics to map manually selected source code metrics into predictions. However, it is challenging to manually select the best features. It is also difficult to manually construct the optimal heuristics. To this end, in this paper we propose a deep learning based novel approach to detecting code smells. The key insight is that deep neural networks and advanced deep learning techniques could automatically select features of source code for code smell detection, and could automatically build the complex mapping between such features and predictions. A big challenge for deep learning based smell detection is that deep learning often requires a large number of labeled training data (to tune a large number of parameters within the employed deep neural network) whereas existing datasets for code smell detection are rather small. To this end, we propose an automatic approach to generating labeled training data for the neural network based classifier, which does not require any human intervention. As an initial try, we apply the proposed approach to four common and well-known code smells, i.e., feature envy, long method, large class, and misplaced class. Evaluation results on open-source applications suggest that the proposed approach significantly improves the state-of-the-art.Keywords
Funding Information
- National Natural Science Foundation of China (61772071, 61690205)
This publication has 58 references indexed in Scilit:
- BDTEX: A GQM-based Bayesian approach for the detection of antipatternsJournal of Systems and Software, 2011
- Code Bad Smells: a review of current knowledgeJournal of Software Maintenance and Evolution: Research and Practice, 2010
- Subjective evaluation of software evolvability using code smells: An empirical studyEmpirical Software Engineering, 2006
- Formalizing refactorings with graph transformationsJournal of Software Maintenance and Evolution: Research and Practice, 2005
- A survey of software refactoringIEEE Transactions on Software Engineering, 2004
- A hierarchical model for object-oriented design quality assessmentIEEE Transactions on Software Engineering, 2002
- Automated method-extraction refactoring by using block-based slicingACM SIGSOFT Software Engineering Notes, 2001
- A metrics suite for object oriented designIEEE Transactions on Software Engineering, 1994
- Automated assistance for program restructuringACM Transactions on Software Engineering and Methodology, 1993
- The program dependence graph and its use in optimizationACM Transactions on Programming Languages and Systems, 1987