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.


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


Publications concerning Fujaba Tool Suite RE and the FINITE Project

Details for MW05_ag

Title: Selective Tracing for Dynamic Analyses
Booktitle: Proc. of the 1st Workshop on Program Comprehension through Dynamic Analysis (PCODA), co-located with the 12th WCRE, Pittsburgh, Pennsylvania, USA
Written by: M. Meyer, L. Wendehals:
in: November 2005
Volume: 2005-12 Number:
on pages: 33-37
Editor: Andy Zaidman and Abdelwahab Hamou-Lhadj and Orla Greevy
Series: Technical Report
how published:
Organization: Universiteit Antwerpen, Belgium
File: MW05.pdf


Abstract: Reverse engineering based on dynamic analyses often uses method traces of the program under analysis. Recording all method traces during a program's execution produces too much data, though for most analyses, a 'slice' of all method traces is sufficient. In this paper, we present an approach to collect runtime information by selectively recording method calls during a program's execution. Only relevant classes and methods are monitored to reduce the amount of information. We developed the JavaTracer which we use for the recording of method calls in Java programs.

Eintrag als Bibtex exportieren

Imprint | Webmaster | Recent changes: 10.08.2011