Source Code Analysis for Design Patterns
Design pattern extraction tools analyze source code and attempt to match the code to a collection of specimen design patterns. We reviewed tools announced by peer-reviewed literature, and found that the existing tools are unsatisfactory for use by modern C++ developers and analysts.
Summary
We explored the corpus of existing design pattern extraction tools. We found papers for 9 tools. Additionally, we found citations for three other tools within the corpus, but the links to these tools were broken.
- 6/9 supported C++. 1/9 claimed to be at least nominally language agnostic because its annotation/markup scheme can be applied to any text file.
- 2/9 claimed open source status.
- 6/9 were design pattern miners, that is, given source code they claim to be able to identify design patterns within the source code. The others were design pattern discoverers, that is, given annotated source code, they identify intra-class relationships that suggest that they may form a design pattern (but they cannot observe code and say “this class matches the
singleton
pattern” or “that method implementssingleton::getInstance()
”. - 0/9 were all of open source, available for download, support C++, and are design pattern miners.
We’ll continue to look for design pattern miners that meet our needs. Without design pattern extraction capabilities, our solution will require manual annotation and this will not scale. We believe that design pattern discovery remains an open problem, and is profitable for reverse engineering.
Reviewed Works
Tool or Paper | Languages | Open Source? | Pattern Discovery or Mining? | Notes |
---|---|---|---|---|
DP-Miner | Java | No | Discovery | Needs a pre-constructed XMI file for project. Authors claim XMI can be generated with tools like Rational Rose. |
DeMIMA | C++, Java | No | Discovery | Requires documenting components with OMT class diagrams |
SPQR | ? | No (patent pending) | Mining | Introduces concept of Elemental Design Patterns: 26 patterns authors found simple enough to express in logical systems. Only works on these Elemental Design Patterns. |
Design Pattern Detection Using Similarity Scoring | Java | No. Authors don’t claim open-source status, and could not find source. | Mining | Uses similarity scoring on graph of class inheritance using Java byte code. Does not appear to be able to identify class method:pattern function mapping. |
DPET | C++ | Authors do not claim open-source status, and could not find source. | Mining | - |
An efficient tool for recovering Design Patterns from C++ Code | C++ | Uses proprietary software (“Understand for C++”) to generate a SQL database, which their solution then analyzes. Did not provide analysis artifact reference. | Mining | Introduces ability to infer aggregations. |
Mining Design Patterns from C++ Source Code (Columbus, DPML) | C++ | Authors do not claim open-source status, and could not find source. | Mining and Discovery | Introduces DPML, extending existing DP annotation schemes to mark “inheritance, composition, aggregation and association,… call delegation, object creation and operation overriding”. One of first to look at function bodies, not just class’ structure. |
Evaluating C++ Design Pattern Miner Tools (Columbus/CAN) | C++ | Yes. | Mining and Discovery | Extends/Improves Columbus. Announces availability through FrontEndArt. Download link is dead. |
A Toolchain for Reverse Engineering C++ Applications (G4RE/G4API) | C++ | Yes | Neither | Paper only claims ability to perform reverse engineering analysis that may reveal design patterns. |
Dead Ends
The following were cited as possible Design Pattern mining solutions, but links are dead: