Fujaba Tool Suite RE

Design Patterns Recognition with the Fujaba Tool Suite

When reverse engineering software systems the first important task is to understand the systems source code. Design patterns are used in forward engineering as good solutions to recurring problems and form a common vocabulary among developers. Thus, recognizing implementations of design patterns in existing software systems helps the reverse engineer to understand the system.

The description of design patterns is usually informal to a large extent. For semiautomatic recognition of design patterns they have to be formally specified. We developed a pattern specification language based on graph grammars and an iterative and scalable inference algorithm.

Pattern Specification

The PatternSpecification plug-in provides a graphical editor for the specification of patterns. We specify patterns as graph transformation rules, with respect to the abstract syntax graph (ASG) of a systems source code. Applying pattern rules results in enriching the ASG with annotation nodes which may be linked to an arbitrary number of ASG elements. Thus, annotation nodes mark pattern implementations recognized by pattern rules.

A pattern rule is defined by a left-hand side (LHS) and a right hand side (RHS). The LHS of the rule describes the structure that has to be found in the ASG if an instance of the pattern exists. The LHS may also contain annotations created by other pattern rules thereby permitting a composition of rules. Rules requiring annotations created by other rules depend on those rules. Furthermore, in the LHS special ASG elements or annotations are designated which trigger the execution of the rule. Triggers and dependencies between rules are used by the inference engine to determine the rule execution order (see below). The right-hand side (RHS) of a pattern rule defines an annotation node and links to certain ASG elements to be created when the LHS could be matched, i.e., an implementation of the pattern could be found.


Figure 1:A pattern rule in the Fujaba Tool Suite

Each pattern rule is specified in a separate diagram (cf. Fig. 1). The plug-in provides additional pattern catalogue diagrams which display dependencies and trigger relationships between rules. A catalogue of rules is translated into pattern recognition engines used by the pattern inference.

Pattern Inference

The pattern rules are applied by an inference algorithm which is implemented by the InferenceEngine plug-in. After parsing the source code of the system into an ASG the inference engine is started by loading a catalogue of pattern rules.

The inference engine uses a pattern dependencies net (PDN) in which pattern rules are organized in levels according to their dependencies and trigger relationships. Based on the PDN the inference engine applies rules scheduled in priority queues. It starts with rules that are independent from other rules.

Successfully applied rules create annotations which in turn trigger other rules at higher levels. This is called the bottom-up mode of the inference engine. Newly triggered rules are scheduled according to their levels in descending order, i.e., higher level rules which produce meaningful results are executed as early as possible.

Scheduled higher level rules may depend on other rules that have not been applied yet, i.e., rules may require annotations created by lower level rules. In this case the inference engine switches from bottom-up to topdown mode and tries to recursively establish all missing annotations by applying the appropriate rules.

The inference engine works semiautomatically because it involves the reverse engineer in the analysis. The reverse engineer may pause the inference at any time and inspect the results produced so far. Furthermore the engineer may modify or manually add (hypothetical) results and continue the inference. The changes are then considered in the further analysis.


Figure 2:Analysis results displayed in a class diagram

The analysis results, i.e., the annotations, are displayed in class diagrams which can be directly obtained from the ASG. Fig. 2 shows a screenshot of the Fujaba Tool Suite with an annotated class diagram after an analysis with the inference engine.

Current and Future Work

Our current work on the one hand focuses on the recognition of Anti Patterns as a basis for quality evaluation and refactoring. On the other hand we extend our analysis to dynamic behaviour to distinguish between statically similar but dynamically distinguishable design patterns.

Download

Please note that we migrated Fujaba Tool Suite RE to Eclipse. The migrated version is called Reclipse. Now, we only develop Reclipse.

Fujaba Tool Suite RE 4.2.0 available. Newer versions of the Fujaba Tool Suite RE are available as plug-ins only. They are typically based on the newest Fujaba Tool Suite releases. You can download them via the "Manage Plug-Ins" dialog within the Fujaba Tool Suite or directly through the plug-ins download page.
The newest Fujaba Tool Suite RE release consists of the following plug-ins:

  • JavaAST
  • JavaParser
  • InferenceEngine
  • PatternSpecification
  • EnginesGenerator
  • AssociationDetection

Documents

Publications concerning Fujaba Tool Suite RE and the FINITE Project

Details for Els04_ag

Title: Selektive Aufzeichnung von Laufzeitinformationen bei der Ausführung von Java-Programmen
Booktitle:
Written by: A. Elsner:
in: September 2004
Volume: Number:
on pages:
Chapter:
Editor:
Publisher:
Series:
Address:
Edition:
ISBN:
how published:
Organization:
School: University of Paderborn, Department of Computer Science, Paderborn, Germany
Institution:
ISSN:
Doi:
File: BachelorAElsner.pdf
URL:

Note:

Abstract:

Eintrag als Bibtex exportieren

Imprint | Webmaster | Recent changes: 10.08.2011