Font Size: a A A

The Detection Of Code Smell Based On Latent Semantic Analysis

Posted on:2018-08-27Degree:MasterType:Thesis
Country:ChinaCandidate:S MaFull Text:PDF
GTID:2348330515974738Subject:Software engineering
Abstract/Summary:PDF Full Text Request
With the development of software engineering,the function of a software system is more and more abundant,and its internal structure is more and more complex.Due to deadline and pressure of market competition,the violation of some design principles which lead to some defects in an object-oriented system,so called code smell,is taken place easy.By code smell detection,one can find and locate problems in software,and decide where to implement refactoring.Therefore,code smell detection has a strong practical significance to ensure the quality of software.Traditional code smell detection mostly depends on the structural information of source code,such as the calls of methods and the usages of attributes.However,conceptual relationship hidden in source code is ignored.In this thesis,a new code smell detection method is proposed,which introduces conceptual metrics into the detection algorithm.This thesis focuses on the detection of two kinds of code smells,(Large Class and Feature Envy).The main work of this thesis is listed as follows:1)Based on Martin Fowler's 22 code smells,the approaches for code smell detection are reviewed.Moreover,the internal characteristic of the Large Class and Feature Envy are especially discussed.2)Motivated from the successful application of latent semantic analysis in the field of text processing,this thesis proposes a new code smell detection algorithm,which applies the latent semantic analysis technology to introduce the conceptual metrics between classes and methods into the structural measurement.Based on the theory of latent semantic analysis,the conceptual cohesion and coupling definition of source code are proposed and utilized as an indicator of the code smell detection by the linear combination of both.3)Because the conceptual information among classes and methods is hidden in the identifiers and annotations of the source code,the abstract syntax tree(AST)is used to design the extraction algorithm of words.The extracted identifiers and comments are used as input for the algorithm.4)Two projects are choosed from Landfill which is an open corpus for code smell detection benchmark,as experimental corpus.The linear combination of structural measurement and conceptual measurement is compared to only use of structural measurement and only use of the conceptual measurement.The experimental results show that the proposed method is better than other methods in terms of accuracy and recall rate,and the overall performance is better.
Keywords/Search Tags:Code Smell, Latent Semantic Analysis, Large Class, Feature Envy, Conceptual Measurements
PDF Full Text Request
Related items