02291: System Integration Introduction to UML Hubert Baumeister - - PowerPoint PPT Presentation

02291 system integration
SMART_READER_LITE
LIVE PREVIEW

02291: System Integration Introduction to UML Hubert Baumeister - - PowerPoint PPT Presentation

02291: System Integration Introduction to UML Hubert Baumeister huba@dtu.dk DTU Compute Technical University of Denmark Spring 2020 What is the UML? Unified Modelling Language (UML) Family of graphical notations for describing aspects


slide-1
SLIDE 1

02291: System Integration

Introduction to UML Hubert Baumeister

huba@dtu.dk

DTU Compute Technical University of Denmark

Spring 2020

slide-2
SLIDE 2

What is the UML?

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

(object-oriented) software

◮ ”A picture is more than a thousand words”

◮ Based on a metamodel ◮ Not a development process ◮ UML is an open standard and an ISO standard

◮ managed by the Object Management Group

(www.omg.org)

◮ Web resources

◮ http://www.uml.org

slide-3
SLIDE 3

UML ’s history

◮ 1980s

◮ Objects became main stream ◮ OO methods and graphical notations ◮ Grady Booch, Peter Coad, Ivar Jacobson, Jim Odell, Jim

Rumbaugh, Sally Shlaer and Steve Mellor, Rebecca Wirfs-Brock, . . .

◮ 1990s

◮ Grady Booch, Ivar Jacobson and Jim Rumbaugh at

Rational

◮ First version of the UML (UML 0.8)

◮ 1996

◮ The Object Management Group (OMG) ◮ Driven by tool vendors! ◮ Tool interoperability!

◮ 2005

◮ UML 2.0 ISO standard

slide-4
SLIDE 4

Notations and Metamodels

◮ UML consists of

◮ a set of graphical notations ◮ and a single metamodel

slide-5
SLIDE 5

Example of a 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 scanLibraryCard() checkOut scanBook() checkIn ... {inv: overdue iff dueDate <> null and today > dueDate} Book

  • verdue

dueDate register() deregister() checkout() checkin() Borrower canBorrow() Library scan library card() check out scan book() check in ... 0..5 * user *

slide-6
SLIDE 6

Metamodel Excerpt

Classifier Class Operation Classifier StructuralFeature Association + isDerived : Boolean = false Classifier Relationship ValueSpecification Type Property + isDerived : Boolean = false + isReadOnly : Boolean = false {redefines isReadOnly} + isDerivedUnion : Boolean = false + /default : String [0..1] + aggregation : AggregationKind = none + /isComposite : Boolean + isID : Boolean = false «enumeration» AggregationKind none shared composite * + class * + /superClass {subsets classifier} {redefines general} 0..1 + class * + ownedOperation {subsets featuringClassifier, subsets redefinitionContext, subsets namespace} {ordered, subsets feature, subsets redefinableElement, subsets ownedMember} 0..1 + class * + nestedClassifier {subsets namespace, subsets redefinitionContext} {ordered, subsets ownedMember, subsets redefinableElement} 0..1 + association * + navigableOwnedEnd {subsets owningAssociation} {subsets ownedEnd} 0..1 + owningAssociation * + ownedEnd {subsets association, subsets featuringClassifier, subsets namespace, subsets redefinitionContext} {ordered, subsets memberEnd, subsets feature, subsets ownedMember, subsets redefinableElement} 0..1 + association 2..* + memberEnd {subsets memberNamespace} {ordered, subsets member} 0..1 + owningProperty 0..1 + defaultValue {subsets owner} {subsets ownedElement} * + association 1..* + /endType {subsets relationship} {ordered, readOnly, subsets relatedElement} 0..1 + class * + ownedAttribute {subsets classifier, subsets namespace} {ordered, subsets attribute, subsets ownedMember} * * + subsettedProperty 0..1 0..1 + /opposite * + property * + redefinedProperty {subsets redefinableElement} {subsets redefinedElement} {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 scanLibraryCard() checkOut scanBook() checkIn ... {inv: overdue iff dueDate <> null and today > dueDate} Book

  • verdue

dueDate register() deregister() checkout() checkin() Borrower canBorrow() Library scan library card() check out scan book() check in ... 0..5 * user *

slide-7
SLIDE 7

Metamodel

◮ Abstract syntax of UML diagrams ◮ Describes the concepts of UML elements

◮ e.g. class, association, . . .

◮ concepts are mapped to notations

◮ e.g. the concept of a class is mapped to rectangle with

subcompartments

◮ Metamodel written in MOF (Meta-Object Facility)

◮ Basically UML class diagrams

→ MOF can be used to defined ones own modelling language → Course Software Engineering II (02162)

◮ The metamodel is important for model exchange

◮ XMI (XML Metadata Interchange)

slide-8
SLIDE 8

The meaning of UML

◮ The abstract syntax / concepts: OK

→ metamodel

◮ The meaning of the concepts: not well-defined

◮ Meaning of class? ◮ Execution of activity diagrams and state machines

◮ Semantic variation points

◮ Left open in the standard ◮ Tool vendors choose meaning

slide-9
SLIDE 9

Ways of using the UML

◮ Sketch

◮ Informal use

→ Use of whiteboards, simple graphic editors

◮ Blueprint

◮ Forward Engineering: e.g. create class stubs

→ Use of CASE tools

◮ Programming language

◮ Executable UML ◮ Problems ◮ How to describe the behaviour?

→ Use of CASE tools

slide-10
SLIDE 10

UML is not enough

◮ UML is a general purpose modelling language ◮ UML can be extended

◮ lightweight (UML profile) ◮ heavy weight

→ Use the modelling language best suited for your purpose

slide-11
SLIDE 11

UML Diagrams (I)

◮ Structure Diagrams

◮ Class Diagram ◮ Class, features, and relationships ◮ Object Diagram ◮ Example configuration of instances ◮ Package Diagram ◮ Hierarchical structure for models ◮ Component Diagram ◮ Structure and connections of components ◮ Deployment Diagram ◮ Deployment of artifacts to nodes ◮ Composite Structure Diagram ◮ Runtime decomposition of a class

slide-12
SLIDE 12

UML Diagrams (II)

◮ Behaviour Diagrams

◮ Use-Case Diagram ◮ How users interact with a system ◮ Activity Diagram ◮ Procedural and parallel behaviour ◮ State Machine Diagram ◮ How events change an object over its life ◮ Interaction Diagram ◮ Sequence Diagram: Interaction between objects; emphasis

  • n sequence

◮ Communication Diagram (formerly called collaboration

diagram): Interaction between objects; emphasis on links

◮ Interaction Overview Diagram: Mix of sequence and activity

diagram

◮ Timing Diagram: Interaction between objects; emphasis on

timing

slide-13
SLIDE 13

Focus of the course

One car, many models (abstractions)

slide-14
SLIDE 14

Focus of the course

One system, many models (abstractions) Different Views on the system

◮ Functionality: Use Case diagram, state machines, activity

diagram, . . .

◮ Structure: Component diagram, Class diagram ◮ Validation: Interaction diagram

slide-15
SLIDE 15

Library Example: Detail of Use case borrow book

Use case diagram

User LibrarySystem borrow book return book search for book

Use case borrow book Basic course of events:

  • 1. User scans his library card
  • 2. User selects check out
  • 3. User scans the book
  • 4. System confirms loan
slide-16
SLIDE 16

Implementation: Component Diagram

<<interface>> LibraryInterface scanLibraryCard() checkOut scanBook() checkIn ... LibraryInterface LibrarySystem

slide-17
SLIDE 17

Implementation: Class Diagram

slide-18
SLIDE 18

Library SM

user ok user ok can borrow? ... ... book scanned User scanned Idle checkOut/return [not cb] / return "book can't be borrowed" scanBook(l) [cb] / b.checkOut(); return "ok" / cb := bor.canBorrow() [users->contains(l)]/return true [not users->contains(l)] / return err-msg scanLibraryCard (l)

slide-19
SLIDE 19

Use Case success scenario realisation

sd: borrow book success scan library card(bor) true checkOut() scan book(b) canBorrow() isOverdue() false loop true checkout(bor) true true loop User Library bor:Borrower [b in bor.books] b1:Book b2:Book

slide-20
SLIDE 20

Use case borrow book: User interactions

Use case borrow book: Basic course of events

  • 1. User scans his library card
  • 2. User selects check out
  • 3. User scans the book
  • 4. System confirms loan

sd: borrow book success scan library card(bor) true checkOut() scan book(b) canBorrow() loop true true loop User Library

slide-21
SLIDE 21

Library SM

user ok user ok can borrow? ... ... book scanned User scanned Idle checkOut/return [not cb] / return "book can't be borrowed" scanBook(l) [cb] / b.checkOut(); return "ok" / cb := bor.canBorrow() [users->contains(l)]/return true [not users->contains(l)] / return err-msg scanLibraryCard (l) sd: borrow book success scan library card(bor) true checkOut() scan book(b) canBorrow() isOverdue() false loop true checkout(bor) true true loop User Library bor:Borrower [b in bor.books] b1:Book b2:Book