Automatic Detection of Implicit and Typical Implementation of Singleton Pattern Based on Supervised Machine Learning

Abir Nacef, Sahbi Bahroun, Adel Khalfallah, Samir Ben Ahmed

2023

Abstract

Reverse engineering, based on design pattern recognition and software architecture refactoring, allows practitioners to focus on the overall architecture of the system without worrying about the programming details used to implement it. In this paper, we focus on the automatization of these tasks working on Singleton design Pattern (SP). The first task is the detection of the SP in its standard form, we named the detected structure as Singleton Typical implementation (ST). The second task consists of detecting structures which need the injection of the SP (Refactoring), these structures are named Singleton Implicit implementations (SI). All SP detection methods can only recover the typical form, even if they support different variants. However, in this work, we propose an approach based on supervised Machine Learning (ML) to extract different variants of SP in both ST and SI implementations and filter out structures which are incoherent with the SP intent. Our work consists of three phases; the first phase includes SP analysis, identifying implementation variants (ST and SI), and defining features for identifying them. In the second phase, we will extract feature values from the Java program using the LSTM classifier based on structural and semantic analysis. LSTM is trained on specific created data named SFD for a classification task. The third phase is SP detection, we create an ML classifier based on different algorithms, the classifier is named SPD. For training the SPD we create a new structured data named SDD constructed from features combination values that identify each variant. The SPD reaches 97% in terms of standard measures and outperforms the state-of-the-art approaches on the DPB corpus.

Download


Paper Citation


in Harvard Style

Nacef A., Bahroun S., Khalfallah A. and Ben Ahmed S. (2023). Automatic Detection of Implicit and Typical Implementation of Singleton Pattern Based on Supervised Machine Learning. In Proceedings of the 15th International Conference on Agents and Artificial Intelligence - Volume 3: ICAART, ISBN 978-989-758-623-1, pages 202-210. DOI: 10.5220/0011634000003393


in Bibtex Style

@conference{icaart23,
author={Abir Nacef and Sahbi Bahroun and Adel Khalfallah and Samir Ben Ahmed},
title={Automatic Detection of Implicit and Typical Implementation of Singleton Pattern Based on Supervised Machine Learning},
booktitle={Proceedings of the 15th International Conference on Agents and Artificial Intelligence - Volume 3: ICAART,},
year={2023},
pages={202-210},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0011634000003393},
isbn={978-989-758-623-1},
}


in EndNote Style

TY - CONF

JO - Proceedings of the 15th International Conference on Agents and Artificial Intelligence - Volume 3: ICAART,
TI - Automatic Detection of Implicit and Typical Implementation of Singleton Pattern Based on Supervised Machine Learning
SN - 978-989-758-623-1
AU - Nacef A.
AU - Bahroun S.
AU - Khalfallah A.
AU - Ben Ahmed S.
PY - 2023
SP - 202
EP - 210
DO - 10.5220/0011634000003393