model-based software engineering (02341) · introduction and motivation organization organisation...

Post on 17-Jun-2020

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Model-based Software Engineering

(02341, Spring 2017)

Ekkart Kindler

I. Introduction

Ekkart Kindler

3 MBSE (02341 f17), L01

1. Motivation

What is “software engineering”?

What is “software”?

software = program

software engineering = programming

Ekkart Kindler

4 MBSE (02341 f17), L01

Program vs. Software

Software >> Program

Software Engineering >>> Programming

is much more

than

is much much

more than

Ekkart Kindler

5 MBSE (02341 f17), L01

Programming vs. SE

Program

Programmer

Programming

Software

Software Engineer

Software Engineering

Ekkart Kindler

6 MBSE (02341 f17), L01

Software

Die Menge aller Programme, Prozeduren und

Objekte, zusammen mit den zugehörigen

Daten und der Dokumentation, die für eine

lauffähige Anwendung nötig oder

wünschenswert sind.

[frei nach Informatik DUDEN und Hesse]

Ekkart Kindler

7 MBSE (02341 f17), L01

Software

The sum of all programs, procedures and

objects along with the associated data and

documentation, which are necessary (or at

least desirable) for running an application on a

computer system.

Ekkart Kindler

8 MBSE (02341 f17), L01

2. Models in SE

… and a glimpse of how software can

be developed by using models –

without doing any programming at all.

Ekkart Kindler

9 MBSE (02341 f17), L01

Modelling

Ekkart Kindler

10 MBSE (02341 f17), L01

Idea for some Software

Ekkart Kindler

11 MBSE (02341 f17), L01

Example of a Petri net

semaphor

request1

critical1

idle1

request2

critical2

idle2

Ekkart Kindler Stages

Examples

Taxonomy (done on blackboard)

Glossary

Model (developed on blackboard)

12 MBSE (02341 f17), L01

Ekkart Kindler

13 MBSE (02341 f17), L01

1 target

Model for Petri nets Meta model for Petri nets

Models (Meta Models)

Petri net model

Place Transition

1 source

Arc

*

PetriNet context Arc inv: ( self.source.oclIsKindOf(Place) and self.target.oclIsKindOf(Transition) ) or ( self.source.oclIsKindOf(Transition) and self.target.oclIsKindOf(Place) )

Token *

Node

Object

object

token

Ekkart Kindler

14 MBSE (02341 f17), L01

1 target

Don’t think models as Java

Petri net model

Place Transition

1 source

Arc

*

PetriNet context Arc inv: ( self.source.oclIsKindOf(Place) and self.target.oclIsKindOf(Transition) ) or ( self.source.oclIsKindOf(Transition) and self.target.oclIsKindOf(Place) )

Token *

Node

Object

Ekkart Kindler Domain model

A domain model makes the concepts of a domain

explicit

It makes the concepts and the relations among them

precise

As software engineers, we used UML (class

diagrams) as a language for formulating a domain

model

Process

Examples

Talk to experts

Taxonomy / Glossary

Create the model

15 MBSE (02341 f17), L01

Ekkart Kindler

16 MBSE (02341 f17), L01

1 target

Domain model

Petri net model

Place Transition

1 source

Arc

*

PetriNet context Arc inv: ( self.source.oclIsKindOf(Place) and self.target.oclIsKindOf(Transition) ) or ( self.source.oclIsKindOf(Transition) and self.target.oclIsKindOf(Place) )

Token *

Node

Object

Ekkart Kindler

17 MBSE (02341 f17), L01

Syntax for instances

:Place

:Transition

:Arc

:Transition

:Place

:Arc

:Arc

source

target source

target

target source

:Arc source target

:Petrinet

:Token

graphical / concrete syntax

abstract syntax (as an UML object diagram)

Ekkart Kindler

18 MBSE (02341 f17), L01

Overview

:Place

:Transition

:Arc

:Transition

:Place

:Arc

:Arc

source

target source

target

target source

:Arc source target

:Petrinet

:Token

Place Transition

1 source

1 target

Arc

*

PetriNet

Token *

Node

Object

model

meta model

is an instance of

build-time

runtime

Ekkart Kindler

19 MBSE (02341 f17), L01

Benefits of Modelling

Better understanding

Mapping of instances to XML syntax (XMI)

Automatic code generation

API for creating, deleting and modifying model

Methods for loading and saving models (in XMI)

Standard mechanisms for keeping track of changes

(observers)

Ekkart Kindler

20 MBSE (02341 f17), L01

:Place

:Transition

:Arc

:Transition

:Place

:Arc

:Arc

source

target source

target

target source

:Arc source target

:Petrinet

:Token

Place Transition

1 source

1 target

Arc

*

PetriNet

Token *

Node

Object

Ekkart Kindler

21 MBSE (02341 f17), L01

Answers:

Program an editor

Standard technology for mapping abstract to

concrete syntax: EMF / GMF / …

Ekkart Kindler

22 MBSE (02341 f17), L01

GMF/Sirius

:Place

:Transition

:Arc

:Transition

:Place

:Arc

:Arc

source

target source

target

target source

:Arc source target

:Petrinet

:Token

Place Transition

1 source

1 target

Arc

*

PetriNet

Token *

Node

Object Place

Transition

Arc

Token

generate an editor

Ekkart Kindler

23 MBSE (02341 f17), L01

Benefits of Modelling (cntd.)

Better Understanding

Mapping of instances to XML syntax (XMI)

Automatic Code Generation

API for creating, deleting and modifying model

Methods for loading and saving models (in XMI)

Standard mechanisms for keeping track of changes

(observers)

Editors and GUIs

Ekkart Kindler

24 MBSE (02341 f17), L01

Idea for some Software

Ekkart Kindler

25 MBSE (02341 f17), L01

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

<plugin>

<extension point="org.eclipse.emf.ecore.generated_pa

<package

uri = "PetriNets"

class = "PetriNets.PetriNetsPackage"

genModel = "model/PetriNet.genmodel" />

</extension>

</plugin>

Today

Ekkart Kindler

26 MBSE (02341 f17), L01

Vision

Ekkart Kindler

27 MBSE (02341 f17), L01

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);

Ekkart Kindler

28 MBSE (02341 f17), L01

”Buzzwords”

Model Driven Architecture (MDA)

OMGTM software development approach for

separating business logic from platform specific

details

using models

automatic generators (for code and other models)

Model-based Software Engineering (MBSE)

General term for making “better” use of models for

easing the software development

Ultimately: Getting rid of programming

resp. technical artefacts.

Ekkart Kindler

29 MBSE (02341 f17), L01

”Buzzwords”

DSL (Domain Specific Language): Make it easy to

develop a language for some domain (in our

example Petri nets) along with editors (graphical or

textual)

MBSE technologies can be used for developing

DSLs by using domain models (meta-models)

More on the use of the term meta and

meta-model later in this course

Ekkart Kindler

30 MBSE (02341 f17), L01

Theses

We will always have programming and programmers!

We should always teach programming!

But, software engineers should be trained in their engineering and modelling skills!

And this is where they should be at their best!

Most of the rest can be automated!

Eventually, programming will be for software engineers as assembler is today for programmers.

Ekkart Kindler 3. Modelling with a Purpose

Anologies:

Models as floor plans (see earlier slides)

Architects and construction engineers use quite

different kind of plans – driven by the puprose

They even use models (miniatures)

Models as maps

Understand the world ( domain)

Find your way round in the software

31 MBSE (02341 f17), L01

Place Transition

1 source

1 target

Arc

*

PetriNet

Token

*

Node

Object

Ekkart Kindler Maps

32 MBSE (02341 f17), L01

Ekkart Kindler Maps

Different level of abstraction and detail

Different focus

Different aspects

Different purpose

33 MBSE (02341 f17), L01

Ekkart Kindler Software vs Programming

For programs (small software) models are often not

needed, and making them might be a waste of time.

For software they are essential for building

something which works out and the different pieces

fit to each other

34 MBSE (02341 f17), L01

Ekkart Kindler Discussion

Two models: Which is better?

35 MBSE (02341 f17), L01

Place Transition

1 source

1 target

Arc

*

PetriNet

Token *

Node

Object

Always ask first:

Better for what?

Ekkart Kindler Course: today

Lecture

Introduction and Motivation

Organization

Organisation of this course

Project

Tutorial

Tutorial 1: Getting started with EMF (Petrinet example)

Overview of task and steps

DO IT

36 MBSE (02341 f17), L01

More details on the

project in week 4!

top related