Design patterns codify standard solutions to common problems in software design and architecture. Given their importance in improving software quality and facilitating code reuse, many types of research are proposed on their automatic detection. In this paper, we focus on singleton pattern recovery by proposing a method that can identify orthodox implementations and non-standard variants. The recovery process is based on specific data created using a set of relevant features. These features are specific information defining each variant which is extracted from the java program by structural and semantic analysis. We are based on the singleton analysis and different proposed features presented by Nacef et al. in [1] to create structured data. This data contains a combination of feature values defining each singleton variant to train a supervised Machine Learning (ML) algorithm. The goal is not limited to detecting the singleton pattern but also the specification of the implemented variant as so as the incorrect structure that is incoherent with the pattern intent. We use different ML algorithms to create the Singleton Detector (SD) to compare their performance. The empirical results demonstrate that our method for automatically training the (SD) based on features and supervised ML, can identify any singleton implementation with the specific variant’s name achieving 99% of precision, and recall. We have compared the proposed approach to similar studies namely DPDf and GEML. The results show that the SD outperforms the state-of-the-art approaches by more than 20% on evaluated data constructed from different repositories; PMART, DPB and DPDf corpus in terms of precision.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.