model-based software engineering (02341) · what are good process models (2) whatever happend in...

42
Model-based Software Engineering (02341, spring 2017) Ekkart Kindler

Upload: others

Post on 17-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Model-based Software Engineering

(02341, spring 2017)

Ekkart Kindler

Page 2: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Lecture 8: Overview (cntd.)

Some hints for the implementation

Auxiliary datatypes and functions

Helpful ePNK functions

Marking algorithm (OR-join: potentially arriving tokens)

Hints on writing (Project Definiton / Final Report)

DSL discussion revisited

2 MBSE (02341 f17), L09

Page 3: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Hints on writing

Page 4: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

Inductive writing:

Explain concepts by examples first

Then extract concepts and explain in more detail

Fill in more detailed concepts and explanations later

”Spiral form writing”:

Identify most important concepts (3-5):

explain them first (on high level of abstraction)

Idendify next most important concepts:

explain first and next important concepts (in more

detail), ...

4 MBSE (02341 f17), L09

Page 5: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

DSL discussion continued

Page 6: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Steps of defining a DSL

1. Define language concepts (abstract syntax):

2. Define graphical representation (concrete syntax):

6 MBSE (02341 f17), L09

Place Transition

1 source

1 target

Arc

*

PetriNet

Token *

Node

Object

Place

Transition

Arc

Token

Page 7: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Steps of defining a DSL

3. Define semantics (its meaning or behaviour):

a) Define runtime concepts

b) Define presentation of runtime concepts

c) Define logic for behaviour

7 MBSE (02341 f17), L09

Page 8: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Project example

YAWL concepts and representation:

8 MBSE (02341 f17), L09

Page 9: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Project example

YAWL Simulator: Runtime concepts

9 MBSE (02341 f17), L09

Page 10: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Status and Recapitulation:

How far did we come?

Page 11: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

11 MBSE (02341 f17), L09

Vision

Place Transition

1 source

1 target

Arc

*

PetriNet

Token

*

Node

Object

Analysis

Design

Implementation

Coding

Manifest-Version: 1.0

Bundle-ManifestVersion: 2

Bundle-Name: %pluginName

Bundle-SymbolicName: APetriNetEditorIn15Minutes.diagr

Bundle-Version: 1.0.0.qualifier

Bundle-ClassPath: .

Bundle-Activator: PetriNets.diagram.part.PetriNetDiagr

Bundle-Vendor: %providerName

Bundle-Localization: plugin

Export-Package: PetriNets.diagram.edit.parts,

PetriNets.diagram.part,

PetriNets.diagram.providers

Require-Bundle: org.eclipse.core.runtime,

org.eclipse.core.resources,

org.eclipse.core.expressions,

org.eclipse.jface,

org.eclipse.ui.ide,

org.eclipse.ui.views,

org.eclipse.ui.navigator,

org.eclipse.ui.navigator.resources,

org.eclipse.emf.ecore,

org.eclipse.emf.ecore.xmi,

org.eclipse.emf.edit.ui,

org.eclipse.gmf.runtime.emf.core,

org.eclipse.gmf.runtime.emf.commands.core,

org.eclipse.gmf.runtime.emf.ui.properties,

org.eclipse.gmf.runtime.diagram.ui,

org.eclipse.gmf.runtime.diagram.ui.properties,

org.eclipse.gmf.runtime.diagram.ui.providers,

org.eclipse.gmf.runtime.diagram.ui.providers.ide,

org.eclipse.gmf.runtime.diagram.ui.render,

org.eclipse.gmf.runtime.diagram.ui.resources.ed

org.eclipse.gmf.runtime.diagram.ui.resources.e

APetriNetEditorIn15Minutes;visibility:=reexpor

package PetriNets.impl;

public class PetriNetImpl extends EObjectImpl implements PetriNet {

protected EList<PetriNets.Object> object;

protected PetriNetImpl() {

super();

}

protected EClass eStaticClass() {

return PetriNetsPackage.Literals.PETRI_NET;

}

public EList<PetriNets.Object> getObject() {

if (object == null) {

object = new EObjectContainmentEList<PetriNets.Object>(Petri

}

return object;

}

public NotificationChain eInverseRemove(InternalEObject otherEnd, int

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return ((InternalEList<?>)getObject()).basicRemove(otherEn

}

return super.eInverseRemove(otherEnd, featureID, msgs);

}

public Object eGet(int featureID, boolean resolve, boolean coreType) {

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return getObject();

}

return super.eGet(featureID, resolve, coreType);

Manifest-Version: 1.0

Bundle-ManifestVersion: 2

Bundle-Name: %pluginName

Bundle-SymbolicName: APetriNetEditorIn15Minutes.diagr

Bundle-Version: 1.0.0.qualifier

Bundle-ClassPath: .

Bundle-Activator: PetriNets.diagram.part.PetriNetDiagr

Bundle-Vendor: %providerName

Bundle-Localization: plugin

Export-Package: PetriNets.diagram.edit.parts,

PetriNets.diagram.part,

PetriNets.diagram.providers

Require-Bundle: org.eclipse.core.runtime,

org.eclipse.core.resources,

org.eclipse.core.expressions,

org.eclipse.jface,

org.eclipse.ui.ide,

org.eclipse.ui.views,

org.eclipse.ui.navigator,

org.eclipse.ui.navigator.resources,

org.eclipse.emf.ecore,

org.eclipse.emf.ecore.xmi,

org.eclipse.emf.edit.ui,

org.eclipse.gmf.runtime.emf.core,

org.eclipse.gmf.runtime.emf.commands.core,

org.eclipse.gmf.runtime.emf.ui.properties,

org.eclipse.gmf.runtime.diagram.ui,

org.eclipse.gmf.runtime.diagram.ui.properties,

org.eclipse.gmf.runtime.diagram.ui.providers,

org.eclipse.gmf.runtime.diagram.ui.providers.ide,

org.eclipse.gmf.runtime.diagram.ui.render,

org.eclipse.gmf.runtime.diagram.ui.resources.ed

org.eclipse.gmf.runtime.diagram.ui.resources.e

APetriNetEditorIn15Minutes;visibility:=reexpor

package PetriNets.impl;

public class PetriNetImpl extends EObjectImpl implements PetriNet {

protected EList<PetriNets.Object> object;

protected PetriNetImpl() {

super();

}

protected EClass eStaticClass() {

return PetriNetsPackage.Literals.PETRI_NET;

}

public EList<PetriNets.Object> getObject() {

if (object == null) {

object = new EObjectContainmentEList<PetriNets.Object>(Petri

}

return object;

}

public NotificationChain eInverseRemove(InternalEObject otherEnd, int

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return ((InternalEList<?>)getObject()).basicRemove(otherEn

}

return super.eInverseRemove(otherEnd, featureID, msgs);

}

public Object eGet(int featureID, boolean resolve, boolean coreType) {

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return getObject();

}

return super.eGet(featureID, resolve, coreType);

Page 12: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

12 MBSE (02341 f17), L09

Programming vs. SE

Page 13: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

13 MBSE (02341 f17), L09

Vision

Place Transition

1 source

1 target

Arc

*

PetriNet

Token

*

Node

Object

Manifest-Version: 1.0

Bundle-ManifestVersion: 2

Bundle-Name: %pluginName

Bundle-SymbolicName: APetriNetEditorIn15Minutes.diagr

Bundle-Version: 1.0.0.qualifier

Bundle-ClassPath: .

Bundle-Activator: PetriNets.diagram.part.PetriNetDiagr

Bundle-Vendor: %providerName

Bundle-Localization: plugin

Export-Package: PetriNets.diagram.edit.parts,

PetriNets.diagram.part,

PetriNets.diagram.providers

Require-Bundle: org.eclipse.core.runtime,

org.eclipse.core.resources,

org.eclipse.core.expressions,

org.eclipse.jface,

org.eclipse.ui.ide,

org.eclipse.ui.views,

org.eclipse.ui.navigator,

org.eclipse.ui.navigator.resources,

org.eclipse.emf.ecore,

org.eclipse.emf.ecore.xmi,

org.eclipse.emf.edit.ui,

org.eclipse.gmf.runtime.emf.core,

org.eclipse.gmf.runtime.emf.commands.core,

org.eclipse.gmf.runtime.emf.ui.properties,

org.eclipse.gmf.runtime.diagram.ui,

org.eclipse.gmf.runtime.diagram.ui.properties,

org.eclipse.gmf.runtime.diagram.ui.providers,

org.eclipse.gmf.runtime.diagram.ui.providers.ide,

org.eclipse.gmf.runtime.diagram.ui.render,

org.eclipse.gmf.runtime.diagram.ui.resources.ed

org.eclipse.gmf.runtime.diagram.ui.resources.e

APetriNetEditorIn15Minutes;visibility:=reexpor

package PetriNets.impl;

public class PetriNetImpl extends EObjectImpl implements PetriNet {

protected EList<PetriNets.Object> object;

protected PetriNetImpl() {

super();

}

protected EClass eStaticClass() {

return PetriNetsPackage.Literals.PETRI_NET;

}

public EList<PetriNets.Object> getObject() {

if (object == null) {

object = new EObjectContainmentEList<PetriNets.Object>(Petri

}

return object;

}

public NotificationChain eInverseRemove(InternalEObject otherEnd, int

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return ((InternalEList<?>)getObject()).basicRemove(otherEn

}

return super.eInverseRemove(otherEnd, featureID, msgs);

}

public Object eGet(int featureID, boolean resolve, boolean coreType) {

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return getObject();

}

return super.eGet(featureID, resolve, coreType);

Manifest-Version: 1.0

Bundle-ManifestVersion: 2

Bundle-Name: %pluginName

Bundle-SymbolicName: APetriNetEditorIn15Minutes.diagr

Bundle-Version: 1.0.0.qualifier

Bundle-ClassPath: .

Bundle-Activator: PetriNets.diagram.part.PetriNetDiagr

Bundle-Vendor: %providerName

Bundle-Localization: plugin

Export-Package: PetriNets.diagram.edit.parts,

PetriNets.diagram.part,

PetriNets.diagram.providers

Require-Bundle: org.eclipse.core.runtime,

org.eclipse.core.resources,

org.eclipse.core.expressions,

org.eclipse.jface,

org.eclipse.ui.ide,

org.eclipse.ui.views,

org.eclipse.ui.navigator,

org.eclipse.ui.navigator.resources,

org.eclipse.emf.ecore,

org.eclipse.emf.ecore.xmi,

org.eclipse.emf.edit.ui,

org.eclipse.gmf.runtime.emf.core,

org.eclipse.gmf.runtime.emf.commands.core,

org.eclipse.gmf.runtime.emf.ui.properties,

org.eclipse.gmf.runtime.diagram.ui,

org.eclipse.gmf.runtime.diagram.ui.properties,

org.eclipse.gmf.runtime.diagram.ui.providers,

org.eclipse.gmf.runtime.diagram.ui.providers.ide,

org.eclipse.gmf.runtime.diagram.ui.render,

org.eclipse.gmf.runtime.diagram.ui.resources.ed

org.eclipse.gmf.runtime.diagram.ui.resources.e

APetriNetEditorIn15Minutes;visibility:=reexpor

package PetriNets.impl;

public class PetriNetImpl extends EObjectImpl implements PetriNet {

protected EList<PetriNets.Object> object;

protected PetriNetImpl() {

super();

}

protected EClass eStaticClass() {

return PetriNetsPackage.Literals.PETRI_NET;

}

public EList<PetriNets.Object> getObject() {

if (object == null) {

object = new EObjectContainmentEList<PetriNets.Object>(Petri

}

return object;

}

public NotificationChain eInverseRemove(InternalEObject otherEnd, int

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return ((InternalEList<?>)getObject()).basicRemove(otherEn

}

return super.eInverseRemove(otherEnd, featureID, msgs);

}

public Object eGet(int featureID, boolean resolve, boolean coreType) {

switch (featureID) {

case PetriNetsPackage.PETRI_NET__OBJECT:

return getObject();

}

return super.eGet(featureID, resolve, coreType);

Domain model from which some code

can be generated

Some code needs to be implemented

manually

Page 14: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler How concise are models

With class diagrams (EMF/Ecore diagrams), some

subtle aspects of some domains cannot be

appropriately modelled

Additional constraints (OCL or programmed in Java)

allow us to express these subtle aspects (more or

less adequately)

14 MBSE (02341 f17), L09

Page 15: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Automatical code generation

structural parts of the software (API)

infrastructure (objects are notifiers) for saving and

loading object structures to files (in a default format

defined by the model: XMI)

default tree editors for editing object structures

factories for creating objects

...

With additional models for graphics

Fully functioning graphical editor

15 MBSE (02341 f17), L09

Page 16: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Framework

Existing infrastructure

adapters, observer, notifications,

command framework, undo and redo mechanism,

command framework

MVC, many patterns behind the scene (we just

scratched the surface yet)

16 MBSE (02341 f17), L09

Page 17: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Manually programming

Some specific graphics for ePNK programmed

manually YAWL graphics

Some technical classes (factory for specific

graphics) needed to be programmed manually

Some constraints programmed manually

Code for real functionality (editor is ”standard-

functionality”)

YAWL select actions

firing YAWL transition

17 MBSE (02341 f17), L09

Page 18: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler MBSE

The goal is not to get rid of programming as such;

but, to do things on the adequate level of abstraction

and in a clear and consise way

For some things, programming is an adequate and

consise way of doing things (classical algorithms,

graphical appearance)

For other things, programming is not adequate and

just used for technical reasons: We want to get rid of

technical artifacts

18 MBSE (02341 f17), L09

Page 19: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Architecture by Example:

ePNK Applications

Page 20: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

20 MBSE (02341 f17), L09

Page 21: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler YAWL Simulator annotations

21 MBSE (02341 f17), L09

Page 22: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Blackboard Discussion

Based on object diagram from slide 9

(and using some classes from slide 10):

Scenario for starting the YAWL simulator BB

Scenario for firing a YAWL transition BB

22 MBSE (02341 f17), L09

Page 23: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Modelling Behaviour

Page 24: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Overview

Modelling behaviour on domain level

Business process modelling

YAWL models

Activity diagrams ( UML)

UML diagrams from modelling behaviour: overview

xUML (Executable UML): short overview

Other notations

Story Patterns: by example

The Event Coordination Notation (ECNO): by example 24 MBSE (02341 f17), L09

Page 25: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler 1. BPM / YAWL

25 MBSE (02341 f17), L09

Page 26: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler What are good process models (1)

Have a goal (litmus test: name / description)

Have a start and an end

Tasks have a good name: verb object

e.g. register customer, pay bill, cancel appointment,

...

Possible order of execution of tasks makes sense

from the domain point of view

26 MBSE (02341 f17), L09

Page 27: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler What are good process models (2)

Whatever happend in the process, it is always

possible to finish the process

When the process is finished, nothing is left in the

process anymore and no task can be executed

anymore

27 MBSE (02341 f17), L09

Page 28: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

28 MBSE (02341 f17), L09

2. Behaviour in UML

In UML, there are different concepts and diagrams that

concern behaviour modelling

Use case diagrams

Activity diagrams

Interaction diagrams Sequence diagrams

Communication diagrams

State machine diagrams (State Charts)

Methods of classes (MOF: Operation) (in combination with OCL, the input/output relation of a method can be specified)

Page 29: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

29 MBSE (02341 f17), L09

Activity diagrams

From: OMG Unified Modeling Language (OMG UML), Superstructure, V2.1.2,

November 2007, p. 331

Page 30: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

30 MBSE (02341 f17), L09

Activity diagrams

From: OMG Unified Modeling Language (OMG UML), Superstructure, V2.1.2,

November 2007, p. 331

Page 31: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

31 MBSE (02341 f17), L09

Activity diagrams

From: OMG Unified Modeling Language (OMG UML), Superstructure, V2.1.2,

November 2007, p. 331

Page 32: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

32 MBSE (02341 f17), L09

turn key

“Sequence Diagram”

rain

sensor

ignition

switch wiper wiper

control

on

rain

on

off

Page 33: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

33 MBSE (02341 f17), L09

”Communication Diagram”

ignition

switch

rain

sensor

wiper

wiper

control

1: on 2: off

3: rain

4: on

Page 34: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

34 MBSE (02341 f17), L09

Sequence diagram (details)

o:Order item 1 item 2 product 1 product 2 :Customer

getPrice() getPrice()

getPrice()

amount()

sum1

getPrice() getPrice()

amount()

sum2

getCustomerDiscount()

discount

Lifeline

Message

Events Events

total

Page 35: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

35 MBSE (02341 f17), L09

Sequence diagram (details)

o:Order item 1 item 2 product 1 product 2 :Customer

getPrice() getPrice()

getPrice()

amount()

sum1

getPrice() getPrice()

amount()

sum2

getCustomerDiscount()

discount

Call (synchronous)

return

Self-

call

total Activation

Page 36: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

36 MBSE (02341 f17), L09

“State machines”

wiper

control

engine

off

wiper

off

rd.rain/w.on rd.dry/w.off

i

rd

w

Message

wiper

on

on

Initial state

off

rain on

off

Page 37: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

37 MBSE (02341 f17), L09

Use of state machines

ignition

switch

rain

sensor

wiper

wiper

control

wiper

One automaton for each component

(plus structure) defines the complete

behaviour of our “wiper system”.

Page 38: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

38 MBSE (02341 f17), L09

“State machines”

wiper

control

engine

off

wiper

off

i.on/w.off

i.off/w.off

rd.ra

in/w

.on

rd.d

ry/w

.off

i

rd

w

wiper

on

Complex

state

Page 39: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

39 MBSE (02341 f17), L09

Behaviour in UML

Use case diagrams

Activity diagrams

Interaction diagrams

Sequence diagrams

Communication diagrams

State machine diagrams (State Charts)

Methods of classes (in combination with OCL, the input/output relation

of a method can be specified)

Page 40: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler Behaviour in UML

In general, UML behaviour models are used to

analyse, design, and document a system

It is hard to generate code from that automatically.

40 MBSE (02341 f17), L09

Page 41: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler 3. xUML

Restricted versions of UML

”Domain diagram” (package diagram)

Class diagrams for each ”domain”

Use Case diagrams

Sequence diagrams

State machines (signals triggering transitions)

Signals

UML Action Language (ASL) for defining

actions/operations on an abstract level and

independent from a programming language

41 MBSE (02341 f17), L09

Page 42: Model-based Software Engineering (02341) · What are good process models (2) Whatever happend in the process, it is always possible to finish the process When the process is finished,

Ekkart Kindler

TBC (to be continued)

42 MBSE (02341 f17), L09