Font Size: a A A

Refused Bequest Code Smell Detection Based On Synthetic Instances

Posted on:2022-10-23Degree:MasterType:Thesis
Country:ChinaCandidate:H ChenFull Text:PDF
GTID:2518306509984919Subject:Software engineering
Abstract/Summary:PDF Full Text Request
In the whole life cycle of software,in order to meet the consequently changing requirements from the users,developers are required to upgrade and maintain software under time pressure,which leads to code smell.Generally,these smells cause great hidden trouble to software,which has aroused the high attention of academy and industry.Refused Bequest is one of the most serious code smells,with high diffuseness in source code.However,the smell is rarely concerned in this field,mainly due to two challenges :(1)lack of datasets and(2)the difficulty for designing the detection rule of Refused Bequest.To solve the above problems,this paper proposes a framework that can effectively generate the Refused Bequest smell instances,and can also effectively identify the smell.The specific contents include:(1)To solve the problem of lack of datasets,an algorithm is proposed to automatically generate Refused Bequest smell.The algorithm constructs code fragments with smell by transforming the input,high-quality source code according to smell characteristics.The algorithm first converts the source code into Abstract Syntax Tree(AST),and then creates inheritance relationships that do not exist in the source code by manipulating nodes in the abstract syntax tree,thus obtaining smell instances.(2)To solve the problem that it is difficult to design the detection rules for Refused Bequest smell,this paper proposes a code smell detection model based on AdaBoost.Firstly,the model calculated the code metrics as the attribute of the instances with using existing tools,and then trained the detection model according to the generated smell datasets,and finally,based on the obtained model,the metric set that has more impact on the Refused Bequest smell could be obtained.In order to evaluate the effectiveness of the algorithms,for code smell instance synthesis algorithm,datasets from four high-quality open source projects were used in this paper.The manual evaluation on synthetic instances show that the algorithm can effectively generate Refused Bequest smell instances and solve the problem of lack of datasets effectively.For code smell detection model,the AdaBoost model adopted in this paper performs better than the other two most commonly used machine learning models,and the detection result of the proposed model in this paper is also significantly superior to the existing detection tools through verification on manually labeled datasets.
Keywords/Search Tags:Code Smell, Refused Bequest, AdaBoost
PDF Full Text Request
Related items