Summary: | With the acceleration of software development iterations,developers often violate the basic principles of software design due to various reasons such as delivery pressure,resulting in code smells and affecting software quality.God class is one of the most common code smells,referring to classes that have taken on too many responsibilities.God class violates the design principle of "high cohesion and low coupling",damages the quality of the software system,and affects the understandability and maintainability of the code.Therefore,a new method of god class detection is proposed.It extracts the evolutionary and semantic features of the actual project,then merges the evolution and semantic features.Based on the merged features,it re-clusters all the methods for the projects.By analyzing the distribution of the member methods of each class in the actual project in the new clustering result,it calculates the cohesion of the class,and finds the class with low cohesion as the God class detection result.Experiments show that this method is superior to the current mainstream God class detection methods.Compared with traditional mea-surement-based detection methods,the recall and precision rates of the proposed method are increased by more than 20%.Compared with detection methods based on machine learning,although the recall rate of the proposed method is slightly lower,but the precision rate and F1 value are significantly improved.
|