State Machines Model Consistency and Beauty

State Machines Model Consistency and Beauty

INF5120, Lecture 10 March 18th, 2019 UML Interactions Sequence Diagrams and UML State Machines Professor Øystein Haugen | Faculty of Computer Science, ØUC – Arne J. Berre, UiO/SINTEF 18.03.2019 1 Overview of lecture Sequence Diagrams What are they intended for? Where in the software engineering process are they used? The History Lesson a very short history this time Basic sequence diagrams Interaction Fragments – structuring mechanisms Tooling Sequence Diagrams in Papyrus Interactions or Sequence Diagrams? Experiences and challenges Interaction Metamodel Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 2 This is a Sequence Diagram Frame Lifeline Message Combined Fragment Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 3 Sequence Diagrams in a nutshell Sequence Diagrams are simple powerful readable Emphasizes the interaction between objects when interplay is the most important aspect Often only a small portion of the total variety of behavior is described improve the individual understanding of an interaction problem Sequence Diagrams are used to ... document protocol situations, illustrate behavior situations, verify interaction properties relative to a specification, describe test cases, document simulation traces. Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 4 Sequence Diagrams History Used informally for a number of years prior to 1990 Standardized in 1992 in Z.120 Message Sequence Charts – MSC Initiated by Ekkart Rudolph (Siemens) and Jens Grabowski (now Professor in Göttingen) Last major revision of MSC is from 1999 called MSC-2000 with Ø. Haugen as Rapporteur, representing Ericsson Formal semantics of MSC-96 is given in Z.120 Annex B Sjouke Mauw (now Prof at Univ. of Luxembourg) and Michel Reniers (now Assoc. Prof. at Univ. of Eindhoven) Included in UML 1 from 1999 but in another variant also pioneered by Siemens Most of MSC was included in UML 2.0 (2003) Responsible Ø. Haugen (representing Ericsson) Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 5 The example context: Dolly Goes To Town Dolly is going to town and wants to subscribe for bus schedules back home given her current position and the time of day. The service should not come in effect until a given time in the evening Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 7 The informal architecture positioning Service Base web position terminal local ads ads info info subscription subscription information mobile request provider terminal info local info info cache info Service Terminal user information pusher Service (SMS sender, WAP portal) User Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 8 Lifeline – the “doers” :ServiceBase Lifeline head with name the lifeline itself is anonymous, but its type is ServiceBase Lifeline ordered from top to bottom Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 9 (Simple) Sequence Diagram Messages have one send event, and one receive event. The send event must occur before the receive event. Events are strictly ordered along a lifeline from top to bottom The frame (UML 2) sd Authorization The name of the interaction :ServiceUser :ServiceBase :ServiceTerminal Send Event Code OK Receive OnWeb Event OK Message name How many global traces are there in this diagram? The only invariants: Messages have one send event, and one receive event. The send event must occur before the receive event. Events are strictly ordered along lifeline sd Authorization How many? • 1, 2, 3, 4, 5, :ServiceUser :ServiceBase :ServiceTerminal 6,..? Code OK OnWeb OK Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 11 How many global traces are there in this diagram? The only invariants: Messages have one send event, and one receive event. The send event must occur before the receive event. Events are strictly ordered along lifeline sd Authorization How many? • 1, 2, 3, 4, 5, :ServiceUser :ServiceBase :ServiceTerminal 6,..? Code OK OnWeb OK independent! Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 12 Really counting the traces ... 1 2 3 1 2 4 3 5 6 4 5 7 sd Authorization 8 5 7 4 6 :ServiceUser :ServiceBase :ServiceTerminal Code6 7 5 6 7 4 OK 7 6 OnWeb 6 7 6 7 OK 8 8 8 8 8 8 Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 13 Asynchronous messages: Message Overtaking asynchronous communication = when the sender does not wait for the reply of the message sent Reception is normally interpreted as consumption of the message. When messages are asynchronous, it is important to be able to describe message overtaking. notice sd Authorization message to/from :ServiceBase :ServiceTerminal environment Code OK OnWeb info receiving OnWeb after sending OnWeb receiving Info before sending Info OK Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 14 The context of a Sequence Diagram The context is a Classifier with Composite Structure (of properties) Properties (parts) are represented by Lifelines The concept of a context with internal structure leads to an aggregate hierarchy of entities (parts) We exploit this through the concept of Decomposition GoHomeServiceContext ServiceUser ServiceTerminal sd GoHome sd Authorization ServiceBase :ServiceUser :ServiceTerminal :ServiceBase Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 15 Decomposing a Lifeline relative to an Interaction sd Authorization :ServiceBase :ServiceUser :ServiceTerminal ref SB_Authorization Code OK OnWeb this is the name of OK the diagram where we find the decomposition we want to look into this lifeline Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 16 The Decomposition sd Authorization :ServiceBase :ServiceUser :ServiceTerminal ref SB_Authorization Code sd SB_Authorization OK :Central OnWeb OK Code create :Authorizer notice the event correspondence! OK OK OnWeb notice the gate correspondence! Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 17 Lifeline creation and destruction We would like to describe Lifeline creation and destruction The idea here (though rather far fetched) is that the ServiceBase needs to create a new process in the big mainframe computer to perform the task of authorizing the received Code. We see a situation where several Authorizers work in parallel sd SB_Authorization :Central creation Message Code create :Authorizer OK OK OnWeb destruction Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 18 Synchronizing interaction method call message sd Authorization :ServiceUser :ServiceBase :ServiceTerminal Code OnWeb execution specification OK OK reply Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 19 Basic Sequence Diagrams Summary We consider mostly messages that are asynchronous, the sending of one message must come before the corresponding reception UML has traditionally described synchronizing method calls rather than asynchronous communication The events on a lifeline are strictly ordered The distance between events is not significant. The context of Interactions are classifiers A lifeline (within an interaction) may be detailed in a decomposition Dynamic creation and destruction of lifelines Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 20 More structure (UML 2.0 from MSC-96) interaction uses – such that Interactions may be referenced within other Interactions combined fragments – combining Interaction fragments to express alternatives, parallel merge and loops better overview of combinations – High level Interactions where Lifelines and individual Messages are hidden Not so useful since no tools support this gates – flexible connection points between references/expressions and their surroundings we have looked at this in the context of decomposition, but gates are also on InteractionUse and CombinedFragments Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 21 References sd GoHome interaction use :ServiceUser :ServiceBase :ServiceTerminal ref GoHomeSetup loop ref GoHomeInvocation ref GoHomeDismantle Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 22 Gates sd GoHomeSetup interaction use :ServiceUser :ServiceBase :ServiceTerminal sd Authorization Code ref :ServiceBase :ServiceTerminal OK Authorization Code OK OK opt OnWeb ref FindLocation info SetHome OK SetInvocationTime SetTransportPreferences actual gate formal gate Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 23 Combined fragment example sd GoHomeInvocation frame :ServiceUser :Clock :ServiceBase :ServiceTerminal InvocationTime operator ref FindLocation TransportSchedule loop operand alt ScheduleIntervalElapsed separator ref FindLocation TransportSchedule GetTransportSchedule TransportSchedule FetchSchedule Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 24 static time intv; parameter time last; coord lastpos; Data in Guards coord dist; sd GoHomeInvocation(Time invoc) coord pos; guard on global or static values :ServiceUser :Clock :ServiceBase :ServiceTerminal [Now>invoc] InvocationTime FindLocation guard on dynamic TransportSchedule and local values, loop alt local to the object of [Now>interv+last] the first event of ScheduleIntervalElapsed operand FindLocation TransportSchedule note that there is no [pos-lastpos>dist] single object deciding GetTransportSchedule the choice, but each TransportSchedule guard is limited FetchSchedule Professor Øystein Haugen | Faculty of Computer Science 18.03.2019 25 And now chiefly yourselves !!! a) b) sd GoHomeInvocation

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    70 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us