<!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 i* to Describe Data Structures</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Universitat Politècnica de Catalunya</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Barcelona franch@essi.upc.edu</string-name>
        </contrib>
      </contrib-group>
      <fpage>0000</fpage>
      <lpage>0001</lpage>
      <abstract>
        <p>This paper explores the use of the i* language as a notation to describe data structures to be used in classical imperative programs written in e.g. Java or C#. Data structures are described at two levels of abstraction, their specification and their implementation (the data structure properly said). We analyze how iStar 2.0, enriched with both modularization and dependum specialization constructs, can be used in this context.</p>
      </abstract>
      <kwd-group>
        <kwd>iStar</kwd>
        <kwd>iStar2</kwd>
        <kwd>0</kwd>
        <kwd>i*</kwd>
        <kwd>Data Structures</kwd>
        <kwd>Software Selection</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The study of data structures is almost as established as the study of programming and
in particular, imperative programming. In the seventies and eighties, with the advent of
imperative programming languages as C, Pascal, Ada and Modula, they were object of
intensive analysis that resulted in classical textbooks by D.E. Knuth [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ][
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], A.V. Aho
et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and N. Wirth [
        <xref ref-type="bibr" rid="ref24">24</xref>
        ], among others. These authors described at a great level of
detail the basic types of data structures, from lists to trees to hash tables. Gradually,
other authors proposed more sophisticated and specialized data structures (Fibonacci
heaps, splay trees, etc.) with more specific purposes; most of them are very
well-summarized in another classical textbook by T.H. Cormen et al. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        In the same period of time, as a response to the observation by J.B. Morris “[data]
types are not sets” [
        <xref ref-type="bibr" rid="ref21">21</xref>
        ], another stream of research formulated the concept of abstract
data type (ADT) [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. A central concept formulated by the theory of ADTs is the
distinction among the specification of an ADT (their operations and the properties they
fulfil) and its implementation (the operationalization into code), linked by the so-called
abstraction function [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. Typically, the implementation of an ADT takes the form of a
data structure. The most important consequence of this (at that time) revolutionary
approach was that programmers had the opportunity to manipulate a data structure
through its operations and not directly through its internal representation (in form of
arrays, pointers, records, etc., offered by the programming language), improving then
the reliability of the resulting code as well as its maintenance. In fact, ADTs together
with object-orientation boosted modular development as the usual way to develop
programs in imperative programming [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. This approach was also reinforced by a
consolidated portfolio of the most popular ADTs and data structures, promoting reuse as a
fundamental principle to modular programming.
      </p>
      <p>Copyright © 2020 for this paper by its authors. Use permitted under
Creative Commons License Attribution 4.0 International (CC BY 4.0).</p>
      <p>
        In the context of modular programming with reuse of ADTs and data structures, two
questions arose when it is the moment to select data structures:
1) Which is the most appropriate ADT to solve the problem at hand? Typical ADTs
are lists, mappings, graphs and trees. The answer to this question was the basis
of component reuse by e.g. signature matching [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ].
2) What is the data structure that best implements the chosen ADT? This second
problem was addressed through the incorporation of ad hoc constructs in new
languages like CLU [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] and SETL [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ] that remained as research endeavours
without industrial impact. In this direction, we also designed a language called
NoFun [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ][
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] which we intensively used in the design of a comprehensive
catalogue of ADTs implemented with popular data structures [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. NoFun was an
acronym for “Non-Functional”, reflecting the fact that the main criteria to
choose among alternative implementations of an ADT where related to
nonfunctional requirements, in contrast to the problem of ADT/component reuse,
based on the functional requirements.
      </p>
      <p>
        Even if NoFun was a powerful notation to describe the specification of ADTs and the
main characteristics of the data structures implementing them, it was quite low level.
For instance, efficiency in time and space was measured by giving order of magnitude
values using the asymptotic functions big-Oh and similar [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], which may be necessary
to perform accurate analysis, but cumbersome when a more lightweight approach
suffices, e.g. to summarize the main characteristics of the data structure in a teaching
context.
      </p>
      <p>
        This paper proposes to address the problem of data structure selection (thus,
implicitly, of ADT selection) using the i* framework [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] and in particular, the framework’s
language. We use iStar 2.0 [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] as such language (although the use of one version or
another is not critical for this work) and, to emphasize the modularity of the approach,
we will present the different models as modules that can be reused following the
guidelines given in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and evaluated in [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]. Following the ideas in [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], the use of i* is
twofold, on the one hand for describing the data structures and on the other hand, for
matching them to a particular situation. In this paper, we will focus on the first problem.
Therefore, we may state the main goal of this paper as: to analyse iStar 2.0 for the
purpose of understanding whether it helps describing data structures in imperative
programs with respect to functional and non-functional characteristics from the
point of view of programmers and educators in the context of modular software
development.
      </p>
      <p>From this goal, according to the distinction among specification and implementation
of an ADT, we derive two research questions:</p>
      <p>RQ1: How can iStar 2.0 be used to describe the specification of ADTs?
RQ2: How can iStar 2.0 be used to describe data structures that implement ADTs?
These two research questions are investigated in the next two sections.</p>
    </sec>
    <sec id="sec-2">
      <title>Describing ADT Specifications using i*</title>
      <p>
        Given that the ADTs of each type look similar, we can use specialization and arrange
them into hierarchies of related modules. Fig. 3 and Fig. 4 show the two hierarchies for
the two types of ADTs following the proposal by López et al. [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]2. The (abstract)
superactor Sequence defines the common traits to every sequence that are tailored by
each of the three types, redefining the Get dependency conveniently and, in the case of
lists, adding the traversal goal. The Function superactor has a similar situation. Going
further, in Fig. 4 we also show how the concept may be used to defined more complex
ADTs by specialization, e.g. sets offering further functionalities.
1 All diagrams have been drawn with the piStar tool, https://www.cin.ufpe.br/~jhcp/pistar/, and
manually modified to add modularity and specialization constructs not included in iStar 2.0.
2 We also use colours to highlight the elements affected by the specialization.
      </p>
      <p>Describing ADT Implementations by Data Structures using i*
While the description of ADT specification is related to the functionalities offered (or
sought, depending on the perspective), when it comes to data structures, non-functional
requirements come into play, which calls for the use of iStar 2.0 qualities. Not only this,
but also given the lower level of abstraction, tasks are more likely to appear. To focus
the discussion, we select the most typical non-functional concept that is explored in
data structure design, namely time efficiency, although others as space efficiency,
maintainability or understandability could be also of interest.</p>
      <p>
        Fig. 5 shows the simplest expression of SD diagrams for two popular data structures
that implement mappings, namely hash tables and AVL trees. Both of them share in
common the capability of providing fast access to look-up operations, and the main
difference is on what they require in order to be properly implemented. Please note also
that we do not include the information already provided in the corresponding
specification. Hash tables need to know an approximate size of the data structure (i.e., number
of elements to be stored), and in addition a hash function. Although the modularity
approach proposed in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] does not allow to distinguish roles outside the module, we
can expect that the actors informing about the size and implementing the hash function
will not be the same (or at least, they are not required to); we have tried to enforce this
statement in the drawing, placing the dependencies pointing to different places.
Concerning AVL trees, they do not need an estimation of size but have another important
requirement: the ability to order the elements, which we represent with the Greater
or equal than task. As it happened with the specification, we could make use of
inheritance to capture the commonalities that every implementation of mappings should
have, in this case fast element look-up. This is shown in Fig. 6, which also shows the
use of a participates-in link to represent explicitly the link among an implementation
and its corresponding specification.
The main contribution of this paper is to provide a high-level view to the concept of
data structure using i*. This provides the basis for an instantiation of the classical
software component selection problem [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], as we have already tackled in the past with i*
in the domain of commercial software packages [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] together with the use of metrics for
informing this selection [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ][
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]; this is part of our next steps. It could be argued that,
while selection of software packages is still a contemporary challenge, it is not the case
for data structures. This is partially true, since a trend in modern programming
languages like Python is to embed some basic data structures. However, wide communities
of popular programming languages like Java or C# still need to integrate data structures
in their programs. In addition, the increased specialization on software demands results
in the need of creating data structures responding to specific challenges. For instance,
G. Navarro proposes a catalogue of “compact data structures”, aimed at storing in a
compressed form large quantity of data still allowing to access and query them in
compact form [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ]. Another specialized field of research is the need of managing concurrent
data structures [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ], which raises specific goals and qualities related to performance.
Adopting a high-level, goal-oriented approach as presented in this paper could help
these communities to organize their data structures in a more structured form.
      </p>
      <p>
        Other aspects have not been addressed in this paper. For instance, the possibility of
refining the very general qualities, as Fast Look-up, into more specific ones. In this
case, typically statements about the asymptotic cost of the operations [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. We could
represent these statements as qualities too, e.g. Big-Oh is log(n), related through
contribution links to the former ones, or else we could define an extension of iStar 2.0
introducing these concepts that are specific to data structure analysis.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Aho</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hopcroft</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ullman</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          :
          <article-title>Data Structures and Algorithms</article-title>
          . Addison-Wesley,
          <year>1983</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Botella</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Burgués</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          , et al.:
          <string-name>
            <surname>Modeling Non-Functional</surname>
            <given-names>Requirements. JIRA</given-names>
          </string-name>
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Carvallo</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Quer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Determining Criteria for Selecting Software Components: Lessons Learned</article-title>
          .
          <source>IEEE Software 24(3)</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Carvallo</surname>
            ,
            <given-names>J.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Quer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Defining a Quality Model for Mail Servers</article-title>
          .
          <source>ICCBSS</source>
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Cormen</surname>
            ,
            <given-names>T.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Leiserson</surname>
            ,
            <given-names>C.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rivest</surname>
            ,
            <given-names>R.L.</given-names>
          </string-name>
          :
          <article-title>Introduction to Algorithms</article-title>
          . The MIT Press,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Dalpiaz</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Horkoff</surname>
          </string-name>
          ,
          <source>J.: iStar 2</source>
          .
          <article-title>0 Language Guide</article-title>
          .
          <source>arXiv preprint arXiv:1605.07767</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          : Estructuras de Datos: Especificación, Diseño e Implementación. Ed. UPC,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>Systematic Formulation of Non-Functional Characteristics of Software</article-title>
          .
          <source>ICRE 98.</source>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>On the Lightweight Use of Goal-Oriented Models for Software Package Selection</article-title>
          .
          <source>CAiSE</source>
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>A Method for the Definition of Metrics over i* Models</article-title>
          .
          <source>CAiSE</source>
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>Incorporating Modules into the i* Framework</article-title>
          .
          <source>CAiSE</source>
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grau</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Quer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>A Framework for the Definition of Metrics for Actor-Dependency Models</article-title>
          .
          <source>RE</source>
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Goguen</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thatcher</surname>
            ,
            <given-names>J.W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wagner</surname>
            ,
            <given-names>E.G.</given-names>
          </string-name>
          :
          <article-title>An Initial Algebra Approach to the Specification, Correctness and Implementation of Abstract Data Types</article-title>
          .
          <source>In Current Trends in Programming Methodology</source>
          , Vol. IV,
          <string-name>
            <surname>Prentice-Hall</surname>
          </string-name>
          ,
          <year>1978</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Hoare</surname>
            ,
            <given-names>C.A.R.</given-names>
          </string-name>
          :
          <source>Proof of Correctness of Data Representation. Acta Informatica</source>
          <volume>1</volume>
          (
          <issue>1</issue>
          ),
          <year>1972</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Knuth</surname>
            ,
            <given-names>D.E.</given-names>
          </string-name>
          :
          <source>The Art of Computer Programming</source>
          , Vol.
          <volume>1</volume>
          .
          <string-name>
            <surname>Addison-Wesley</surname>
          </string-name>
          ,
          <year>1968</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Knuth</surname>
            ,
            <given-names>D.E.</given-names>
          </string-name>
          :
          <source>The Art of Computer Programming</source>
          , Vol.
          <volume>3</volume>
          .
          <string-name>
            <surname>Addison-Wesley</surname>
          </string-name>
          ,
          <year>1973</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Liskov</surname>
            ,
            <given-names>B.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guttag</surname>
            ,
            <given-names>J.V.</given-names>
          </string-name>
          <string-name>
            <surname>Abstraction</surname>
          </string-name>
          and
          <article-title>Specification in Program Development</article-title>
          . MIT,
          <year>1986</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Liu</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Calciu</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Herlihy</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mutlu</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <article-title>Concurrent Data Structures for Near-Memory Computing</article-title>
          .
          <source>SPAA</source>
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>López</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Marco</surname>
          </string-name>
          , J.:
          <source>Specialization in the iStar2.0 Language. IEEE Access 7</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <surname>Maté</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Trujillo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Franch</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>Adding Semantic Modules to improve Goal-Oriented Analysis of Data Warehouses using I-star</article-title>
          .
          <source>Journal of Systems and Software 88</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <surname>Morris</surname>
            ,
            <given-names>J.B.</given-names>
          </string-name>
          :
          <article-title>Types are not Sets</article-title>
          .
          <source>PoPL</source>
          <year>1973</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22.
          <string-name>
            <surname>Navarro</surname>
          </string-name>
          , G.:
          <article-title>Compact Data Structures</article-title>
          . Cambridge University Press,
          <year>2016</year>
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23.
          <string-name>
            <surname>Schwartz</surname>
            ,
            <given-names>J.T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dewar</surname>
            ,
            <given-names>R.B.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dubinsky</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schonberg</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          :
          <article-title>Programming with Sets: An Introduction to</article-title>
          SETL. Springer,
          <year>1986</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24.
          <string-name>
            <surname>Wirth</surname>
          </string-name>
          , N.:
          <article-title>Algorithms and Data Structures</article-title>
          . Prentice-Hall,
          <year>1983</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <surname>Yu</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          :
          <article-title>Modeling Organisations for Information Systems Requirements Engineering</article-title>
          . ISRE 93.
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26.
          <string-name>
            <surname>Zaremski</surname>
            ,
            <given-names>A.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wing</surname>
            ,
            <given-names>J.A.</given-names>
          </string-name>
          :
          <article-title>Signature Matching: A Tool for Using Software Libraries</article-title>
          .
          <source>ACM Transactions on Software Engineering and Methodology</source>
          <volume>4</volume>
          (
          <issue>2</issue>
          ),
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>