In this paper, we present a design pattern, called Ag-
gregate Callback, which helps tool developers to
structure the code in a way that makes the model
building logic more flexible and robust. We believe
that this design pattern will greatly help developers of
modeling tools in designing agile tools that are easier
to maintain and extend. We have used this design so-
lution in earlier tools but the detailed description of
this approach as a reusable design pattern is a new
contribution in this paper.
The rest of this paper is organized as follows. Sec-
tion 2 lists existing work available about the subject.
Section 3 describes the design pattern in a format that
is similar to those that are used in design pattern
catalogs. Section 4 concludes the paper.
2 RELATED WORK
The first well-known work that proposed the reuse of
working solutions to common software engineering
problems and their description in design pattern cata-
log was the one published by Gamma et al. (Gamma
et al., 1995). This work was followed by the Pattern-
Oriented Software Architecture (POSA) series
(Buschmann et al., 1996) (Schmidt et al. 2000)
(Kircher and Jain, 2004) (Buschmann, Henney and
Schmidt, 2007a) (Buschmann, Henney and Schmidt,
2007b). Apart from the design patterns applicable in
general software engineering problems that were de-
scribed in these books, more specific design patterns
have also been published. In the field of DSLs,
(Fowler, 2010) provides a pattern catalog, covering
several different aspects of DSLs and code genera-
tion. This is a rich source of information but it has a
more general view than this paper and does not in-
clude the pattern described herein. Apart from this,
(Nguyen, Ricken and Wong, 2005) provides some
practical uses of general object-oriented design pat-
terns in recursive descent parsers and (Schreiner and
Heliotis, 2001) describes how a parser generator uses
object-oriented design patterns. These are specific
uses of general design patterns and these papers do
not include more specialized patterns specific to mod-
eling. A paper have been published with a pattern cat-
alog (Kövesdán, Asztalos and Lengyel, 2014a) of ar-
chitectural design patterns that can be used in lan-
guage parsers. Another paper (Kövesdán, Asztalos
and Lengyel, 2014b) introduces Polymorphic Tem-
plates, a design pattern that provides a solution for
implementing flexible code generators. An additional
case study (Kövesdán, Asztalos and Lengyel, 2014c)
briefly describes the use of the Aggregate Callback
and the Polymorphic Templates design patterns.
However, the Aggregate Callback design pattern is
only shortly outlined in this earlier paper. It has not
been elaborated at the level of detail as done herein.
Apart from the works cited above, we have not found
other works that provide more specialized design pat-
terns that apply to modeling.
The design pattern is useful on its own but it is
also a part of a longer work that the authors have been
doing. A more extensive method is being elaborated
that helps the development of code generation tools
supported by DSLs.
3 THE AGGREGATE CALLBACK
DESIGN PATTERN
This section describes the design pattern in catalog
format similar to what is used in the POSA series.
Namely, the following sections are applied:
Example: a concrete use case in which the pat-
tern has been applied.
Context: the context in which the design pattern
is applicable.
Problem: the challenges that suggest the appli-
cation of the pattern.
Solution: the way how the pattern solves or mit-
igates the problems.
Structure: the main participants and their rela-
tionships and responsibilities in the pattern.
Dynamics: the interaction of the participants of
the pattern.
Implementation: techniques and considerations
for implementing the pattern.
Consequences: advantages and disadvantages
that the application of the pattern implies.
Example Resolved: the short description of how
the initially presented example has been re-
solved by using the pattern.
See Also: references to related design patterns.
The Known Uses section is omitted. Describing more
known uses is out of scope of this paper.
3.1 Example
Applications written for the Android platform have
several different component types and artefacts,
namely Activities, Services, Content Providers, In-
tents, Intent Filters etc. Some of them have more spe-
cific subtypes, such as IntentService. In the meta-
model of our component modeling tool, they are or-
ganized into a class hierarchy. The AndroidApplica-
tion model class aggregates an arbitrary number of
Components, regardless of their concrete type.
MODELSWARD2015-3rdInternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
150