to the DP implementations and their corresponding
concrete classes changing only the DSL specifica-
tions without any direct impact on the system source
code. The approach was implemented using a frame-
work, called Declarative Design Pattern Framework
(DDPF), built on the Eclipse Modeling tools using
Xpand as Model to Text (M2T) transformation en-
gine and AspectJ as AOP language. The generation
step is performed starting from a model written by
the DSL and dynamically generates aspects applying
idioms and DPs on system classes with null (or very
reduced) impact on them. A template-language en-
gine is used to parse the DSL DSL code generating
some Java and AspectJ resources to implement flexi-
ble and modular DPs using the concrete classes of the
system. To validate the effectiveness of the proposed
approach a real world system, the Korsakow editor
system, is refactored using DDPF and both DDPF and
OOP versions are analyzed using modualrity metrics
(DOS and DOF defined in (Eaddy et al., 2007)). The
comparison was performed evaluating the quality of
modularization and the impact of required changes on
system classes involving DPs. This in order to as-
sess the the framework adoption in terms of: (i) DSL
effectiveness to express (and change at run-time) de-
sign choices, and (ii) internal structure quality of the
resulting system source code.
The remaining of the paper is structured as fol-
lows. Section 2 reports some related work. Section 3
presents and discusses the proposed approach and the
architecture of the AspectJ-based framework adopt-
ing it. The section 4 reports a description of the the
case study and discusses the quantitative evaluation
of the proposed framework using an adequate set of
AOP-aware source code metrics. Conclusive remarks
and future works are finally presented in section 5.
2 RELATED WORK
Several DPs description languages and DPs imple-
mentation approaches are proposed. In (Eden, 2001),
a formal language for DPs representation is reported.
It allows the designer to refine and customize the
descriptions of canonical DPs or to define new DPs
from scratch. Another pattern language is also pro-
posed in (Zdun, 2004). It allows to trace and manipu-
late software components and their dependencies. In
(Elaasar et al., 2006), the DPs are applied to concrete
classes using pattern languages or models. Moreover,
in (Boussaidi and Mili, 2007) authors propose an ex-
plicit DPs representation as well as the transformation
embodied in their application.
Several studies are also focused on the adoption
of aspect oriented techniques to implement object-
oriented DPs: in (Baca and Vranic, 2011) intrin-
sic aspect-oriented DPs are used to improve com-
posability with respect to the original implementa-
tions of object-oriented DPs and their aspect-oriented
re-implementations. In (Soundarajan and Hallstrom,
2004), aspect oriented design language is used to sup-
port software reuse deriving the specific requirements
for the Aspect Oriented Software Development De-
sign Language architecture by examining the AspectJ
extensions for a distributed computing environment.
Respect to the above discussed approaches (that
apply DPs to the existing design or code), in this
paper we propose a DSL approach aiming to re-
duce crosscutting introduced by DPs in Object Ori-
ented code (Bernardi et al., 2013c; Bernardi et al.,
2013b; Bernardi et al., 2014). Moreover, an approach
for support application that uses DPs into an aspect-
based version refactoring is proposed in (Giunta et al.,
2012). Here, with respect to our declarative approach,
a lower flexibility in modifying patterns application
is obtained thought an explicit refactoring of exist-
ing source code. Differently from this, in the pro-
posed approach the system is developed from scratch
using a declarative language that is more suitable in
a forward engineering context. Finally, the proposed
approach differs from the other ones for the defini-
tion of a dynamic DSL that involves, in a completely
dynamic manner, the existing source code in a pat-
tern logic. According to this, the proposed engine in
the place to modify or generate code, generates as-
pects that inject pattern logic at run-time while sys-
tem classes are oblivious. Since only aspects perform
interception and a run-time bytecode manipulation is
performed to apply pattern logic, an higher flexibility,
a lower invasivity and a reduction of the maintenance
effort is obtained.
3 PROPOSED APPROACH
The proposed approach is focused on the definition of
a DSL based on an OO system meta-model and al-
lowing to map DPs (along with their variants, roles
and default implementations) on the system classes.
The DSL is composed by two main parts: i) the rep-
resentation of the source code elements and ii) the
representation of all the elements (pattern, role defini-
tion and implementation) aiming to perform dynamic
interception of a wide set of events that are used to
involve, at run-time, the concrete classes in pattern
collaboration. The source code elements are modeled
using the programming language syntax of the imple-
mented system. In particular, the proposed DSL is
Reducing Static Dependences Exploiting a Declarative Design Patterns Framework
155