<!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>Modeling Reusable Concurrent Passive Entity Ob jects in Colored Petri Nets</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Rowland Pitts</string-name>
          <email>rpitts@gmu.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hassan Gomaa</string-name>
          <email>hgomaa@gmu.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>George Mason University</institution>
          ,
          <addr-line>Fairfax, Virginia</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <fpage>217</fpage>
      <lpage>222</lpage>
      <abstract>
        <p>Concurrent software systems are growing increasingly large and complex; the risks associated with poor design and architectural choices are increasing as well. Building executable prototypes can help identify problems early and Colored Petri Nets are well suited to this purpose. This paper presents an approach to modeling reusable threadsafe passive entity objects in Colored Petri Nets, including public, private and static members, plus encapsulation and object composition.</p>
      </abstract>
      <kwd-group>
        <kwd>colored Petri nets</kwd>
        <kwd>concurrency</kwd>
        <kwd>rapid prototyping</kwd>
        <kwd>passive entity object</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Concurrent software systems are growing increasingly large and complex.
Consequently, the risks associated with poor design and architectural choices are
increasing as well. Assembling executable models can help to identify problems
early, and Colored Petri Nets (CPN) [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] are well suited for building executable
concurrent software models; additionally, the language primitives facilitate the
modeling of reusable design pattern templates [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], as well as the passive entity
objects they interact with.
      </p>
      <p>
        In spite of the fact that failure is increasingly expensive [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], often little
consideration is given to system performance or reliability until a project is already
implemented; unplanned behavioral analysis is typically inefficient, unreliable
and difficult to repeat [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>
        CPNs routinely depict concurrent software systems as tokens moving through
a series of operations (transitions), sequentially or navigating control structures,
analogous to dynamic flow charts. This paper introduces an approach to
modeling thread-safe objects, with an emphasis on object-oriented properties, such
as information hiding, providing a public interface of operations, and reusability
using CPN Tools [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>This paper is organized as follows: Section 2 discusses related work, Section
3 introduces the modeling approach and Section 4 provides validation. Section
5 discusses conclusions and future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>There is much literature devoted to the analysis of concurrent software with
CPNs, and some related to object modeling.</p>
      <p>
        Bauskar and Mikolajczak modeled objects using CPN’s hierarchical
capabilities [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Jensen and Kristensen have examined reusability using CPNs
hierarchical capabilities [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Costa and Gomes propose module replication, composition
and defining interfaces [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Barros and Gomes discuss transitions as functions
with input parameters and also the creation and destruction of objects [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Pettit,
Fant and Gomaa have modeled behavioral design patterns and communication
templates, including threads-of-control [
        <xref ref-type="bibr" rid="ref11 ref12 ref7">7, 12, 11</xref>
        ]. Lakos introduces Object Petri
Nets, which incorporate inheritance, polymorphism, dynamic binding, and
include a single class hierarchy of both token and subnet types [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. The Reference
Net Workshop supports object references as tokens [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ].
      </p>
      <p>This paper focuses on combining a number of object-oriented properties while
modeling concurrent objects, such as information hiding, providing a public
interface of operations, static variables and operations, and reusability, as well as
modeling threads-of-control by which a client can animate passive entity objects
as needed.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Object Modeling in CPN</title>
      <p>Constructed
n
a</p>
      <p>a1
Person()
setAge()
age INT
a
ctrl
a</p>
      <p>n
CPNs are not inherently object-oriented; however, the language primitives allow
for almost infinite flexibility. To the extent that visual structure aids in conveying
a designer’s intent, the following conventions, illustrated in Figure 1, are utilized
for object modeling. The behavior otherwise modeled in Figure 1 is discussed
in more detail in the next subsection.
Input and Output Parameters are depicted across the bottom of their class
diagrams, grouped by operation, and indicated by a double-line, as opposed to
a single line. This includes threads-of-control, which determine the sequence in
which modeled operations execute. Placing tokens into the input places, and
retrieving tokens from the output places, is the means by which clients
communicate with objects.</p>
      <p>Operations comprising a class’ public interface are represented as transitions
just above, and connected by arcs to, their respective inputs and outputs.
Modeling operations as transitions works well for multiple reasons: transitions perform
conversions, and CPN Tools’ hierarchical capabilities facilitate the creation of
reusable objects that effectively enforce communication through the defined
public interface and otherwise prevent access to an object’s non-public members.
Instance Variables are depicted as places in the space above the public
interface operations, or as objects as described herein, and are maintained by the
public operations or by other internal functions.
3.2</p>
      <sec id="sec-3-1">
        <title>A Simple Class Example</title>
        <p>Concurrency: No two operations can simultaneously access an object’s
values. No operation can execute until the constructor has been initially executed.
Furthermore, the constructor cannot re-execute after the object is created.
Encapsulation: When used, a Person object’s data elements and functionality
are encapsulated within the object, providing the client with only indirect access
through the defined public operations. An example Employee object is depicted
in the uppermost region of Figure 2.</p>
        <p>Reusability: Any number of Person objects may be used within a CPN.
3.3</p>
      </sec>
      <sec id="sec-3-2">
        <title>A More Complex Example</title>
        <p>Figure 2 represents an Employee class definition, which features a composed
object (Person1), a static variable (employeeCount) and associated static accessor
method (getCount()), and a meta-variable (lock) used for synchronization.
Employee also includes a constructor (Employee()) and a toString() operation.
Given the relative complexity of this example, representing an operation with a
single transition is insufficient. Treating these as atomic actions would result in
the thread-of-control being released to the client prematurely, and potentially
cause concurrency issues. Therefore, an inbound transition fires to initiate the
behavior sequence, and a return transition fires when the process is complete,
releasing the thread-of-control and return values at the appropriate time.</p>
        <p>For simplicity, a minimal number of operations have been modeled; however,
more could easily be added. For example, setAge() and setName() could be
added, and connected to the otherwise unused equivalents in Person1.</p>
        <p>CTRL</p>
        <p>GA
in
INT setAge</p>
        <p>In
CTRL GA</p>
        <p>out
c+1
c
ctrl
c</p>
        <p>ctrl</p>
        <p>GC Num GC
In in Emp's Outout
CTRLOut INT CTRL
n</p>
        <p>ctrl</p>
        <p>C'tor
Employee
In Age</p>
        <p>INT</p>
        <p>C'tor
Employee
In Name</p>
        <p>STRING</p>
        <p>E E
In in Outout
CTRL CTRL</p>
        <p>Person
Person1</p>
        <p>CTRL
emp
ID
INT
lock</p>
        <p>GN CTRL
out
setName STRING</p>
        <p>In</p>
        <p>GinN CTRL
TS
in
id
person TS
toString out
STRING
ctrl
str</p>
        <p>CTRL</p>
        <p>ctrl
toString()
toString</p>
        <p>Return
ctrl</p>
        <p>ctrl</p>
        <p>
          TSe TSe toString
In in Outout Employee
CTRL CTRL OutSTRING
str^" ID:"
^INT.mkstr(id)
Concurrency: The Employee class employs a more explicit locking mechanism.
When the constructor executes, a token is moved to the lock place. To ensure
mutually exclusive access, each instance-method must acquire the lock before
executing and return it when finished [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. Therefore, no two can execute
simultaneously (given the scope of this short paper, only one such method is depicted,
but any additional methods would acquire and release the lock token in the same
way). Non-static methods cannot execute until the constructor has been invoked
to create the object, and the constructor cannot re-execute once the object is
created.
Encapsulation: An Employee object’s data elements, including a Person
object, and functionality are encapsulated. Employee provides only indirect access
to itself through the defined public operations.
        </p>
        <p>Reusability: Any number of Employee objects may be used within a CPN;
additionally, each Employee object also re-uses a Person object.
Static Behavior: The employeeCount place is effectively made static by
defining it as a fusion place, facilitated by CPN Tools. Its initial marking is zero
(simulating an initialized value), and is incremented each time an instance of
Employee’s constructor is invoked. The value in the fusion place is shared by
all instances of Employee; therefore, invoking the getCount() method in any
instance of Employee will return the same value.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Validation</title>
      <p>
        The limited length of this short paper permits only a brief description of the
validation carried out; however, tests were conducted to determine that each
modeled object’s operations execute correctly and that the synchronization
considerations ensure that there is no detrimental conflict for shared data. A unit
testing approach was employed, because it offers “the most effective means to
test individual software components for boundary value behavior" [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Figure 3
is a depiction of one such test scenario
      </p>
      <p>Person</p>
      <p>TestPerson
ageIn nameIn iPn oPut
INT STRING CTRL CTRL
a n ctrl</p>
      <p>Create</p>
      <p>Person
1
ToC ctrl a n
CTRL
setup
Age
setup</p>
      <p>Name
25
INT
"JohnDoe"
STRING</p>
      <sec id="sec-4-1">
        <title>GinA setAge oGuAt GinN setName oGuNt</title>
        <p>CTRL INT CTRL CTRL STRING
ctrl a ctrl n
CTRL</p>
      </sec>
      <sec id="sec-4-2">
        <title>TS toString oTuSt</title>
        <p>in
CTRL STRING CTRL
n ctrl
ctrl Invoke
setAge
ctrl sIentNvoakmee
ctrl</p>
        <p>ctrl
Invoke
toString
a
new
Age
50
INT
n</p>
        <p>"JaneDoe"
new
Name</p>
        <p>STRING</p>
        <p>For clarity, the object under test, including the input and output places
associated with its public operations, is depicted with bolder lines. The elements
otherwise associated with the testing operations are depicted normally.
Test Scenario: From left to right in Figure 3, a Person object is created,
after which the setAge() and setName() operations are invoked. Finally, the
toString() operation is invoked in order to observe the expected output.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusions and Future Work</title>
      <p>Objects can be effectively modeled with CPNs, as shown in the examples above.
The unit tests conducted confirm that they perform as expected. Modeling
single- and multithreaded active objects is the logical next direction related
to this short paper. Modeling inheritance would pose an interesting challenge as
well.</p>
      <p>This work is part of a larger project to model concurrent distributed
applications and middleware. The ultimate goal of the overarching research effort is
to provide a suite of executable architectural components and communications
templates for a variety of software design patterns.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Ammann</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Offutt</surname>
          </string-name>
          , J.: Introduction to Software Testing. Cambridge University Press (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Barros</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gomes</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>On the Use of Coloured Petri Nets for Object-Oriented Design</article-title>
          , pp.
          <fpage>117</fpage>
          -
          <lpage>136</lpage>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bauskar</surname>
            ,
            <given-names>B.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mikolajczak</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>Abstract node method for integration of object oriented design with colored Petri nets</article-title>
          .
          <source>In: Third International Conference on Information Technology: New Generations (ITNG'06)</source>
          . pp.
          <fpage>680</fpage>
          -
          <lpage>687</lpage>
          (
          <year>April 2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Costa</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gomes</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Module composition within Petri nets model-based development</article-title>
          .
          <source>In: 2007 International Symposium on Industrial Embedded Systems</source>
          . pp.
          <fpage>316</fpage>
          -
          <lpage>319</lpage>
          (
          <year>July 2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>CPN</given-names>
            <surname>Tools</surname>
          </string-name>
          <article-title>website</article-title>
          (May
          <year>2017</year>
          ), http://cpntools.org
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Ellims</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bridges</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ince</surname>
            ,
            <given-names>D.C.</given-names>
          </string-name>
          :
          <article-title>Unit testing in practice</article-title>
          .
          <source>In: 15th International Symposium on Software Reliability Engineering</source>
          . pp.
          <fpage>3</fpage>
          -
          <lpage>13</lpage>
          (
          <year>Nov 2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Fant</surname>
            ,
            <given-names>J.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gomaa</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pettit</surname>
          </string-name>
          , R.G.:
          <article-title>A comparison of executable model based approaches for embedded systems</article-title>
          .
          <source>In: 2012 Second International Workshop on Software Engineering for Embedded Systems (SEES)</source>
          . pp.
          <fpage>16</fpage>
          -
          <lpage>22</lpage>
          (
          <year>June 2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Gomaa</surname>
          </string-name>
          , H.:
          <article-title>Real-Time Software Design for Embedded Systems</article-title>
          . Cambridge University Press (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Jensen</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kristensen</surname>
            ,
            <given-names>L.M.</given-names>
          </string-name>
          :
          <article-title>Colored Petri nets: A graphical language for formal modeling and validation of concurrent systems</article-title>
          .
          <source>Commun. ACM</source>
          <volume>58</volume>
          (
          <issue>6</issue>
          ),
          <fpage>61</fpage>
          -
          <lpage>70</lpage>
          (May
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Lakos</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Object Oriented Modelling with Object Petri Nets</article-title>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>37</lpage>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2001</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Pettit</surname>
            ,
            <given-names>R.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gomaa</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fant</surname>
            ,
            <given-names>J.S.</given-names>
          </string-name>
          :
          <article-title>Modeling and prototyping of concurrent software architectural designs with colored Petri nets</article-title>
          .
          <source>In: International Workshop on Petri Nets and Software Engineering</source>
          . pp.
          <fpage>67</fpage>
          -
          <lpage>79</lpage>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Pettit</surname>
            ,
            <given-names>R.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gomaa</surname>
          </string-name>
          , H.:
          <article-title>Modeling behavioral design patterns of concurrent objects</article-title>
          .
          <source>In: Proceedings of the 28th International Conference on Software Engineering</source>
          . pp.
          <fpage>202</fpage>
          -
          <lpage>211</lpage>
          . ICSE '06,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. The reference net workshop website (May
          <year>2017</year>
          ), http://www.renew.de
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>