15. Interactions – conditional paths, asynchronous message [Craig Larman] [http://www.phptr.com/articles/article.asp?p=360441&seqNum=6&rl=1] :E unconditional :A :C :B :D 1: msg1 1a [test1]:msg2 2: msg7 1b [not test1]:msg3 1c: msg4 a.1:<<create>> 1a and 1b are mutually exclusive conditional paths 1c.1: msg5 active object asynchrous message a.2:update( p ) :F Is this ok? Can you produce a corresponding sd? Is there a unique sequence of paths?
16.
17. public Class Selection { private Purchase myPurchase = new Purchase(); private Payment myPayment; public void purchase() { myPurchase.buyMajor(); myPurchase.buyMinor(): myPayment = new Payment( cashTender ); //. . } // . . } :Selection :Purchase :Payment purchase buyMajor buyMinor create(cashTender) Sequence Diagrams & Some Programming
18.
19. sd Withdrawal :User :ATM :Bank ref Authenticate alt alt PIN OK PIN NOK withdraw msg (“amount”) amount (a) chkAcct (a) msg (“card”) msg (“illegal entry”) enough bal not enough bal money receipt msg(“amount too big”) sd Authenticate :User :ATM :Bank ref EnterPIN loop(0,3) PIN NOK msg (“try again”) cardId(cid) Idle ref EnterPIN sd EnterPIN :User :ATM :Bank PIN NOK pin-nok Digit[4] alt pin-ok PIN NOK Code(cid,pin) Frames: References continuation nested fragment operands operator
20. sd Withdrawal :User :ATM :Bank ref Authenticate PIN OK PIN NOK withdraw msg (“amount”) amount (a) chkAcct (a) msg (“card”) msg (“illegal entry”) not enough bal msg(“amount too big”) Interaction Overview Diagram :User :ATM :Bank sd :User :ATM sd :User :ATM sd enough bal money receipt :User :ATM :Bank sd sd Relationship with Sequence Diagram?
21.
22. What can be in the top boxes? (http://www.agilemodeling.com/artifacts/sequenceDiagram.htm) Outputting transcripts Boundary/interface elements : software elements such as screens, reports, HTML pages, or system interfaces that actors interact with. Control/process elements ( controllers ) : These serve as the glue between boundary elements and entity elements, implementing the logic required to manage the various elements and their interactions. Often implemented using objects, but simple ones using methods of an entity or boundary class. Entity elements
23.
24.
25. From Diagrams to Objects Collect all messages to define object’s methods and state transitions ! Phone Directory
26.
27.
28.
29. State Transitions – notational variation open cancel closed canceled [count=10] open cancel closed canceled [count=10] open cancel closed canceled not cancel and [count=10]
30.
31.
32. Modular Submachines VerifyCard OutOfService acceptCard VerifyTransaction outOfService releaseCard ATM ReadAmount : ReadAmountSM aborted rejectTransaction again usage of exit point usage of entry point invoked submachine ReadAmountSM selectAmount EnterAmount ok abort aborted amount otherAmount abort again EXIT point ENTRY point Submachine definition http://www.xpdian.com/UML2.0changes.html ReleaseCard
33.
34.
35.
36.
37.
38.
39.
40.
41. Object Flows and Pins A shorthand notation: use input pins and output pins (parameters). Invoice inv; inv = new Invoice; FillOrder(inv);
42. A Simple Example – Order Processing <<precondition>> Order complete <<postcondition>> Order closed activity parameter node = object node What if using swimlanes?
43. A Simple Example – Order Processing Using sub-activity Is this the same as the previous one?
44. Activity Diagram even as Method POEmployee.sortMail POEmployee.deliverMail POEmployee sortMail() deliverMail(k: Key) ad POEmployee.deliverMail Check Out Truck Put Mail in Boxes key ad POEmployee.sort-deliverMail
45.
46. An Activity Diagram – Distributing schedules <<signal>> redundant constraint object pin parameter http://www.agilemodeling.com/artifacts/activityDiagram.htm hour-glass symbol represents time send receive send receive
47.
48.
49.
50.
51.
52.
53. sd Withdrawal :User :ATM :Bank ref Authenticate PIN OK PIN NOK withdraw msg (“amount”) amount (a) chkAcct (a) msg (“card”) msg (“illegal entry”) not enough bal msg(“amount too big”) Interaction Overview Diagram :User :ATM :Bank sd :User :ATM sd :User :ATM sd enough bal money receipt :User :ATM :Bank sd sd Relationship with Sequence Diagram?
54.
55.
56. Interaction Diagram: Timing Diagram (robust notation) http://www.visual-paradigm.com/highlight/highlightuml2support.jsp timing ruler w. tick marks states state timeline transition point Can you transform this into a concise notation?
66. State Machine Redefinition VerifyCard acceptCard ReleaseCard VerifyTransaction outOfService releaseCard OutOfService ATM { final } { final } { final } { final } ReadAmount selectAmount amount enterAmount ok reject { extended } otherAmount { extended } FlexibleATM
67. Interaction Diagram: Timing Diagram (robust notation) A frame to bound the two lifelines states/conditions events/stimuli transition point message state timeline state timeline timing ruler w. tick marks timing constraint timing observation
68. Timing Diagram – another example (www.cs.tut.fi/tapahtumat/olio2004/richardson.pdf)