Presentation is loading. Please wait.

Presentation is loading. Please wait.

03/12/2001 © Bennett, McRobb and Farmer 2002 1 Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.

Similar presentations


Presentation on theme: "03/12/2001 © Bennett, McRobb and Farmer 2002 1 Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and."— Presentation transcript:

1 03/12/2001 © Bennett, McRobb and Farmer 2002 1 Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (2 nd Edition), McGraw Hill, 2002.

2 © Bennett, McRobb and Farmer 2002 2 In This Lecture You Will Learn: n How to develop object collaboration from use cases n How to model object collaboration using an interaction sequence diagram n How to model object collaboration using an interaction collaboration diagram

3 © Bennett, McRobb and Farmer 2002 3 Object Messaging n Objects communicate by sending messages

4 © Bennett, McRobb and Farmer 2002 4 Sequence Diagrams n Show an interaction between objects arranged in a time sequence n Can be drawn at different levels of detail and to meet different purposes at several stages in the development life cycle n Interactions are in the form of messages

5 © Bennett, McRobb and Farmer 2002 5 Sequence Diagrams n Dotted vertical line represents object’s lifeline. n Vertical dimension shows time n Thin bars represent focus of control, periods of time when object is behaving (fulfilling responsibilities). n Messages are shown by a solid horizontal arrow n The execution of an operation is shown by an activation

6 © Bennett, McRobb and Farmer 2002 6 Sequence diagram :Client :Campaign :Advert getName() listCampaigns() listAdverts() *getCampaign Details() Advert() *getAdvert Details() newAd:Advert addNewAdvert() Object lifeline Activation Object creation Campaign Manager

7 © Bennett, McRobb and Farmer 2002 7

8 8 Boundary & Control Classes Most use cases imply at least one boundary object that manages the dialogue between the actor and the system – in the next sequence diagram it is :AddAdvertUI The control object is :AddAdvert and this manages the overall object communication.

9 © Bennett, McRobb and Farmer 2002 9 Boundary & Control Classes listCampaigns() *getCampaignDetails() Advert() *getAdvertDetails() addNewAdvert() :AddAdvertUI :AddAdvert :Client :Campaign :Advert showClientCampaigns() selectClient() selectCampaign() showCampaignAdverts() listAdverts() createNewAdvert() addNewAdvert() newAd:Advert startInterface() *getClient() Campaign Manager Use Case: Add a new advert to a campaign

10 © Bennett, McRobb and Farmer 2002 10

11 © Bennett, McRobb and Farmer 2002 11 Object Destruction listAdverts() deleteAdvert() Object destruction :Campaign :Advert destroy() *getAdvertDetails() X

12 © Bennett, McRobb and Farmer 2002 12 Reflexive Messages :Client :Campaign :Advert getName() listCampaigns() checkCampaignBudget() *getCampaign Details() *getCost() getOverheads() Campaign Manager

13

14 © Bennett, McRobb and Farmer 2002 14 Focus of Control n Indicates times during an activation when processing is taking place within that object n Parts of an activation that are not within the focus of control represent periods when, for example, an operation is waiting for a return from another object n May be shown by shading those parts of the activation rectangle that correspond to active processing by an operation

15 © Bennett, McRobb and Farmer 2002 15 Focus of Control :Client :Campaign :Advert getName() listCampaigns() checkCampaignBudget() *getCampaignDetails() * getCost() getOverheads() Campaign Manager

16 © Bennett, McRobb and Farmer 2002 16 Return n A return is a return of control to the object that originated the message that began the activation n Returns are shown with a dashed arrow, but it is optional to show them at all since it can be assumed that control is returned to the originating object at the end of the activation

17 © Bennett, McRobb and Farmer 2002 17 Handling Complexity n Complex diagrams can be split into two or more smaller diagrams suitably annotated n Alternatively a group of objects can be represented by a single lifeline, and interaction among these objects is shown on a different diagram

18 © Bennett, McRobb and Farmer 2002 18 Handling Complexity :AddAdvertUI :AddAdvert showClientCampaigns() selectClient() selectCampaign() showCampaignAdverts() createNewAdvert() addNewAdvert() listCampaigns() addNewAdvert() listAdverts() These flows are continued next figure startInterface() *getClient() Campaign Manager

19 © Bennett, McRobb and Farmer 2002 19 Handling Complexity listCampaigns() addNewAdvert() listAdverts() *getCampaignDetails() Advert() *getAdvertDetails() :Client :Campaign :Advert newAd:Advert These flows are continued from the previous figure *getClient()

20 © Bennett, McRobb and Farmer 2002 20 Collaboration Diagrams n Hold the same information as sequence diagrams n Show links between objects that participate in the collaboration n No time dimension, sequence is captured with sequence numbers n Sequence numbers are written in a nested style (for example, 3.1 and 3.1.1) to indicate the nesting of control within the interaction that is being modelled

21 Examples How does the cellular phone work? To keep things simple, lets just look at how a customer might make a phone call. The use case for this interaction looks like this: n Use case: Make Phone Call 1. User presses the digit buttons to enter the phone number. 2. For each digit, the display is updated to add the digit to the phone number. 3. For each digit, the dialer generates the corresponding tone and emits it from the speaker. 4. User presses “Send” 5. The “in use” indicator is illuminated on the display 6. The cellular radio establishes a connection to the network. 7. The accumulated digits are sent to the network. 8. The connection is made to the called party. © Bennett, McRobb and Farmer 2002 21

22 Collaboration Diagrams © Bennett, McRobb and Farmer 2002 22

23 © Bennett, McRobb and Farmer 2002 23 Collaboration Diagrams 3.1.1: listCampaigns() 3.1.1.1: *getCampaignDetails() 5.1.1.1: Advert() 4.1.1.1: *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() 1:*getClient() Campaign Manager One allocation of responsibilities for use case Add a new advert to a campaign

24 © Bennett, McRobb and Farmer 2002 24 Collaboration Diagrams 3.1.2: *getCampaignDetails() 5.1.1.1: Advert() 4.1.2: *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:*getClient() Campaign Manager Alternative allocation of responsibilities for use case Add a new advert to a campaign

25 © Bennett, McRobb and Farmer 2002 25 Navigating Links

26 © Bennett, McRobb and Farmer 2002 26 Summary In this lecture you have learned about: n How to develop object collaboration from use cases n How to model object collaboration using an interaction sequence diagram n How to model object collaboration using an interaction collaboration diagram

27 © Bennett, McRobb and Farmer 2002 27 References n UML Reference Manual (OMG, 2001) (For full bibliographic details, see Bennett, McRobb and Farmer)


Download ppt "03/12/2001 © Bennett, McRobb and Farmer 2002 1 Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and."

Similar presentations


Ads by Google