Multilanguage Detection of Design Pattern Instances

📅 2025-02-01
🏛️ Journal of Software: Evolution and Process
📈 Citations: 20
Influential: 1
📄 PDF
🤖 AI Summary
Existing design pattern detection tools are predominantly language-specific, hindering consistent identification of pattern instances across multi-language codebases. To address this, we propose DP-LARA—a cross-language design pattern detection approach built upon the LARA framework and a novel virtual Abstract Syntax Tree (vAST). DP-LARA establishes the first unified, language-agnostic pattern matching paradigm by mapping Java and C/C++ source code to semantically equivalent vAST representations, then applying static analysis augmented with an extensible rule engine for precise and consistent pattern instance identification. Experimental evaluation demonstrates that DP-LARA achieves detection accuracy on par with state-of-the-art single-language tools for both Java and C/C++, while significantly improving cross-language result consistency and reducing language adaptation effort by over 60%. This work introduces a scalable, maintainable paradigm for multi-language software architecture analysis.

Technology Category

Application Category

📝 Abstract
Code comprehension is often supported by source code analysis tools that provide more abstract views over software systems, such as those detecting design patterns. These tools encompass analysis of source code and ensuing extraction of relevant information. However, the analysis of the source code is often specific to the target programming language. We propose DP‐LARA, a multilanguage pattern detection tool that uses the multilanguage capability of the LARA framework to support finding pattern instances in a code base. LARA provides a virtual AST, which is common to multiple OOP programming languages, and DP‐LARA then performs code analysis of detecting pattern instances on this abstract representation. We evaluate the detection performance and consistency of DP‐LARA with a few software projects. Results show that a multilanguage approach does not compromise detection performance, and DP‐LARA is consistent across the languages we tested it for (i.e., Java and C/C++). Moreover, by providing a virtual AST as the abstract representation, we believe to have decreased the effort of extending the tool to new programming languages and maintaining existing ones.
Problem

Research questions and friction points this paper is trying to address.

Detects design patterns in multi-language code bases
Uses virtual AST for language-independent pattern analysis
Ensures consistent detection performance across Java and C/C++
Innovation

Methods, ideas, or system contributions that make the work stand out.

Multi-language design pattern detection tool
Uses LARA framework's virtual AST
Consistent performance across Java, C/C++
🔎 Similar Papers
H
Hugo Andrade
Faculty of Engineering, University of Porto, Porto, Portugal; INESC TEC, Porto, Portugal
João Bispo
João Bispo
FEUP/INESCTEC
CompilersSource-to-SourceReconfigurable Architectures
F
Filipe F. Correia
Faculty of Engineering, University of Porto, Porto, Portugal; INESC TEC, Porto, Portugal