Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 1 3.1.1: listCampaigns 3.1.1.1 *[For.

Similar presentations


Presentation on theme: "University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 1 3.1.1: listCampaigns 3.1.1.1 *[For."— Presentation transcript:

1 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 1 3.1.1: listCampaigns 3.1.1.1 *[For all client’s campaigns]: getCampaignDetails 5.1.1.1: Advert 4.1.1.1 *[For all campaign’s adverts]: getAdvertDetails :AddAdvertUI :AddAdvert :Client :Campaign :Advert 3.1: showClientCampaigns 3: selectClient 4: selectCampaign 4.1: showCampaignAdverts 5: createNewAdvert 5.1: addNewAdvert newAd:Advert 2: startInterface 1 *[For all clients]: getClient :CampaignManager sd Add a new advert to a campaign 5.1.1: addNewAdvert 4.1.1: listAdverts Notation for iteration different to that in sequence diagram listCampaigns message may pass back too much data from :Campaign communication diagram

2 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 2 5.1.1.1: Advert 4.1.2 *[For all campaign’s adverts]: getAdvertDetails 5.1.1: addNewAdvert :AddAdvertUI :AddAdvert :Client:Campaign :Advert 3.1: showClientCampaigns 3: selectClient 4: selectCampaign 4.1: showCampaignAdverts 4.1.1: listAdverts 5: createNewAdvert 5.1: addNewAdvert newAd:Advert 2: startInterface 3.1.1: listCampaigns 1 *[For all clients]: getClient :CampaignManager sd Add a new advert to a campaign 3.1.2 *[For all client’s campaigns]: getCampaignDetails listCampaigns message does not pass back any data from :Campaign in this alternative interaction

3 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 3 Message Labels Type of messageSyntax example Simple message. 4: addNewAdvert Nested call with return value. The return value is placed in the variable name. 3.1.2: name = getName Conditional message. This message is only sent if the condition [balance > 0] is true. 5 [balance > 0]: debit(amount) Iteration 4.1 *[For all adverts]: getCost

4 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 4 : Campaign : Advert checkCampaignBudget 1*[For all adverts]: getCost 2: getOverheads The direction in which a link can be navigated may be shown if required. sd checkCampaignBudget Navigation links

5 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 5 :Client :Campaign :Advert getName listCampaigns listAdverts Advert newAd:Advert addNewAdvert LifelineActivation or Execution Object creation :CampaignManager sd Add a new advert to a campaign loop Interaction Operator Interaction Constraint Combined Fragment (loop) [For all client’s campaigns] getCampaignDetails [For all campaign’s adverts] getAdvertDetails sequence diagram Sequence diagram is enclosed in a frame Frame label

6 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 6 :LifelineA :LifelineB Synchronous (blocking) message sd Interaction Name msg a Send message Event Occurrence (msg.sendEvent) Receive messaged Event Occurrence (msg.recieveEvent) start of Execution Occurrence end of Execution Occurrence Active State on lifeline showing pre-condition Message reply showing return of control

7 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 7 :Client :Campaign :Advert listCampaigns listAdverts Advert newAd:Advert :CampaignManager sd Add a new advert to a campaign loop :AddAdvertUI :AddAdvert addNewAdvert getClient selectClient loop selectCampaign addNewAdvert getCampaignDetails startInterface [For all clients] showClientCampaigns showCampaignAdverts createNewAdvert [For all client’s campaigns] [For all campaign’s adverts] getAdvertDetails Boundary lifeline Control lifeline

8 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 8 listAdverts deleteAdvert Object destruction :Campaign :Advert delete getAdvertDetails X loop sd Delete advert

9 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 9 :Client :Campaign :Advert getName listCampaigns checkCampaignBudget getCampaignDetails getCost :CampaignManager sd Check campaign budget loop getOverheads [For all client’s campaigns] [For all campaign’s adverts] Reflexiv e messag e

10 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 10 :Client :Campaign :Advert getName listCampaigns checkCampaignBudget getCampaignDetails getCost :CampaignManager sd Check campaign budget loop getOverheads budget = checkCampaignBudget [For all client’s campaigns] [For all campaign’s adverts] Shading showing the focus of control Reply with the return-value shown

11 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 11 :Client campaign[i] :Campaign advert[j] :Advert getName listCampaigns checkCampaignBudget getCampaignDetails getCost :CampaignManager sd Check campaign budget loop getOverheads [i=1;i<=campaign.count; i++ ] [j=1;j<=advert.count; j++ ] Object selector notation Interaction constraint refers to variable used in object selector notation

12 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 12 :Client campaign[i] :Campaign advert[j] :Advert getName listCampaigns checkCampaignBudget getCampaignDetails getCost :CampaignManager sd Check campaign budget getOverheads loop (1, *) Interaction Operator with parameters loop (1, *) [i<=campaign.count ] [j<=advert.count ]

13 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 13 :Client :Campaign :Advert getName listCampaigns ref :CampaignManager Advert addCostedAdvert newAd:Advert newRequest:Request alt [else] sd Add a new advert to a campaign if within budget List client campaigns [totalCost <= budget] Request Get campaign budget alt interaction operator shows branching Two interaction operands, one for each alternative

14 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 14 :Client :Campaign :Advert getName listCampaigns :CampaignManager sd Check campaign budget ref Gate showing the message enter this interaction occurrence List client campaigns Get campaign budget ref interaction operator indicates interaction occurrence that references an interaction fragment handling complexity

15 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 15 :Client :Campaign listCampaigns getCampaignDetails sd List client campaigns loop Gate showing the message enter this Interaction Fragment [For all client’s campaigns] Interaction fragment that is referenced in Check campaign budget sequence diagram

16 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 16 :Campaign :Advert getCost sd Get campaign budget loop getOverheads checkCampaignBudget :CampaignManager [For all campaign’s adverts] Interaction fragment that is also referenced in Check campaign budget sequence diagram

17 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 17 :ClientCampaigns ref ClientCampaignAds listCampaigns listAdverts :CampaignManager sd Add a new advert to a campaign :AddAdvertUI :AddAdvert addNewAdvert getClient selectClient loop selectCampaign [For all clients] showClientCampaigns startInterface showCampaignAdverts addNewAdvert createNewAdvert Lifeline representing the interaction between a group of objects

18 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 18 :Client :Campaign :Advert listCampaigns listAdverts Advert newAd:Advert sd ClientCampaignAds loop addNewAdvert getClient [For all client’s campaigns] getCampaignDetails [For all campaign’s adverts] getAdvertDetails Sequence diagram referenced in the Add a new advert to a compaign sequence diagram

19 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 19 getCost Within budget Budget spent :LifelineA :LifelineB :LifelineC alt sd Calculate costs [else] ref Identify under spend [Within budget] Within budget :LifelineA :LifelineB :LifelineC ref alt sd Authorize expenditure [else] authorize stopExpenditure [Within budget] Calculate costs Continuations are used to link sequence diagrams

20 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 20 :ClassA :ClassB signalX d = duration {t..t + 28} signalF signalE {0..14} t = now signalY Asynchronous message with duration constraint Callback Duration constraint An active object sd Interaction Name {d..d*3} Duration observation Time constraint using construction marks Note explaining some aspect of this execution occurrence

21 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 21 Interaction Operator Explanation and use altAlternatives represents alternative behaviours, each choice of behaviour being shown in a separate operand. The operand whose interaction constraint is evaluted as true executes. opt Option describes a single choice of operand that will only execute if its interaction contraint evaluates as true. break Break indicates that the combined fragment is performed instead of the remainder of the enclosing interaction fragment. par Parallel indicates that the execution operands in the combined fragment may be merged in any sequence once the event sequence in each operand is preserved. seq Weak Sequencing results in the ordering of each operand being maintained but event occurrence from different operands on different lifelines may occur in any order. The order of event occurrences on common operands is the same as the order of the operands. strict Strict Sequencing imposes a strict sequence on execution of the operands but does not apply to nested fragments. neg Negative describes an operand that is invalid. critical Critical Region imposes a constraint on the operand that none of its event occurrences on the lifelines in the region can be interleaved. ignore Ignore indicates the message types, specified as parameters, that should be ignored in the interaction. consider Consider states which messages should be consider in the interaction. This is equivalent to stating that all others should be ignored. assert Assertion states that the sequence of messaging in the operand is the only valid continuation. loop Loop is used to indicate an operand that is repeated a number times until the interaction constraint for the loop is no longer true.

22 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 22 ref Get campaign budget [totalCost <= budget] ref Create advert Create request ref :Campaign :CampaignManag er addCostedAdvert sd Add costed advert [totalCost > budget] sd Add a new advert to a campaign if within budget :Client :Campaign getName listCampaigns getCampaignDetails :CampaignManag er sd List Campaigns for Client loop [For all client’s campaigns] Decision Interaction occurrence In-line sequence diagram Initial node Final node

23 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 23 :TicketMachine :Barrier after:WeightSensor sd Car enters car park raiseBarrier lowerBarrier before:WeightSensor activate Raised Lowered Active deactivate Blocked barrierLowered Inactive ticketRequested

24 University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 24 sd Car enters car park lifelines :Barrier, :TicketMachine :Barrier :TicketMachine Lowered Raised Inactive Active Blocked t {t..t+3s} Timing Constraint raiseBarrier barrierLowered Diagram has two instances, one for each lifeline Sloped line represents duration of state change Message from one lifeline to another


Download ppt "University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams 1 3.1.1: listCampaigns 3.1.1.1 *[For."

Similar presentations


Ads by Google