Font Size: a A A

Research On Module-independent Code Smell Detection Technology

Posted on:2019-10-01Degree:MasterType:Thesis
Country:ChinaCandidate:Y QinFull Text:PDF
GTID:2438330548957782Subject:Software engineering
Abstract/Summary:PDF Full Text Request
In the object-oriented programming process,code smell is a problem that affects the program design,operating efficiency and maintenance costs,also a symptoms may originate from poor design and implementation choices.In some cases,such symptoms may originate from activities performed by developers in a hurry,e.g.,implementing urgent patches or simply making suboptimal choices.In other cases,smells come from some recurring,poor design solutions,also known as anti-patterns.The greatest danger is that it does harm to the program's module independence,so it is the most import to focus on the module-independent Code Smell.Module-independent Code Smell includes Divergent Change,Shotgun Surgery,Feature Envy.During development,the most common behavior for developers is to make heavy use of the contents of other classes when writing a class' s code.Therefore,the most typical,widely existing program in the module-independent Code Smell is Feature Envy,which belongs to the between-class Code Smell.Different from other types of Code Smell,Feature Envy is not intuitive,it is very difficult for developers to find such Smell through observation,and it is often necessary to determine the existence of such a Code Smell through distance metric algorithm.In the distance metric algorithm,there are Euclidean distance,cosine distance,Jaccard distance and so on.Considering that the actual application scenario is to detect class and the entities in the class,the distance being treated as the similarity between set and the set is the most appropriate.The Jaccard distance measure of the collection similarity is most suitable.However,the traditional Jaccard distance measurement algorithm can only reflect the calling of the code or not,and can not reflect the calling frequency in the running of the code.However,the running frequency of the code is a common problem in the program,so the traditional method has some limitations.On the basis of Jaccard similarity coefficient of similarity algorithm in collection,combined with the calling relationship and frequency between entities,a Jaccard distance weighting method is proposed to abstract the distance between methods,attributes and classes into weight Jaccard similarity distance,Finally,by comparing each method or property and the distance between the various categories to determine the presence of Feature Envy,filtering out the list of target candidate list.Considering that Feature Envy's detection is consistent with the class' s functions and context,it is proposed to combine context semantic similarity measures to determine whether there is smell by using the sum of cosine similarity and weight Jaccard similarity as an indicator.This approach not only ensures that the detection algorithm meets the definition of Feature Envy,but also takes into account the functional responsibilities of the code,and also reduces the time complexity of finding the final target class.This greatly improves the performance of final detection.In the experiment,five open source engineering from Github are used as dataset,using ByteParse to parse data sets and collect related information of class in the Eclipse environment.Based on the information,this method compared with the traditional JDeodorant in three indexes of P,R and F are improved on average about 15%.Of course,this approach still lacks in the degree of dispersion of the F value,which is also the direction of future improvement.
Keywords/Search Tags:Code Smell, Jaccard Distance, Feature Envy, Similarity Measure, ByteParse
PDF Full Text Request
Related items