<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Towards Better Support for Pattern-Oriented Software Development</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Software Engineering Research Group, Heinz Nixdorf Institute &amp; Department of Computer Science, University of Paderborn</institution>
          ,
          <addr-line>Warburger Str. 100, D-33098 Paderborn</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Design patterns document approved solutions for recurring design problems. Due to their vague description such patterns are widely applicable, but their application is error-prone. Since pattern applications are rarely documented, the originally intended design tends to deviate during software evolution. With my research I aim at explicitly modeling and validating pattern applications in design models in order to maintain an up-to-date documentation and reduce design deviation.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        When developing or adapting software, developers have to solve similar design
problems over and over again. In order to reuse good solutions for common design
problems, experts have documented approved solutions as software patterns. One
of the most famous summaries of software patterns are Design Patterns described
by Gamma et al. [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. A design pattern has a unique name and consists of a
problem description, the intent, a general description of the design that solves
the problem, and consequences.
      </p>
      <p>
        For the purpose of making such solutions reusable in many cases, they are
described informally and in a very general way. Instead of documenting a
concrete design, only the main idea is described. Unfortunately, this results in a lot
of work and complicated decisions that are necessary to transfer a solution to
and re ne it for a concrete software design. The same holds for other software
pattern descriptions, too [
        <xref ref-type="bibr" rid="ref1 ref10 ref2 ref3 ref8">3, 2, 10, 8, 1</xref>
        ].
      </p>
      <p>
        Any pattern's exemplary design described in literature has to be manually
adapted to the existing software design, i.e. a developer has to identify design
parts that are to be added or adapted. The resulting design changes are
usually performed manually. Furthermore, once a software pattern is applied, it is
rarely documented or the current design deviates from its documentation due to
subsequent design changes. This may result in design erosion [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] and the loss
of the original developer's intent (e.g. to decouple certain software parts, make
them replaceable and thus make the software more exible).
      </p>
      <p>My research aims at the development of methods and tools for model-driven
software development that support software engineers in formally specifying
software patterns, exibly applying such patterns to an existing software design
model, documenting the pattern applications, and validating the design in case of
changes a ecting the pattern applications.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        Since the introduction of software patterns, esp. design patterns [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], about 15
years ago, several researchers tried to formally specify patterns [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], e.g. in order
to develop tools that automatically or interactively apply a pattern to an existing
design or check whether the design conforms to a pattern. Most of them use sets
of logic formulas to describe a pattern. But in many cases formulas are less
comprehensible dable than graphical design description languages like UML,
where relations are clearly visualized.
      </p>
      <p>
        An example for a graphical and yet formal pattern speci cation language is
the LePUS language [
        <xref ref-type="bibr" rid="ref11 ref9">9, 11</xref>
        ]. The proposed approach enables developers to check
if a pattern implemention complies with its formal LePUS speci cation. A major
drawback is the need for extensive user interaction before a conformance check
can be performed.
      </p>
      <p>
        There are also some approaches where patterns are speci ed in UML or
UML-like languages. One of them uses specialized class and sequence diagrams
as well as OCL [
        <xref ref-type="bibr" rid="ref11 ref6">6, 11</xref>
        ]. However, currently there is no tool support for validation
of applied patterns.
      </p>
      <p>
        Furthermore, none of the approaches mentioned so far [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] provides support
for application of patterns in an existing design and applied patterns cannot be
documented in design models.
      </p>
      <p>
        An early research result [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] enables developers to specify their own patterns,
to apply patterns in an existing Smalltalk application, and to check previously
speci ed constraints in order to ensure that the implementation complies with
the pattern. Nevertheless, the pattern application and validation operations have
to be implemented manually, which complicates the speci cation of new patterns.
Furthermore, they are applied to code, not to design models which are preferred
in a model-driven software development process.
      </p>
      <p>Commercial tools like IBM Rational Software Architect1, Sparx Enterprise
Architect2, and Borland Together 3also use UML to specify software patterns.
In the Rational Software Architect, pattern applications are explicitly modeled
and thus documented in UML models. Applying a pattern modi es a UML
model and creates classes, methods, etc. But for each new pattern an expert has
to manually implement the pattern application operations. Enterprise
Architect and Together only save exemplary design parts in order to re-instantiate
them later. Enterpise Architect in addition provides rudimentary functionality
1 http://www-01.ibm.com/software/awdtools/swarchitect/websphere
2 http://www.sparxsystems.de
3 http://www.borland.com/us/products/together/index.html
to merge such an example model with an existing design. Besides, neither of
these tools supports validation of applied patterns.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Proposed Approach</title>
      <p>With my research I focus on model-driven software development. I assume that
there is a design model that is created by a developer and used for code
generation. Software patterns will be applied on such a model and will be documented
and checked in such a model.</p>
      <p>In order to formally specify software patterns, I propose a language that
is capable of describing the pattern structure and most of the corresponding
behavior as well as constraints that de ne the properties to be preserved after
a pattern application. In order to base my language on concepts such as types,
attributes, operations, type relations like associations and inheritance, as well as
behavioral aspects like read or write access, delegation, etc., I restrict the design
models to object-oriented models like the UML. In addition, I plan to support
compositions of pattern speci cations in order to increase reuse and to simplify
the speci cation of complex patterns.</p>
      <p>I am currently developing a meta-model and a graphical syntax for the
pattern speci cation language that de nes all language constructs. A rst draft of
a pattern speci cation based on this language is illustrated in Figure 1.
set subjects</p>
      <p>«type»</p>
      <p>ConcreteSubject
feature
«feature»
state
feature</p>
      <p>1
write
call
«type»</p>
      <p>Subject
«operation»
notify
callee
observers
objects
{
*
«type»</p>
      <p>Observer
delegate
callee «operation»
update
set observers</p>
      <p>«type»
subject ConcreteObserver</p>
      <p>«operation»
concreteUpdate
read</p>
      <p>
        As an example, I speci ed the Observer pattern [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Between the types
Subject and Observer a reference observers with cardinality * is speci ed. The
subject's notify operation delegates its functionality to an observer's update
operation, which is illustrated by a delegate node and corresponding arrows. In
contrast to other approaches, it is also speci ed on which objects the update
operation is to be called: in this case on each Observer object (denoted as f8g)
referenced by the observers reference. Moreover, control ow can be speci ed as
well. For example, a write access to the state feature (this can be an attribute or
a reference) is followed by a call of the notify operation (denoted as solid arrow
between the nodes write and call). Set fragments (rectangles labelled with set )
specify groups of elements that as a whole can be created multiple times in the
target design model, e.g. a concrete observer type with a corresponding concrete
update operation can be created several times.
      </p>
      <p>I plan to provide tool support for the speci cation of patterns as well as their
semi-automated application. In order to apply a pattern in an existing design
model (e.g. a model of classes), a developer rst speci es which parts of the design
he would like to reuse. For that purpose, the developer maps existing design
model elements (e.g. existing classes) to the pattern roles (nodes in Figure 1)
that are to be played. In a next step, the tool will automatically adapt the design
model by creating new model elements for each role that is not mapped. This
way, the pattern application remains exible and the developer decides in each
situation what is going to be re-used or created anew.</p>
      <p>
        The actual pattern application will be performed by means of a model
transformation which is generated based on the selected pattern and the selected
design model elements to be re-used. Due to their formal semantics, available
tool support, and our research group's expertise, I plan to use so-called story
diagrams [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] to specify the transformations. Story diagrams are specialized UML
activity diagrams where the actions are graphically speci ed as graph grammar
rules. These rules describe the object structures to be found and corresponding
structure modi cations.
      </p>
      <p>Pattern applications will be documented as rst-class constructs in the target
modeling language so that developers do not loose track of applied patterns. This
can be done by annotating the original design model (e.g. a class diagram) and
visualizing the elements involved in a pattern application as well as the roles they
are playing. For this purpose, I will provide an adequate notation and annotation
mechanism.</p>
      <p>If the design model is changed after a pattern application, the a ected design
elements are to be checked if they still comply with the pattern speci cation.
For example, it can be checked if once created model elements still exist and if
the speci ed constraints are satis ed, e.g. the design complies to speci ed access
restrictions.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Summary and Evaluation Idea</title>
      <p>Tool support as described above can signi cantly ease software development. By
applying patterns, design solutions can be re-used on a high level of
abstraction, the pattern applications are automatically documented in the model, and
corresponding constraints are automatically checked after design modi cations
so that the original intent is preserved. The major goals of this approach are
improved comprehendability of design models and reduced design deviation.</p>
      <p>I plan to provide a prototype and to apply my development methodology to a
realistically-sized software project in order to assess the bene ts and drawbacks
of my approach. Furthermore, I plan to compare traditional and the proposed
pattern-oriented software development in an experimental setting.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Deepak</surname>
            <given-names>Alur</given-names>
          </string-name>
          , John Crupi, and
          <string-name>
            <given-names>Dan</given-names>
            <surname>Malks</surname>
          </string-name>
          .
          <article-title>Core J2EE Patterns { Best Practices</article-title>
          and
          <string-name>
            <given-names>Design</given-names>
            <surname>Strategies</surname>
          </string-name>
          . Core Design Series. Prentice Hall, Sun Microsystems Press,
          <volume>2</volume>
          <fpage>edition</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Frank</given-names>
            <surname>Buschmann</surname>
          </string-name>
          , Regine Meunier, Hans Rohnert,
          <string-name>
            <given-names>Peter</given-names>
            <surname>Sommerlad</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Michael</given-names>
            <surname>Stal</surname>
          </string-name>
          .
          <article-title>Pattern-Oriented Software Architecture { A System of Patterns, volume 1 of Software Design Patterns</article-title>
          . John Wiley and Sons, Ltd,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>James</surname>
            <given-names>O.</given-names>
          </string-name>
          <string-name>
            <surname>Coplien</surname>
          </string-name>
          and Douglas C. Schmidt, editors.
          <source>Pattern Languages of Program Design</source>
          , volume
          <volume>1</volume>
          of Software Patterns Series. Addison-Wesley,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Thorsten</given-names>
            <surname>Fischer</surname>
          </string-name>
          ,
          <article-title>Jorg Niere, Lars Torunski, and Albert Zundorf. Story Diagrams: A New Graph Rewrite Language Based on the Uni ed Modeling Language and Java</article-title>
          . In Hartmut Ehrig, Gregor Engels, Hans-Jorg Kreowski, and Grzegorz Rozenberg, editors,
          <source>Theory and Application of Graph Transformations (TAGT'98)</source>
          , volume
          <volume>1764</volume>
          of Lecture Notes in Computer Science, pages
          <volume>296</volume>
          {
          <fpage>309</fpage>
          . Springer,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Gert</given-names>
            <surname>Florijn</surname>
          </string-name>
          , Marco Meijers, and Pieter van Winsen.
          <article-title>Tool Support for ObjectOriented Patterns</article-title>
          . In ECOOP'
          <volume>97</volume>
          {
          <string-name>
            <surname>Object-Oriented</surname>
            <given-names>Programming</given-names>
          </string-name>
          , volume
          <volume>1241</volume>
          /1997 of Lecture Notes in Computer Science. Springer Berlin / Heidelberg,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Robert</surname>
            <given-names>B</given-names>
          </string-name>
          . France,
          <string-name>
            <surname>Dae-Kyoo</surname>
            <given-names>Kim</given-names>
          </string-name>
          , Sudipto Ghosh, and
          <string-name>
            <given-names>Eunjee</given-names>
            <surname>Song</surname>
          </string-name>
          .
          <article-title>A UML-Based Pattern Speci cation Technique</article-title>
          .
          <source>IEEE Transactions on Software Engineering</source>
          ,
          <volume>30</volume>
          (
          <issue>3</issue>
          ):
          <volume>193</volume>
          {
          <fpage>206</fpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Erich</surname>
            <given-names>Gamma</given-names>
          </string-name>
          , Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns:
          <article-title>Elements of Reusable Object Oriented Software</article-title>
          .
          <source>Addison-Wesley</source>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Robert</surname>
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Hanmer</surname>
          </string-name>
          .
          <article-title>Patterns for Fault Tolerant Software</article-title>
          .
          <source>Software Design Patterns</source>
          . John Wiley and Sons, Ltd,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Jonathan</given-names>
            <surname>Nicholson</surname>
          </string-name>
          , Epameinondas Gasparis,
          <string-name>
            <surname>Amnon H. Eden</surname>
            , and
            <given-names>Rick</given-names>
          </string-name>
          <string-name>
            <surname>Kazman</surname>
          </string-name>
          .
          <source>Automated Veri cation of Design Patterns with LePUS3</source>
          .
          <source>In 1st NASA Formal Methods Symposium</source>
          , Mo ett Field, California,
          <year>April 2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Douglas</surname>
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Schmidt</surname>
          </string-name>
          , Michael Stal, Hans Rohnert, and Frank Buschmann.
          <source>PatternOriented Software Architecture { Patterns for Concurrent and Networked Objects</source>
          , volume
          <volume>2</volume>
          of Software Design Patterns. John Wiley and Sons, Ltd,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Tou</surname>
          </string-name>
          k Taibi, editor.
          <source>Design Pattern Formalization Techniques. IGI Publishing</source>
          , Hershey, PA, USA,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. Jilles van Gurp and
          <string-name>
            <given-names>Jan</given-names>
            <surname>Bosch</surname>
          </string-name>
          .
          <article-title>Design erosion: problems and causes</article-title>
          .
          <source>The Journal of Systems and Software</source>
          ,
          <volume>61</volume>
          (
          <issue>2</issue>
          ):
          <volume>105</volume>
          {
          <fpage>119</fpage>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>