# Machine Learning-Based Methods for Code Smell Detection: A Survey
## 4 Findings and Discussion
### Rationalize the Research Questions
#### 4.2.3 RQ3: What Software Metrics Are Used for Code Smell Detection? Research articles employ a variety of software metrics, and in this study, more than 290 metrics are used. Figure 8 shows these metrics, arranged from most to least frequently used. This figure includes only the most and least used metrics for clarity. The following  
Figure 6: Subclasses’ distribution of the Decision Tree, Bayesian learning, ensemble learning, SVM, Rule-Based Learning, neural network, and miscellaneous classification algorithms with appropriate study percentages: (**a**) Decision Tree-based code smell detection techniques; (**b**) Ensemble Learner-based code smell detection; (**c**) neural network-based code smell detection techniques; (**d**) Rule-Based Learning-based code smell detection techniques; (**e**) Bayesian Learner-based code smell detection techniques; (**f**) Support Vector Machine-based code smell detection approaches; (**g**) miscellaneous-based code smell detection techniques. Figure 7: Number of studies of different code smells. section will delve into the significance and application of these software metrics, providing a comprehensive understanding of their use in code smell detection. Object-oriented metrics study various features of object-oriented software like coupling, cohesion, and reusability in articles ARTN1, ARTN4, ARTN6, ARTN7, ARTN9, ARTN11, ARTN12, ARTN13, ARTN15, ARTN16, ARTN23, and ARTN38. The line of code (LOC), a traditional and frequently used software metric, is also considered in this research. Effective line of code (ELOC) is another metric that has been applied in several articles (ARTN13, ARTN17, ARTN21, ARTN27, ARTN30, ARTN31, ARTN32, ARTN34, ARTN38, and ARTN39). LCOM (Lack of COhesion in Methods), a metric that counts the number of method pairs where their class properties are not shared, is used in articles ARTN2, ARTN8, ARTN22, ARTN23, ARTN27, ARTN30, ARTN32, ARTN34, ARTN38, and ARTN39. ARTN34, for instance, considered LCOL with a sampling technique over 629 source project datasets. Other metrics are applied in article ARTN20, such as the Number of Methods Overridden (NMO), Number Of Public Methods (NOPLM), Number Of Non-Accessor Methods (NONAM), Number Of Protected Attributes (NOPRA), NUMBER OF DEFAULT ATTRIBUTES (NODA), Number Of Static Methods (NOSM), Number Of Static Attributes (NOSA), NUMBER OF NON--CONSTRUCTOR METHODS (NONCM), Number Of Constructor Methods (NOCM), and the NUMBER OF FINAL AND STATIC METHODS (NoPSM). Article ARTN8 proposed the BDTEX (Bayesian Detection Expert) approach with other metrics such as Coupling Between Objects (CBO), a Goal Question Metric (GQM), and the Number of Attributes Declared (NAD) metrics. [PERSON] et al. [30] proposed a search-based system and employed metrics such as LOC, NAD, McCabe (used for software quality and security such as cyclomatic complexity (CC), actual cyclomatic complexity, etc. ), Weighted Methods for Class (WMC), number of children (NOC), CBO, LCOM, CC, Response For A-Class (RFC), Number of Parameters (NOPARAM), and the Depth of Inheritance Tree (DIT). Their method had an average precision and recall of 94.24% and 93.4%, respectively, demonstrating the high effectiveness of these metrics in code smell detection. The frequently used metrics in articles ARTN3, ARTN8, ARTN13, ARTN16, ARTN17, ARTN20, ARTN21, ARTN22, ARTN23, ARTN30, ARTN31, ARTN32, ARTN34, ARTN36, ARTN38, ARTN39, etc., are LOC, NoC, LCOM, WMC, and DIT. These metrics are widely used because they provide valuable insights into the structure and complexity of the code, which are key factors in code smell detection. The article used coupling and cohesion metrics CBO, SQL software metrics for code smell detection in articles ARTN1, ARTN4, ARTN7, ARTN9, ARTN13, ARTN15, ARTN16, ARTN20, ARTN23, ARTN27, ARTN32, ARTN34, ARTN38, and ARTN39, and also applied data sampling techniques to handle imbalanced data in prediction. LOC, WMC, DIT, LCOM, NoC, CC, NOM (Number of  
Figure 8: List of frequently used metrics for code smell detection.