Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns

Software reverse engineering plays a crucial role in identifying design patterns and reconstructing software architectures by analyzing system implementations and producing abstract representations across multiple layers. This research introduces a novel feature engineering approach that integrates...

Full description

Saved in:
Bibliographic Details
Main Authors: Tarik Houichime, Younes El Amrani
Format: Article
Language:English
Published: IEEE 2025-01-01
Series:IEEE Access
Subjects:
Online Access:https://ieeexplore.ieee.org/document/10824764/
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1832592875978752000
author Tarik Houichime
Younes El Amrani
author_facet Tarik Houichime
Younes El Amrani
author_sort Tarik Houichime
collection DOAJ
description Software reverse engineering plays a crucial role in identifying design patterns and reconstructing software architectures by analyzing system implementations and producing abstract representations across multiple layers. This research introduces a novel feature engineering approach that integrates both behavioral and structural analysis of code, resulting in a feature-rich sequential representation. This transformation enables the effective use of transformers and attention mechanisms to detect design patterns in source code. Our results emphasize the importance of context in distinguishing between various design patterns, demonstrating that the proposed sequence format, with its sensitivity to token order, significantly improves the model’s capacity to differentiate between similar patterns. By leveraging the power of attention mechanisms, our approach efficiently discards irrelevant code elements, focusing on the most critical features for accurate patterns detection. Additionally, we show that this sequential code representation can be utilized to augment training data, leading to enhanced model accuracy. Trained on a diverse set of code samples representing all 23 GoF design patterns, sourced from repositories such as GitHub and Bitbucket, our methodology achieved an accuracy of 92%. Evaluation metrics further validate the robustness of the approach. This study underscores the potential of context-driven, feature-engineered representations in advancing design patterns detection and contributes a comprehensive new dataset that supports behavioral code analysis, setting the stage for future research in this area.
format Article
id doaj-art-95d4474cbdb0407d98e30cfc1b7f8bcf
institution Kabale University
issn 2169-3536
language English
publishDate 2025-01-01
publisher IEEE
record_format Article
series IEEE Access
spelling doaj-art-95d4474cbdb0407d98e30cfc1b7f8bcf2025-01-21T00:02:23ZengIEEEIEEE Access2169-35362025-01-01139689970710.1109/ACCESS.2025.352584910824764Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design PatternsTarik Houichime0https://orcid.org/0000-0003-3477-4912Younes El Amrani1https://orcid.org/0009-0005-4121-0535ENSIAS, Laboratory of Software Project Management, Mohammed V University in Rabat, Rabat, MoroccoENSIAS, Laboratory of Software Project Management, Mohammed V University in Rabat, Rabat, MoroccoSoftware reverse engineering plays a crucial role in identifying design patterns and reconstructing software architectures by analyzing system implementations and producing abstract representations across multiple layers. This research introduces a novel feature engineering approach that integrates both behavioral and structural analysis of code, resulting in a feature-rich sequential representation. This transformation enables the effective use of transformers and attention mechanisms to detect design patterns in source code. Our results emphasize the importance of context in distinguishing between various design patterns, demonstrating that the proposed sequence format, with its sensitivity to token order, significantly improves the model’s capacity to differentiate between similar patterns. By leveraging the power of attention mechanisms, our approach efficiently discards irrelevant code elements, focusing on the most critical features for accurate patterns detection. Additionally, we show that this sequential code representation can be utilized to augment training data, leading to enhanced model accuracy. Trained on a diverse set of code samples representing all 23 GoF design patterns, sourced from repositories such as GitHub and Bitbucket, our methodology achieved an accuracy of 92%. Evaluation metrics further validate the robustness of the approach. This study underscores the potential of context-driven, feature-engineered representations in advancing design patterns detection and contributes a comprehensive new dataset that supports behavioral code analysis, setting the stage for future research in this area.https://ieeexplore.ieee.org/document/10824764/Design patterns detectiontransformersattention mechanismfeature engineering
spellingShingle Tarik Houichime
Younes El Amrani
Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
IEEE Access
Design patterns detection
transformers
attention mechanism
feature engineering
title Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
title_full Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
title_fullStr Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
title_full_unstemmed Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
title_short Context Is All You Need: A Hybrid Attention-Based Method for Detecting Code Design Patterns
title_sort context is all you need a hybrid attention based method for detecting code design patterns
topic Design patterns detection
transformers
attention mechanism
feature engineering
url https://ieeexplore.ieee.org/document/10824764/
work_keys_str_mv AT tarikhouichime contextisallyouneedahybridattentionbasedmethodfordetectingcodedesignpatterns
AT youneselamrani contextisallyouneedahybridattentionbasedmethodfordetectingcodedesignpatterns