Font Size: a A A

Slow Loop Detection Studies Based On Deep Learning

Posted on:2024-09-03Degree:MasterType:Thesis
Country:ChinaCandidate:Y Q LiFull Text:PDF
GTID:2568306917961279Subject:Computer technology
Abstract/Summary:PDF Full Text Request
Code smell refers to code symptoms that are introduced into a program due to design flaws or bad coding habits,resulting in deep quality problems.The presence of code smells will increase the risk of failure,make software difficult to maintain,and potential technical debt problems may form in the future.Currently,most state-of-the-art approaches focused on the detection of code bad smells from traditional desktop applications and they target only a few code smells.The demand for Android mobile software applications is continuously increasing with the evolution of technology and new enriching features to make the life of people easy and comfortable.Compared with desktop applications,software applications for mobile devices are often updated due to continuous technological innovation,resulting in more and more code smells in Android applications than desktop applications,and a different code smell from object-oriented,known as Android-specific code smell.This paper force on the slow loop,due to this traditional for loop statement processes data very slowly and consumes a lot of energy,it is considered to be an Android-specific code smell in Android apps.Its presence reduces the performance of Android apps and makes evolution and maintenance difficult.Current methods for detecting such code smell rely on the defined heuristic rules of static program analysis,which take the measured characteristics of the defined code smell as the detection criteria.However,it is very difficult to construct an algorithm and select the best metric according to the definition,and there is a certain degree of false detection.In order to overcome these difficulties,machine learning techniques have been applied to the field of code smell detection,but most academics focus on the smell of object-oriented code in traditional desktop applications.At present,there is still very little research in the field of Android-specific code smells.So far,it is unclear whether machine learning techniques can be applied to identify Android-specific code smells.To initially investigate the possibility to detect Android-specific smells,solve the problems existing in the traditional definition heuristic rule detection method,and efficiently and accurately detect Android-specific code smells.This paper proposes a method to detect one of Android-specific code smells,SL,by traditional machine learning and deep learning.The main contributions of this paper including the following three parts are as follows:(1)A method is proposed to automatically generate a sample set of tags from Android applications.Although many deep-learning-based approaches have been proposed to detect code smells,most existing works suffer from the problem of incomplete feature extraction and unbalanced distribution between positive samples and negative samples.In order to overcome this problem,this paper implements the tool ASSD,which can automatically build positive and negative sample sets from Android applications without manual intervention,and solve the problem of false detection of SL by static program analysis methods.(2)A method for detecting SL based on traditional machine learning is proposed,which proves the feasibility of traditional machine learning technology to detect Android-specific code smell.We conducted experiments on 70 Android applications,selected four traditional machine learning models(i.e.random forest,naive Bayes,J48 and JRip)to detect SL.Finally,analyzed the detection results of each model through evaluation indicators.Among them,the random forest model obtained the highest F1value(>86%).(3)A method for detecting SL based on deep learning is proposed.First,we extract the source code features as a dataset input to the neural network classifier.Secondly,we choose five deep neural networks to detect smells,they are convolution Neural Networks(CNN),recurrent Neural Networks(RNN),long-term convolution neural networks(CNN-LSTM),and variants of two autoencoder models(dense autoencoders(DAEs)and convolution autoencoders(CAE)).We used the training data generated from 70 Android applications to train five classifiers.Finally,test data is generated from10 re-selected Android applications to test our trained classifiers.The results prove that it is feasible to identify Android-specific smells using deep learning models,where the higher performance is CNN,RNN and CNN-LSTM models.At the same time,the proposed method outperforms the existing detection method based on program static analysis.In contrast,the F1 value of the CNN-LSTM model is improved by 25.34% on average.In addition,the performance of the proposed approach is also better than the detection method based on traditional machine learning.Compared with the random forest model whose performance is better than other traditional machine learning models adopted in this paper,the F1 value of the CNN model is improved by 8.1% on average.
Keywords/Search Tags:Android-specific code smells, slow loop, deep learning, traditional machine learning
PDF Full Text Request
Related items