02291 system integration
play

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


  1. 02291: System Integration Introduction to UML Hubert Baumeister huba@dtu.dk DTU Compute Technical University of Denmark Spring 2020

  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

  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

  4. Notations and Metamodels ◮ UML consists of ◮ a set of graphical notations ◮ and a single metamodel

  5. Example of a class diagram <<interface>> LibraryInterface {inv: overdue iff dueDate <> null and today > dueDate} scanLibraryCard() checkOut scanBook() checkIn ... {pre: bor.canBorrow() post: dueDate = Date.today + 3 weeks and bor.books->containing(self) } Library Book overdue scan library card() dueDate check out * scan book() register() check in deregister() ... checkout() checkin() user 0..5 * Borrower canBorrow() {body: books->size <= 5 and books->forAll(b | not(b.overdue))}

  6. Metamodel Excerpt Classifier {subsets namespace, subsets {ordered, subsets ownedMember, redefinitionContext} subsets redefinableElement} + class + nestedClassifier Class Classifier 0..1 * {subsets featuringClassifier, {ordered, subsets feature, subsets redefinitionContext, subsets redefinableElement, subsets namespace} subsets ownedMember} + class + ownedOperation Operation 0..1 * {ordered, readOnly, Relationship Classifier {redefines general} subsets relatedElement} {subsets relationship} + /endType + association <<interface>> + /superClass * Type Association LibraryInterface {inv: overdue iff dueDate <> null and today > dueDate} * + class 1..* * + isDerived : Boolean = false scanLibraryCard() checkOut 0..1 0..1 scanBook() {subsets classifier} checkIn 0..1 + class + owningAssociation + association ... {pre: bor.canBorrow() 0..1 + association {subsets classifier, subsets namespace} {subsets memberNamespace} {subsets association, post: dueDate = Date.today + 3 weeks and {subsets owningAssociation} subsets featuringClassifier, bor.books->containing(self) } StructuralFeature subsets namespace, subsets redefinitionContext} Library Book {ordered, subsets member} overdue scan library card() 2..* + memberEnd dueDate {ordered, subsets attribute, {subsets ownedEnd} check out * * Property scan book() register() subsets ownedMember} + navigableOwnedEnd check in deregister() + ownedAttribute + isDerived : Boolean = false + isReadOnly : Boolean = false {redefines isReadOnly} ... checkout() + isDerivedUnion : Boolean = false checkin() * * + /default : String [0..1] user + aggregation : AggregationKind = none + ownedEnd 0..5 + /isComposite : Boolean * * {ordered, subsets memberEnd, subsets feature, + isID : Boolean = false Borrower subsets ownedMember, subsets redefinableElement} + redefinedProperty canBorrow() {body: books->size <= 5 and {subsets redefinedElement} books->forAll(b | not(b.overdue))} + subsettedProperty {subsets redefinableElement} * + property * * 0..1 0..1 + owningProperty + /opposite 0..1 {subsets owner} «enumeration» AggregationKind {subsets ownedElement} + defaultValue none shared ValueSpecification composite 0..1

  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)

  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

  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

  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

  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

  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 on 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

  13. Focus of the course One car, many models (abstractions)

  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

  15. Library Example: Detail of Use case borrow book Use case diagram Use case borrow book LibrarySystem Basic course of events: borrow book 1. User scans his library card 2. User selects check out return book 3. User scans the book User search for book 4. System confirms loan

  16. Implementation: Component Diagram LibrarySystem LibraryInterface <<interface>> LibraryInterface scanLibraryCard() checkOut scanBook() checkIn ...

  17. Implementation: Class Diagram

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

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

  20. Use case borrow book : User interactions sd: borrow book success Library User scan library card(bor) true Use case borrow book : loop checkOut() Basic course of events scan book(b) 1. User scans his library card canBorrow() 2. User selects check out loop 3. User scans the book 4. System confirms loan true true

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

Recommend


More recommend