<!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>Foundations of Semantics and Model Checking in a Software Engineering Course</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Henning Bordihn</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Anna-Lena Lamprecht</string-name>
          <email>lamprechtg@cs.uni-potsdam.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tiziana Margaria</string-name>
          <email>tiziana.margaria@lero.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute of Computer Science, University of Potsdam</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Limerick and Lero - The Irish Software Research Centre</institution>
          ,
          <country country="IE">Ireland</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2015</year>
      </pub-date>
      <fpage>19</fpage>
      <lpage>26</lpage>
      <abstract>
        <p>Formal methods provide systematic and rigorous techniques for software development and we believe that they should be part of academic software engineering education. In this paper, we describe how we included a selection of formal methods in a foundational Bachelorlevel Software Engineering course. We show how we introduce the basic elements of modeling and programming language semantics, and discuss how we address the theory and practice of model checking within the scope of the two semesters of the course.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>{ In the rst term, SE 1 (6 ECTS) focuses on design: the domain level and
modeling languages, addressing and contrasting traditional vs. agile software
development. It introduces model-driven (MDSD) approaches, domain-speci c
languages (DSLs) as fundamental feature of MDSD approaches, and
metamodeling as a tool for determining the abstract syntax of a DSL. While the
focus is on the concepts and the modeling attitudes underlying these
approaches and technologies, some of them are practiced using corresponding
analysis and modeling tools.
{ In the second term, SE 2 (6 ECTS) focuses on development: it emphasizes
the technical level, with an introduction to IT project management, and
software architecture, object-oriented design, testing, maintenance and
reengineering. It addresses now in practice all the phases of software
development described in the SE 1, supplemented by more modern topics like Design
by Contract ("When the type system of the language is not enough"),
Enterprise Application Architectures and Software Product Lines (SPL).
{ In the concomitant project, students work together in small teams of 4-5
members to solve a more complex software engineering design (SE 1) and
development (SE 2) task, applying to this case study the concepts and
methods introduced in the lectures and the techniques and tools presented in the
tutorials and labs.
{ The course assessment consists of an individual nal exam (written, 50%
of the nal grade) and the evaluation of the project deliverables: the nal
software product and the group reports (intermediate and nal), in total
again 50% of the nal grade.</p>
      <p>In this paper we present the course concept and report on our experiences
from almost ve years of conducting the course. In particular, we discuss how
we address the theory and practice of formal methods on the basis of formal
semantics and model checking. The paper is structured as follows: In the following
section we explain in greater detail how we placed formal method contents in
the reformed Software Engineering courses. Section 3 then focusses on the model
checking aspects. Section 4 discusses the learning outcomes and competencies
attained by the students of this course, and Section 5 concludes the paper with
a review of experiences and some lessons learned.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Overview of the Formal Methods Contents</title>
      <p>
        The new course aims at a foundational and experiential education, for which we
included four formal methods blocks.
1. Model Checking [
        <xref ref-type="bibr" rid="ref2 ref7">2, 7</xref>
        ]: We start with the need to de ne "user stories"
that concretize a system's behavioral speci cations as process descriptions,
for which we introduce process modeling languages. In order to convey the
idea of property-based correctness and compliance, we directly introduce
temporal logics and model checking as a formal veri cation technique on
the (process-) model level, together with a corresponding tool. Regarding
the models, the students build upon the notion of nite automata they
already met in the rst year in Theoretical Computer Science. Regarding the
properties, they have prior knowledge of propositional logic.
2. Formal Program Semantics: As the process stories end up de ning a
collection of domain-speci c actions and functionalities, the course then
introduces DSLs and looks at the principles of formal semantics for programming
languages. The de nition of structural (small step) operational semantics
(SOS) for a simple "While" language is treated as example. This language
captures the control structures (excl. fork/join parallelism and hierarchy)
the students used in their process models, and it corresponds to the
attened process models analyzed by the model checker. How to generate a
control ow graph of a procedure from its stateless operational semantics is
demonstrated in the lecture and practiced in the lab.
3. Calculus of Communicating Systems and its SOS (CCS) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]: with the
growing practical relevance of concurrent processes, we introduce CCS as an
alternative formal model for distributed communicating processes. The de
nition of CCS and its SOS semantics (that now captures simple concurrency)
is illustrated with several simple examples, then we introduce the algebraic
laws of the calculus. We expand the catalogue of properties the students
encountered so far with a discussion of several equivalence notions such
as trace or equivalence for formal languages, bisimulation, and behavioral
congruence. We discuss substitutability of (process or software) components
based on indistinguishable behaviors.
4. Static Type System: in terms of properties, and compatibility checking of
data structures and behaviors that operate on data, types and type
checkers are the most successful technology. As illuminating example of how the
success of software projects strongly depends on the choice of appropriate
technologies, we discuss the role of the static type system for type-safe
programming. We rst show some sample e ects that may occur when using
script languages, and compare them to the behavior of compiled languages
in similar scenarios. We use the type determination/checking rules for
a simple expression language to illustrate bene ts and limits of static type
systems and prove simple type judgements using these type rules. Using the
formalism, we show what is guaranteed about successful evaluations of
expressions at runtime, and discuss which runtime errors may still be thrown.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Model Checking in Theory and Practice</title>
      <p>
        Model checking [
        <xref ref-type="bibr" rid="ref2 ref7">2, 7</xref>
        ] provides a powerful property-based mechanism to analyze
and verify static aspects of (arbitrary) behavioral models of a system. Generally
speaking, it can be used to check whether a model M satis es a property ,
usually written as M j= , where is expressed in a modal or temporal logic.
      </p>
      <p>We introduce it in the context of model-based software development, as an
early detection technique that supports validation in the speci cation and design
phase, prior to implementation. We show how it is useful to analyze global
model properties, where syntax or type checking at the component level is not
su cient. Constraints are checked at modeling time, without execution, which
o ers another range of addressable issues in addition to local validation and
usual debugging methods. We also show that the list of properties against which
the model is evaluated is easily extensible: including a new constraint in the
veri cation only requires to provide a formula expressing the property of interest.</p>
      <p>
        Consistent with our hands-on experiential approach, we introduce early in the
course the jABC process modeling framework [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] as a technology that supports
the development of executable process models as well as the veri cation of static
model properties by using the GEAR model checking plugin [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
3.1
      </p>
      <sec id="sec-3-1">
        <title>Theory and Warm-up: Lecture and Lab Contents</title>
        <p>
          Describing System Behavior The lecture introduces the basic concepts of
process modeling, Service Logic Graphs and XMDD (eXtreme Model-Driven
Development [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]), illustrating them with simple examples and one larger system
(the travel authorization and refund processes at UP designed previously by
other students). The students create the user stories as process models (called
Service Logic Graph, or SLG ) using process building blocks (called
ServiceIndependent Building Blocks, or SIBs) from a service library in a drag&amp;drop
fashion, and connecting them with labeled branches representing the ow of
control. As soon as the parameters of the SIBs have been con gured, the process
is ready for execution. Plugins add a wealth of additional features and
capabilities to the jABC, ranging from simple execution by interpretation to more
sophisticated functionality like code generation and work ow synthesis Our
students use the SLG interpreter (the Tracer ) for execution, and the GEAR plugin
for model-wide evaluation of static properties (expressed in terms of modal or
temporal speci cations) directly on their own SLGs.
        </p>
        <p>
          SLGs as Formal Models As suitable abstract model structure, we
introduce Kripke Structures, Labeled Transition Systems and Kripke Transition
Systems. Semantically, SLGs are in fact Kripke Transition Systems (cf. [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]) that
combine classical Kripke Structures (cf., e.g., [2, Chapter 2]) with Labeled Transition
Systems (cf., e.g., [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]) into model structures where both states and transitions
are labeled. As such, they are directly amenable to formal analysis techniques,
in particular to model checking.
        </p>
        <p>
          Temporal Logic Properties as Constraints Starting from the
propositional logic already familiar to the students, we introduce Hennessy Milner Logic
(HML) [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ], Propositional Linear Time Logic (PLTL, cf. [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]) and Computation
Tree Logic (CTL, [2, Chapter 3]) as languages to express behavioral properties.
While GEAR is internally a mu-calculus model checker, only CTL would be
strictly necessary. We chose to include HML and PLTL primarily for didactic
reasons, as they provide a good sca olding for understanding CTL, especially
regarding the role of the temporal operators along the paths and the path
quanti ers. In the two associated labs, students practice the use of HML, PLTL,
and CTL by modeling intuitive properties in terms of these logic languages and
learning to interpret logical formulas in a comprehensible way.
        </p>
        <p>Model Checking Finally, we explain how SLGs can be viewed as Kripke
Transition Systems, how to use GEAR to assign atomic propositions to the
SIBs of the SLGs, how to enter logical formulas, and how to check and debug
systems with GEAR. The use of GEAR is demonstrated by means of some simple
examples, where the level of the student's independence is increased.</p>
        <p>For these examples we use processes that are modeled as SLGs using only
Prototype SIBs, like the abstract web shop process shown in Figure 1 (top). These
SIBs are pure modeling means, as they do not have an actual implementation,
but as the implementation is not relevant with regard to this kind of abstract
model checking, they are su cient for the purpose. Then system requirements
are formulated as temporal properties. The lab discusses interactively which
atomic properties (APs) need to be assigned to which nodes (SIB instances) and
how to capture the formulated requirements as CTL formulas. The students use
the AP inspector to annotate SIB instances with the atomic propositions, with
results similar to the display in Figure 1 (bottom).</p>
        <p>With the GEAR formula manager, students can edit CTL formulas and
document them with natural-language descriptions (see Figure 2, left). The model
checking inspector displays all currently available properties, and one can toggle
between the formulas and their high-level descriptions. In the hands-on sessions,
students learn to check all properties, nding out which hold for the entire model
(i.e. for the start SIB) as in Figure 2 (right), or individually for each node in the
model. This check mode can also be applied to individual formulas: the nodes
where the formula holds/does not hold are highlighted by green/red boxes
respectively, as shown in Figure 3. Please note that the small examples in the</p>
        <p>gures are meant for illustration purposes only, and that the examples on which
the students work in their projects are larger and more complex.</p>
      </sec>
      <sec id="sec-3-2">
        <title>Hands-on in Groups: Mastering the Project</title>
        <p>After the lessons, tutorials, and introductory labs, the students are required to
design a more complex jABC process, express relevant process properties, and
check them with GEAR, in a project that mimics a system design from scratch.
The concrete project task in SE 1 concerns rst the user requirements for a
sample Software Engineering project. Solutions are built in three steps:
1. Building a system speci cation via a UML Use Case Diagram supplemented
by documented and prioritized use cases. The scenarios (system behaviors)
corresponding to the use cases must be speci ed as process models, some as
UML Activity Diagrams and some as SLGs. This way the students compare
two exemplary modeling languages, learning to evaluate similar technologies
wrt. adequacy for a speci c purpose.
2. Developing a prototype of the system, delivering an executable SLG
validated through the Tracer. For this process model, the students need to
specify several global behavioral properties and verify them using the GEAR.
3. Documenting and evaluating the project activities and management
decisions of the group, as a third part of their project solution and report.</p>
        <p>In SE 2, the students continue the project towards the implemented product:
structural design (architecture and class model) and a documented
implementation, tested by unit tests. As it often happens in real software projects, in
the second term they do not continue with their own speci cations, but they
must take over the speci cation from a di erent SE 1 team, whenever possible
based on a di erent user story (i.e. a di erent system). They start over with the
assessment of plausibility, feasibility, completeness, and quality of the previous
group's deliverable and then they complete the speci cations to a point where
they feel comfortable with moving to the design and implementation.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Learning Outcomes and Observations</title>
      <p>We describe the formal methods-related skills that the students acquire in our
Software Engineering course in terms of the following competence elds:
{ Professional competencies: Graduates of this course have broad
knowledge about languages for the modeling of software. They know the principles
and theoretical foundations of model checking.
{ Methodological competencies: They are able to use selected languages
and tools for the process- and object-oriented modeling of software. They can
apply model checking for the formal veri cation of process models. They can
assess/check the meaning of programs and their corresponding ow graphs
using structural operational semantics (SOS). They are familiar with the use
of logic calculi (axiomatic deduction systems).
{ Action competencies: They are able to include formal veri cation
methods in their software projects in addition to traditional validation and testing.</p>
      <p>The course has so far been attended by over 250 students. Approximately
half of the participants were enrolled in the B.Sc. Computer Science (2010-2014)
or B.Sc. Computational Science (2015); the other half were students in the B.Sc.
Business Informatics. There has been no observable di erence between these
groups regarding the achievements in the exercises, exams and projects. We saw
however a signi cant di erence among the skills developed by these students and
those of the precedent years: While the previous generations were more con
dent in architectural issues and coding skills, our students have a more intuitive
con dence with application development and with mastering a number of
different technologies. We saw the advantage of this abstract and behavior-driven
modeling in their approach to the subsequent module on Foundations of Service
Engineering, where the black-box character of components is really central. The
familiarity with the basic formal methods concepts was also advantageous in the
subsequent specialistic course on Formal Methods in System Design (FMSD):
taught in an e-learning fashion via teleconference-based lectures shared with the
TU Dortmund and complemented by local tutorials and labs, it was clear that
the Potsdam students had a smoother approach to the more technical material
in FMSD due to their previous experience with the basic concepts.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>We strongly believe that today, facing service orientation and an increasing
interest in user-de ned business processes, lightweight formal methods should be
integral part of the standard academic software engineering education.
Accordingly, since 2010 we have been teaching a foundational Bachelor-level Software
Engineering course with four embedded formal methods components at the
University of Potsdam.</p>
      <p>We chose on purpose only so-called "lightweight" formal methods, i.e. such
that algorithms exist (like type checkers and model checkers), and not theorem
provers or proof techniques for program correctness like Hoare style program
veri cation (both presented at length in other courses), because we wished to
provide scalable approaches that have a low threshold to adoption, ease of
reasonably con dent use in the small, and a high ease of embedding in a full edged
model driven IDE (for us the jABC). While high-end Formal Methods continue
to require a deep knowledge of the mathematical concepts and formalisms, we
believe that IDE-embedded FMs should be made available systematically to the
next generation of Software Engineers as part of their basic profession-oriented
education. Like basic English has successfully become within a generation a
standard in the schools, establishing itself culturally as the "lingua franca" of
international communication, the ability to take a domain-speci c perspective,
to think in terms of domain speci c properties, to formulate them in such a
way that both a user and a tool are able to work with them, and the ability to
conduct veri cations on early models of a system are in our opinion the key to a
better understanding between IT professionals, in particular Software Engineers.</p>
      <p>Another advantage is the ingrained sense of accountability and ownership
that comes with the ability and habit of verifying early and verifying often, by
means of tools that take an objective perspective (other than user inspections)
and provide a third party repeatable outcome. With all the limitations and
drawbacks that we know of the FM tools and approaches we have today, such a step
towards accountability for decisions and outcomes early in the design constitutes
in our opinion a central shift towards maturity of the professional gure,
competence beyond the production of code, and ultimately towards establishing a
new concept of ethics and responsibility in the Software Engineering profession.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>M.</given-names>
            <surname>Bakera</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Margaria</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Renner</surname>
          </string-name>
          , and
          <string-name>
            <surname>B.</surname>
          </string-name>
          <article-title>Ste en. Tool-supported enhancement of diagnosis in model-driven veri cation</article-title>
          .
          <source>Innovations in Systems and Software Engineering</source>
          ,
          <volume>5</volume>
          :
          <fpage>211</fpage>
          {
          <fpage>228</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>E. M.</given-names>
            <surname>Clarke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Grumberg</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D. A. Peled. Model</given-names>
            <surname>Checking</surname>
          </string-name>
          . The MIT Press, Cambridge, MA, USA,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Hennessy</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Milner</surname>
          </string-name>
          .
          <article-title>Algebraic laws for nondeterminism and concurrency</article-title>
          .
          <source>Journal of the ACM</source>
          ,
          <volume>32</volume>
          :
          <fpage>137</fpage>
          {
          <fpage>161</fpage>
          ,
          <year>January 1985</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>J.-P.</given-names>
            <surname>Katoen</surname>
          </string-name>
          .
          <article-title>Labelled Transition Systems</article-title>
          . In M. Broy,
          <string-name>
            <given-names>B.</given-names>
            <surname>Jonsson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.-P.</given-names>
            <surname>Katoen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Leucker</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <surname>A</surname>
          </string-name>
          . Pretschner, editors,
          <source>Model-Based Testing of Reactive Systems</source>
          , volume
          <volume>3472</volume>
          of Lecture Notes in Computer Science, pages
          <volume>615</volume>
          {
          <fpage>616</fpage>
          . Springer Berlin / Heidelberg,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>T.</given-names>
            <surname>Margaria</surname>
          </string-name>
          and
          <string-name>
            <surname>B.</surname>
          </string-name>
          <article-title>Ste en. Service-Orientation: Conquering Complexity with XMDD</article-title>
          . In M. Hinchey and L. Coyle, editors,
          <source>Conquering Complexity</source>
          , pages
          <volume>217</volume>
          {
          <fpage>236</fpage>
          . Springer London,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>R.</given-names>
            <surname>Milner</surname>
          </string-name>
          .
          <source>A Calculus of Communicating Systems</source>
          , volume
          <volume>92</volume>
          of Lecture Notes in Computer Science. Springer Berlin / Heidelberg,
          <year>1980</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>M.</given-names>
            <surname>Mu</surname>
          </string-name>
          <article-title>ller-</article-title>
          <string-name>
            <surname>Olm</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Schmidt</surname>
            , and
            <given-names>B.</given-names>
          </string-name>
          <article-title>Ste en. Model-Checking - A Tutorial Introduction</article-title>
          .
          <source>In Proceedings of the 6th International Symposium on Static Analysis (SAS '99)</source>
          , pages
          <fpage>330</fpage>
          {
          <fpage>354</fpage>
          ,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8. B. Ste en, T. Margaria,
          <string-name>
            <given-names>R.</given-names>
            <surname>Nagel</surname>
          </string-name>
          , et al.
          <article-title>Model-Driven Development with the jABC</article-title>
          .
          <source>In Hardware and Software, Veri cation and Testing</source>
          , volume
          <volume>4383</volume>
          of Lecture Notes in Computer Science, pages
          <volume>92</volume>
          {
          <fpage>108</fpage>
          . Springer Berlin / Heidelberg,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>