论文部分内容阅读
In software development,it is easy to introduce code smells owing to the complexity of projects and the negligence of programmers.Code smells reduce code comprehensibility and maintainability,making programs error-prone.Hence,code smell detection is extremely important.Recently,machine learning-based technologies turn to be the mainstream detection approaches,which show promising performance.However,existing machine learning methods have two limitations: (1) most studies only focus on common smells,and (2) the proposed metrics are not effective when being used for uncommon code smell detection,e.g.,change barrier based code smells.To overcome these limitations,this paper investigates the detection of uncommon change barrier based code smells.We study three typical code smells,i.e.,Divergent Change,Shotgun Surgery,and Parallel Inheritance,which all belong to change barriers.We analyze the characteristics of change barriers and extract domain-specific metrics to train a Logistic Regression model for detection.The experimental results show that our method achieves 81.8%-100% precision and recall,outperforming existing algorithms by 10%-30%.In addition,we analyze the correlation and importance of the utilized metrics.We find our domain-specific metrics are important for the detection of change barriers.The results would help practitioners better design detection tools for such code smells.