<!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>Using Bonds for Describing Method Dispatch in Role-Oriented Software Models</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Henri Muhle</string-name>
          <email>Henri.Muehle@tu-dresden.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Technische Universitat Dresden Institut fur Algebra</institution>
        </aff>
      </contrib-group>
      <fpage>344</fpage>
      <lpage>349</lpage>
      <abstract>
        <p>Role-oriented software modeling is an approach to objectoriented software engineering which provides a stricter encapsulation by separating the type behavior from the object into so-called roles. This role behavior can dynamically be accessed in certain situations and extends or alters the original type behavior. The process of extending or altering type behavior in object-oriented systems is realized by so-called method dispatch which controls message sending and routing. It is thus essential to guarantee the correct execution of the model. In this paper we present a context-based construction to describe the method dispatch via special formal contexts containing bonds. It turns out that the bond-induced morphisms serve well for determining the role method which is bound to a certain base method during runtime. This formal context can also be used to check the role model and determine whether base and role methods are bound correctly.</p>
      </abstract>
      <kwd-group>
        <kwd>Formal Concept Analysis</kwd>
        <kwd>Role-Oriented Software Modeling</kwd>
        <kwd>Method Dispatch</kwd>
        <kwd>Concept-Driven Framework</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Role orientation is an approach to object-oriented software modeling that relies
on separating the behavior from the object. It was introduced in the 1990s by
Trygve Reenskaug [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and later investigated by Friedrich Steimann [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], who also
gave a rst formalisation of this approach, along with a proposal for an UML
notation of these concepts. Role types encapsulate common behavior that is
required in certain situations into separate modules. In contrast to subclassing
or delegation { as standard techniques in object-orientation for encapsulating
and altering behavior { role types allow for exible and dynamic change of
behavior without reinstantiating the object.
      </p>
      <p>
        The scope of this paper lies in formalizing the method dispatch in
roleoriented software models. Method dispatch is a mechanism in object-oriented
software models that determines and invokes the correct piece of code for a
certain method call [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Subsidiary to method dispatch along the inheritance
hierarchy in standard object-oriented models, role-oriented modeling adds
another dimension of method dispatch along the role-play relation. It is our goal to
provide a sound, concept-based representation of this kind of method dispatch.
However, our approach shall not be seen as a mechanism to implement method
dispatch in role-oriented languages in order to allow for better performance. It
shall serve as a design aid with whose help role modelers can check their models
for correctness and may receive design advices to improve their models.
      </p>
      <p>
        Formal Concept Analysis (FCA) establishes a connection between binary
relations and complete lattices [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Its basic elements are formal contexts,
i. e. triplets G; M; I where G is a set of objects, M is a set of attributes
and I b G M describes whether an object has an attribute. Introducing two
derivation operators for A b G resp. B b M
      </p>
      <p>AI m &gt; M S ƒ g &gt; A gIm b M; BI g &gt; G S ƒ m &gt; B gIm b G
one can create formal concepts of a formal context G; M; I as pairs A; B
with A b G; B b M; AI B; BI A. A is then called extent, B is called intent.
With introducing an order relation on the set B G; M; I of concepts via
A1; B1 B A2; B2</p>
      <p>A1 b A2</p>
      <p>B1 b B2
the basic theorem of FCA [2, p. 20] states that B G; M; I B G; M; I ; B is
indeed a complete lattice.</p>
      <p>An interesting way to combine two contexts is done via so-called bonds.
Given two contexts Ks Gs; Ms; Is ; Kt Gt; Mt; It , a relation Jst b Gs Mt
is called bond, i g Jst is an intent of Kt for each object g &gt; Gs and m Jst is
an extent of Ks for each attribute m &gt; Mt. As stated in [1, p. 15] each bond Jst
induces two morphisms
'st B Gs; Ms; Is</p>
      <p>B Gt; Mt; It ;
st B Gt; Mt; It</p>
      <p>B Gs; Ms; Is
by
'st A; AIs</p>
    </sec>
    <sec id="sec-2">
      <title>AJstIt ; AJst ;</title>
      <p>st BIt ; B</p>
    </sec>
    <sec id="sec-3">
      <title>BJst ; BJstIs</title>
      <p>
        The rest of the paper is organized as follows: In Section 2 we show the
essential contexts to represent a role model in order to describe the method
dispatch. A more detailed explanation of the model construction, as well as
some results that show the unambiguousness of our approach can be found in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
Section 3 presents our dispatch algorithm as well as an example for clari cation.
Concluding this paper, Section 4 summarizes our results and Section 5 gives an
outlook towards future work.
2
      </p>
      <sec id="sec-3-1">
        <title>Model Construction</title>
        <p>
          Since we provided a concept-based approach for describing role models and role
play [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] it appears consequent to construct a concept-based formalization of the
role-oriented method dispatch in order to create a sound and extensive
formalization apparatus which could support software designers in their work.
2.1
        </p>
        <p>
          Combined Representation for the Static Model
To create a suitable formal context for our purpose, we keep close to the approach
in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] using type names as formal objects, type methods as formal attributes and
type-method-incidence as context incidence. Due to the restricted length of this
paper we leave the explicit construction of both (role and base type) hierarchies
to [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] and instantly present the combined context.
        </p>
        <p>De nition 1. Let C B; R; P be a role model1, MB; MR sets of base resp.
role type methods, IB; IR the respective incidence relations. Let VB; VR be sets of
virtual objects2. The formal context G; M; J with</p>
        <p>G</p>
        <p>B^ &lt; R^;</p>
        <p>M</p>
        <p>MB &lt; MR;</p>
        <p>J</p>
        <p>I^B 8 I^R 8 JBR
such that JBR b B^</p>
        <p>MR is called binding context of C. We have
VB
b; m S § b &gt; B; m &gt; MB bIBm
;</p>
        <p>NB
v; m S § v
b; m &gt; VB
VR and NR are de ned analogously. If JBR forms a bond between
and R^; MR; I^R and ful lls the following conditions
B^; MB; I^B
ƒ b &gt; B; m &gt; MR</p>
        <p>b; m &gt; JBR
ƒ v</p>
        <p>b; w &gt; VB vJ b bJ
ƒ v &gt; VB SvJBR S 1
ƒ m &gt; MR
mJBR x g</p>
        <p>^
§ r &gt; mIR bP r
(1)
(2)
(3)
(4)
G; M; J is called proper binding context.</p>
        <p>The virtual objects in VB resp. VR are necessary to explicitly distinguish
between the methods. We thus are able to adress each method with a special
concept and thus receive unique mappings under 'BR resp. BR.</p>
        <p>
          The rst two conditions of De nition 1 describe that the bond combines only
such base types (and their respective virtual objects) with role methods if the
according base type can play the according role type. The third condition says
that each virtual object needs to be bound to exactly one role method. This
is a comprehensible claim, since virtual objects in a sense represent base type
methods and we assumed that each base type method is bound to exactly one
role type method [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]. And lastly, the fourth condition says that for each role
method there needs to exist at least one virtual object (and thus at least one
base method) that is bound to this role method.
2.2
        </p>
        <p>
          Dynamic Model for the Base Type Hierarchy
Since we want to describe the method dispatch during runtime it is necessary to
describe the runtime instances in a formal context as well. According to [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] role
types do not provide their own instances but are played by base type instances.
De nition 2. Let B^; MB; I^B be as de ned in De nition 1. Let It describe the
set of all active instances at the point of runtime t &gt; T . We will then introduce
1 Cf. [5, p. 5]
2 From now on let B^
the method call context B^t
        </p>
        <p>B^t; MB; I^Bt
B^t</p>
        <p>B^ 8 It;</p>
        <p>I^Bt
via
I^B 8 Ct
where</p>
        <p>Ct</p>
        <p>i; m S § i &gt; It; m &gt; MB i receives a call from m</p>
        <p>It has to be said that we assume a sequential execution of our role model,
i. e. each instance can only call one single method at a time. This is su cient
since one can easily map parallel activities to a sequential execution plan.
3</p>
        <p>Performing the Method Dispatch
It is essential for role modeling to determine at runtime the method dispatch
between base types and the according role types. At modeling time (i. e. when
setting up the role model) each method mb &gt; bIB of a base type b &gt; B is assigned
to a method mr &gt; rIR of a respective role type r &gt; R that can be played by b in
order to alter the behavior of the base type when playing this role. At runtime
it is necessary to correctly dispatch method calls from the base type method to
the appropriate role type method to guarantee correct altering of the behavior.</p>
        <p>For resolving the method dispatch, we will use the bond-induced morphisms
'BR and BR of the proper binding context as recalled in Section 1.</p>
        <p>Let t &gt; T be a point of runtime and i &gt; It a certain instance receiving a
method call from m &gt; MB. Algorithm 1 shows how the role method m~ &gt; MR
that is bound to m can be determined.</p>
        <p>Algorithm 1 An algorithm for method dispatch</p>
        <p>
          The algorithm requires the appropriate method call context as well as the
proper binding context and gets an active instance i &gt; It as well as a base type
method m &gt; MB as inputs. It needs to be ensured that i indeed receives a call
from m. Applying the bond-induced morphism 'BR from the base type context
to the role type context to the attribute concept of m we receive a concept
having only role methods in its intent. One can show that 'BR maps concepts
having only one base method in their intent towards concepts having only one
role method in their intent which guarantees the determinacy of the result. [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]
Example 1. A proper binding context for the role model in Figure 1 is shown in
Figure 2. Let us assume a set I A mann; Muhle; Wende of runtime instances. If
we further assume a point of runtime where Professor A mann holds a lecture and
explains a situation, Student Wende writes down some notes and Student Muhle
tries to chatter with his neighbor, we receive a method call context as depicted in
        </p>
        <sec id="sec-3-1-1">
          <title>Require: method call context Bt</title>
          <p>instance i &gt; It, method m &gt; MB
^t
Ensure: m &gt; iIB
1: c mI^B ; mI^BI^B
2: c~ 'BR c
3: m~ int c~
4: return m~</p>
        </sec>
        <sec id="sec-3-1-2">
          <title>B^t; MB; I^Bt , proper binding context G; M; J ,</title>
          <p>Lecture</p>
          <p>Lecturer
material:Collection
explainClearly():void
writeNeatly():void</p>
          <p>Participant
material:Collection
grade:int
chatterQuietly():void
writeNeatly():void
Professor
Pr1
Pr2
AssistantProfessor
As1
As2
Student
St1
St3
Lecturer
Le1
Le2
Participant
Pa1</p>
          <p>Pa3
Role-oriented software modeling is an approach towards object-oriented software
engineering, gaining a higher encapsulation and modularization of software
models by separating the behavior from the object. The behavior is encapsulated in
special modules, roles, and is woven into the software model during runtime.</p>
          <p>The crucial point in role modeling is the so-called method dispatch, which
redirects method calls to base methods towards appropriate role methods and
thus enables the intended change of type behavior. Since the model designer
determines at modeling time which base methods can be altered by which role
methods when playing the respective role, it has to be guaranteed that
performing the method dispatch during runtime strictly follows these assignments.</p>
          <p>Our approach uses a context construction via so-called bonds to create special
formal contexts which uniquely represent the assignment between base and role
methods. We then presented an algorithm using these contexts to determine the
role method that is assigned to a given base method. Our construction can thus
be used to assist the process of role-oriented software modeling.
5</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>Outlook</title>
        <p>
          Together with the results from [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], where we introduced a basic context
representation for base and role type hierarchy, as well as for the role-play relation, this
paper can be seen as a basic fundament for a formal, concept-based description
language for role-oriented software modeling.
        </p>
        <p>However, there are still a lot of open elds of research to completely cover
role modeling with concept-based constructions. Among others, it is on the one
hand necessary to describe composition and decomposition of large role models,
e. g. to build kind of a design advisor for role models that helps to identify
redundancy or inconsistencies of the model. On the other hand, it is necessary
to provide an extensive framework to represent role-play constraints or special
characteristics of role-oriented software design, like multiple role play. Since we
have already applied FCA successfully towards the foundations of role modeling,
a further research in this direction will be very promising.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Bernhard</given-names>
            <surname>Ganter</surname>
          </string-name>
          .
          <article-title>Relational Galois Connections</article-title>
          .
          <source>In ICFCA 2007 Proceedings</source>
          , pages
          <fpage>1</fpage>
          <lpage>{</lpage>
          17. Springer,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Bernhard</given-names>
            <surname>Ganter</surname>
          </string-name>
          and
          <string-name>
            <given-names>Rudolf</given-names>
            <surname>Wille</surname>
          </string-name>
          .
          <source>Formale Begri sanalyse: Mathematische Grundlagen</source>
          . Springer, Heidelberg,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Robert</given-names>
            <surname>Godin</surname>
          </string-name>
          and
          <string-name>
            <given-names>Petko</given-names>
            <surname>Valtchev</surname>
          </string-name>
          .
          <article-title>Formal Concept Analysis-based Class Hierarchy Design in Object-Oriented Software Development</article-title>
          .
          <source>In Formal Concept Analysis: Foundations and Applications</source>
          , pages
          <volume>304</volume>
          {
          <fpage>323</fpage>
          . Springer,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Wade</given-names>
            <surname>Holst</surname>
          </string-name>
          and
          <string-name>
            <given-names>Duane</given-names>
            <surname>Szafron</surname>
          </string-name>
          .
          <article-title>A General Framework for Inheritance Management and Method Dispatch in Object-Oriented Languages</article-title>
          .
          <source>In ECOOP 1997 Proceedings</source>
          , pages
          <volume>276</volume>
          {
          <fpage>301</fpage>
          ,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5. Henri Muhle and
          <string-name>
            <given-names>Christian</given-names>
            <surname>Wende</surname>
          </string-name>
          .
          <article-title>Describing Role Models in Terms of Formal Concept Analysis</article-title>
          .
          <source>In ICFCA 2010 Proceedings</source>
          , pages
          <volume>241</volume>
          {
          <fpage>255</fpage>
          . Springer,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Henri</given-names>
            <surname>Mu</surname>
          </string-name>
          <article-title>hle. Using Bonds for Describing Method Dispatch in Role-Oriented Software Models</article-title>
          .
          <source>Preprint MATH-AL-04-2010</source>
          ,
          <string-name>
            <given-names>TU</given-names>
            <surname>Dresden</surname>
          </string-name>
          ,
          <source>Institut fur Algebra</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>T.</given-names>
            <surname>Reenskaug</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Wold</surname>
          </string-name>
          , and
          <string-name>
            <given-names>O. A.</given-names>
            <surname>Lehne</surname>
          </string-name>
          .
          <article-title>Working with Objects: The OOram Software Engineering Method</article-title>
          . Manning Publications, Greenwich,
          <string-name>
            <surname>CT</surname>
          </string-name>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Friedrich</given-names>
            <surname>Steimann</surname>
          </string-name>
          .
          <article-title>On the Representation of Roles in Object-Oriented and Conceptual Modelling</article-title>
          .
          <source>Data Knowledge Engineering</source>
          ,
          <volume>35</volume>
          :
          <fpage>83</fpage>
          {
          <fpage>106</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>