Presentation on theme: "ASWEC 2006 Proposed Notation for Exception Handling in UML 2 Sequence Diagrams Oddleif Halvorsen Øystein Haugen."— Presentation transcript:
ASWEC 2006 Proposed Notation for Exception Handling in UML 2 Sequence Diagrams Oddleif Halvorsen Øystein Haugen
ASWEC 2006 11-Jun-14Halvorsen / Haugen2 What are UML 2 Sequence Diagrams? Describe interaction sequences Emphasize the interaction between objects Partial descriptions May be used to verify interaction properties with respect to a specification Send event Receive event Asynchronous message
ASWEC 2006 11-Jun-14Halvorsen / Haugen3 Why the Need for Exception Handling? This basic description of an object cannot be cluttered up with all of the details needed for handling the contingencies. - Terry Winograd (1979)
ASWEC 2006 11-Jun-14Halvorsen / Haugen4 Challenges wrt. Seq. Diagrams and Exceptions How to visually isolate exception handling from a sequence diagram without disturbing the current semantics? Sequence diagrams are often used to describe distributed and multithreaded environments –The scope of exception handling in modern programming languages is normally limited to one call stack Sequence diagrams describes sets of traces –There is no call stack
ASWEC 2006 11-Jun-14Halvorsen / Haugen5 Example Scene – Withdrawal of money from an ATM Happy Day Scenario –Enter a card –Give the correct pin –Select a legal amount to withdraw –Receive the money and the card Exceptions –Unrecognized card –Wrong pin –Selected too high amount to withdraw –ATM is out of money –Lost connection with the bank –Unable to deliver the money –Unable to give back card –...
ASWEC 2006 11-Jun-14Halvorsen / Haugen6 Handling exceptions with current standard Ensuring correct pin. Preventing the user from withdrawing more than allowed. No valid pin given.
ASWEC 2006 11-Jun-14Halvorsen / Haugen7 Our Way The normal flow Adding exception flow without obstructing the normal flow Reference to a diagram that handles the exception. Guard that triggers the exception.
ASWEC 2006 11-Jun-14Halvorsen / Haugen8 Dynamic Gate Matching Recovered from the exception. If a gate can be matched it is combined to complete the trace
ASWEC 2006 11-Jun-14Halvorsen / Haugen9 Dynamic Gate Matching (continued) The normal flow diagrams Exception handling with dynamic gate matching
ASWEC 2006 11-Jun-14Halvorsen / Haugen10 The Diagram Stack Example stack –The user enters wrong pin twice –Correct pin the third time Each frame represent a new separate layer of diagrams. Move between frames through the use of exception and return. First attempt, wrong pin. Second attempt, wrong pin. Third attempt, correct pin. The trace can now continue with the normal flow.
ASWEC 2006 11-Jun-14Halvorsen / Haugen11 Trace Semantics Without exceptions: U = seq Disregarding the exception: U = a seq seq b seq d Recoverable exception: –b is a subtrace such that b contains no events on the same lifeline as that of q –c [[e]] i.e. c is a trace in the exception –Provided d is not empty, it starts with an event on the same lifeline as q –U = a seq seq (b par c) seq d where a,b,c,d are (sub)traces and seq is trace concatenation and par represents all possible merge combinations a: events executed before the exception b: events enabled before the exception : trigger d: events after the exception c: exception
ASWEC 2006 11-Jun-14Halvorsen / Haugen12 Conclusion Properties of our concepts of exception in UML Seq. Diag –Compact notation –Clear visual separation between the normal flow and the exception handling –Underpinned by precise semantics –May describe exception handling in synchronous as well as multithreaded and distributed scenarios