02291: System Integration

43
02291: System Integration Week 1 Hubert Baumeister [email protected] DTU Compute Technical University of Denmark Spring 2018

Transcript of 02291: System Integration

Page 1: 02291: System Integration

02291: System IntegrationWeek 1

Hubert [email protected]

DTU ComputeTechnical University of Denmark

Spring 2018

Page 2: 02291: System Integration

Contents

Overview

Introduction to UML

Practical Informations

Page 3: 02291: System Integration

System Integration

I TypeI 5 ECTS PointsI Audience: Masters / advanced Bachelor studentsI Lectures with exercisesI Exam: modelling project with project presentation

I Time and LocationI Lecture Wednesdays 10:15–12:00I Exercise session before the lecture 8:15–10:00

I How to reach meI [email protected]; office 303A/058I Teaching assistants: Constantina Ioannou and Wenhao Li

I Web PageI http://www2.compute.dtu.dk/courses/02291I Piazza

Page 4: 02291: System Integration

Problem in Software Engineering

I Liggesmeyer 1998

Page 5: 02291: System Integration

Why model?

I Abstraction is the key→ Models for the problem and the solution→ Feedback early

I Model inspectionI Automatic code generationI Analysis of models

Page 6: 02291: System Integration

Model (definition)http://en.wiktionary.org/wiki/model

. . .A simplified representation used to explain the workings ofa real world system or event.

I ”The computer weather model did not correctly predict thepath of the hurricane.”

A plane in a windtunnel Clay model of a car

→ AbstractionI Focus on some aspects only, e.g. air resistanceI Disregard the other aspectsI Aggregate details by introducing new concepts

Page 7: 02291: System Integration

Learning objectives:

I Know about1 (Object-oriented) modelling languages: mainly UML2 Why model?3 How to model4 How to validate a model

I To be able toI Model larger systemsI Use models for understanding, designing, communication,

analysing, verification, and creating softwareI Document modelsI Analyse modelsI Validate models

Page 8: 02291: System Integration

Why model?

I Conjecture:I it suffices to communicate only key abstractions rather than

the whole programmI it is easier to create a model of the system than to

program itI a model of the system is easier to understand than the

program itself

Page 9: 02291: System Integration

Example MUDA Multi User Dungeon (MUD) game

0 6

2

1

5

4

3

Start room Special room

Page 10: 02291: System Integration

Abstraction: Focus on Functionality

Use Case Diagram for the MUD game

Page 11: 02291: System Integration

Abstraction: Focus on Structure

StartRoomSpecialRoom

Level

Player

Room

PersonalObject

nextLevel*

0..1

connectedTo*

*

1

1..* 1

*

0..1

*

*inventory

Page 12: 02291: System Integration

Abstraction: Focus on the Behaviour

Take object activity in the MUD game

throw InvalidActionException

add object to inventory

remove object fromcurrent room

remove object fromoriginal room

remove object fromother player currentroom

[current room contains object]

[current room does notcontain object]

[is clone]

[!is clone]

[all other players notified][has other player]

Page 13: 02291: System Integration

Use of models

I informalI communication→ problem of ambiguityI drawings on a black board

I formalI verification / validationI simulationI code generation

Page 14: 02291: System Integration

Example for an informal model

Class Responsibility Collaboration (CRC) cards for theHotDraw editorhttp://www2.compute.dtu.dk/courses/02291/examples/draw.html

Page 15: 02291: System Integration

How to model?

I Domain Driven DesignI CRC cardsI Model Driven ArchitectureI Explorative ModellingI Agile Modelling

Page 16: 02291: System Integration

Contents

Overview

Introduction to UML

Practical Informations

Page 17: 02291: System Integration

What is the UML?

I Unified Modelling Language (UML)I Family of graphical notations for describing aspects of

(object-oriented) softwareI ”A picture is more than a thousand words”

I Based on a metamodelI Not a development processI UML is an open standard and an ISO standard

I managed by the Object Management Group(www.omg.org)

I Web resourcesI http://www.uml.org

Page 18: 02291: System Integration

UML’s history

I 1980sI Objects became main streamI OO methods and graphical notations

I Grady Booch, Peter Coad, Ivar Jacobson, Jim Odell, JimRumbaugh, Sally Shlaer and Steve Mellor, RebeccaWirfs-Brock, . . .

I 1990sI Grady Booch, Ivar Jacobson and Jim Rumbaugh at

RationalI First version of the UML (UML 0.8)

I 1996I The Object Management Group (OMG)I Driven by tool vendors!

I Tool interoperability!I 1.x with 1.4 and 1.5 being widely used

I 2005I UML 2.0 ISO standard

Page 19: 02291: System Integration

Notations and Metamodels

I UML consists ofI a set of graphical notationsI and a single metamodel

Page 20: 02291: System Integration

Example of a class diagram

StartRoomSpecialRoom

Level

Player

Room

PersonalObject

nextLevel*

0..1

connectedTo*

*

1

1..* 1

*

0..1

*

*inventory

Page 21: 02291: System Integration

Metamodel

I Abstract syntax of UML diagramsI Describes the concepts of UML elements

I e.g. class, association, . . .I concepts are mapped to notations

I e.g. the concept of a class is mapped to rectangle withsubcompartments

I Metamodel written in MOF (Meta-Object Facility)I Basically UML class diagrams→ MOF can be used to defined ones own modelling language→ Course Software Engineering II (02162)

I The metamodel is important for model exchangeI XMI (XML Metadata Interchange)

Page 22: 02291: System Integration

Metamodel Excerpt

Page 23: 02291: System Integration

The meaning of UML

I The abstract syntax / concepts: Ok→ metamodel

I The meaning of the concepts: not well-definedI Meaning of class?I Execution of activity diagrams and state machines

I Semantic variation pointsI Left open in the standardI Tool vendors choose meaning

Page 24: 02291: System Integration

Ways of using the UML

I SketchI Informal use→ Use of whiteboards, simple graphic editors

I BlueprintI Forward Engineering: e.g. create class stubs→ Use of CASE tools

I Programming languageI Executable UMLI Problems

I How to describe the behaviour?

→ Use of CASE tools

Page 25: 02291: System Integration

Ways of using the UML

I SketchI Informal use→ Use of whiteboards, simple graphic editors

I BlueprintI Forward Engineering: e.g. create class stubs→ Use of CASE tools

I Programming languageI Executable UMLI Problems

I How to describe the behaviour?

→ Use of CASE tools

Page 26: 02291: System Integration

Ways of using the UML

I SketchI Informal use→ Use of whiteboards, simple graphic editors

I BlueprintI Forward Engineering: e.g. create class stubs→ Use of CASE tools

I Programming languageI Executable UMLI Problems

I How to describe the behaviour?

→ Use of CASE tools

Page 27: 02291: System Integration

UML is not enough

I UML is a general purpose modelling languageI UML can be extended

I lightweight (UML profile)I heavy weight

→ Use the modelling language best suited for your purpose

Page 28: 02291: System Integration

UML Diagrams (I)

I Structure DiagramsI Class Diagram

I Class, features, and relationshipsI Object Diagram

I Example configuration of instancesI Package Diagram

I Hierarchical structure for modelsI Component Diagram

I Structure and connections of componentsI Deployment Diagram

I Deployment of artifacts to nodesI Composite Structure Diagram

I Runtime decomposition of a class

Page 29: 02291: System Integration

UML Diagrams (II)

I Behaviour DiagramsI Use-Case Diagram

I How users interact with a systemI Activity Diagram

I Procedural and parallel behaviourI State Machine Diagram

I How events change an object over its lifeI Interaction Diagram

I Sequence Diagram: Interaction between objects; emphasison sequence

I Communication Diagram (formerly called collaborationdiagram): Interaction between objects; emphasis on links

I Interaction Overview Diagram: Mix of sequence and activitydiagram

I Timing Diagram: Interaction between objects; emphasis ontiming

Page 30: 02291: System Integration

Focus of the courseMany diagrams, but only one model

Different Views on the systemI Functionality: Use Case diagram, state machines, activity

diagram, . . .I Structure: Component diagram, Class diagramI Validation: Interaction diagram

Page 31: 02291: System Integration

Library Example: Detail of Use case borrow book

Use case diagram

User

LibrarySystem

borrow book

return book

search for book

Use case borrow bookBasic course of events:

1. User scans his library card2. User selects check out3. User scans the book4. System confirms loan

Page 32: 02291: System Integration

Implementation: Component Diagram

LibrarySystem

LibraryInterface

«interface»LibraryInterface

scan library card()check outscan book()check in...

Page 33: 02291: System Integration

Implementation: Class Diagram

{pre: bor.canBorrow() post: dueDate = Date.today + 3 weeks and bor.books->containing(self) }

{body: books->size <= 5 and books->forAll(b | not(b.overdue))}

«interface»LibraryInterface

scan library card()check outscan book()check in...

{ inv: overdue if f dueDate <> null and today > dueDate}

0..5*

user

*

BookoverduedueDateregister()deregister()checkout()checkin()

Borrower

canBorrow()

Library

scan library card()check outscan book()check in...

Page 34: 02291: System Integration

Library SM

user ok

can borrow?

...

book scannedUser scannedIdle

after 10min[not cb] / return (false,msg)

check out/ return

[cb] / book := books->select(b| b.signature = s);book.check_out(); return true

scan book/ (cb,msg) := bor.canBorrow()

[users->contains(l)]/ return true

[not users->contains(l)] / return false

scan library card (l)

Page 35: 02291: System Integration

Use Case success scenario realisationsd: borrow book success

scan librarycard(bor)

t rue

checkOut()

scan book(b)

canBorrow()

isOverdue()

false

loop

true

checkout(bor)

t rue

t rue

loop

UserLibrary bor:Borrower

[b in bor.books]

b1:Book b2:Book

Page 36: 02291: System Integration

Use case borrow book : User interactions

Use case borrow book :Basic course of events

1. User scans his library card2. User selects check out3. User scans the book4. System confirms loan

sd: borrow book success

scan librarycard(bor)

t rue

checkOut()

scan book(b)

canBorrow()

isOverdue()

false

loop

true

checkout(bor)

t rue

t rue

loop

UserLibrary bor:Borrower

[b in bor.books]

b1:Book b2:Book

Page 37: 02291: System Integration

Library SM

user ok

can borrow?

...

book scannedUser scannedIdle

after 10min[not cb] / return (false,msg)

check out/ return

[cb] / book := books->select(b| b.signature = s);book.check_out(); return true

scan book/ (cb,msg) := bor.canBorrow()

[users->contains(l)]/ return true

[not users->contains(l)] / return false

scan library card (l)

sd: borrow book success

scan librarycard(bor)

t rue

checkOut()

scan book(b)

canBorrow()

isOverdue()

false

loop

true

checkout(bor)

t rue

t rue

loop

UserLibrary bor:Borrower

[b in bor.books]

b1:Book b2:Book

Page 38: 02291: System Integration

Contents

Overview

Introduction to UML

Practical Informations

Page 39: 02291: System Integration

Course Contents

I UMLI Class-, Component-, Object- . . . diagramsI Activity-, Interaction- . . . diagramsI Object Constraint Language

I How to modelI Agile modellingI CRC cardsI Explorative ModellingI Domain Driven DesignI Model Driven Design

I Validation / VerificationI Acceptance testsI (UML) modelcheckingI Use Case Realizations

Page 40: 02291: System Integration

Exam Project

I ProjectI Task is to model a larger system (requirements, design,

validation/verification) so that programmers can implementthe design

I Duration 4 weeks at the end of the lectureI Written reportI Groups: 4—6 people

I Project presentationI About the projectI About the lectureI Dates: TBD (in the exam period)

Page 41: 02291: System Integration

Final project

I StepsI Model the requirements

I Domain ModelI Use CasesI Create a test modelI . . .

I Build a design modelI Component modelI Class diagramsI OCL constraintsI . . .

I Verify and validate the designI Use interaction diagrams to show that the use cases are

realizableI . . .

I Reflect on the methods you use

Page 42: 02291: System Integration

Literature: UML

I Most books on UML will do. Make sure it deals with UML2.x. Some options

I Grady Booch, James Rumbaugh, and Ivar Jacobson TheUnified Modeling Language User Guide (2nd Edition)(Users manual from the creators of UML)

I Martin Fowler UML Distilled. Third Edition (Contains adistilled version of the most important UML diagrams)

I Perdita Stevens Using UML (A text book for teaching OOand UML)

Page 43: 02291: System Integration

Literature: OCL, Modeling

I OCLI Jos Warmer and Anneke Kleppe The Object Constraint

Language. Second EditionI Modeling

I Scott Ambler Agile ModelingI Eric Evans Domain-Driven DesignI Nancy Wiklinson Using CRC CardsI Anneke Kleppe, Jos Warmer, Wim Bast MDA Explained

I Further reading and Web resources will be given whencoming to the relevant topics