Systems Analysis and Design I

Slides:



Advertisements
Similar presentations
Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Advertisements

Interaction Diagram Notation From Chapter 15 of Craig Larman, Applying UML and Patterns John Dalesandro.
Systems Analysis and Design in a Changing World, Fourth Edition
Summary Class responsibility cards can be used to help allocate responsibilities between different classes. The use of stereotype classes, such as entity,
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1 Interaction Diagrams.
03/12/2001 © Bennett, McRobb and Farmer Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Requirements Analysis
WXGC6102: Object-Oriented Techniques Object Interaction – Sequence Diagrams References: Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems.
SE-565 Software System Requirements More UML Diagrams.
Design in IS Development. IS Design in general The satisfaction of new information requirements. Considering the interaction between humans and the new.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 5a CRC Cards & Sequence Diagrams (Based on Stevens and Pooley (2006, Section.
CS3773 Software Engineering
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 1 Use CasesUse Case Model Campaign Management PackageModelSub-system.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
03/12/2001 © Bennett, McRobb and Farmer Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
1 On to Object Design Chapter 14 Applying UML and Patterns.
1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
10/27/20151 WXGC6102: Object-Oriented Techniques Requirements Analysis References: Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis.
© Bennett, McRobb and Farmer Requirements Analysis Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
Collaboration Diagrams CSIS3600. What is a Collaboration Diagram Collaboration diagrams illustrate interactions between objects The collaboration diagram.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
© 2010 Bennett, McRobb and Farmer1 Object Interaction – Interaction Overview Diagrams Timing Diagrams Based on Chapter 09 Bennett, McRobb and Farmer Object.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams : listCampaigns *[For.
WXGC6102: Object-Oriented Techniques Object Interaction – Interaction Overview Diagrams Timing Diagrams References: Chapter 9 of Bennett, McRobb and Farmer:
1 CSE323 การวิเคราะห์และออกแบบระบบ (Systems Analysis and Design) Lecture 07: Object Interaction and Specifying Operations.
© 2010 Bennett, McRobb and Farmer1 Requirements Analysis 2: Realizing Use Cases Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Systems Analysis and Design in a Changing World, Fourth Edition
© Bennett, McRobb and Farmer Object Interaction – Sequence Diagrams Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis.
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,
1 Kyung Hee University Interaction Diagrams Spring 2001.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
Systems Analysis and Design in a Changing World, Fourth Edition
Object Interaction – Interaction Overview Diagrams Timing Diagrams
Collaboration Diagrams
WXGC6102: Object-Oriented Techniques
UML Interaction Diagrams
UML SEQUENCE DIAGRAM.
Sequence Diagrams.
UML UML Sequence Diagrams CSE 403
Prepared By Sidra Noureen
Sequence Diagram.
Sequence Diagrams.
Business System Development
UML dynamic Modeling (Behavior Diagram)
Princess Nourah bint Abdulrahman University
Interactions.
UML Sequence Diagrams.
Object Oriented Analysis and Design
Princess Nourah bint Abdulrahman University
System Sequence Diagrams
IMAT5205 Systems Analysis and Design
Week 12: Activity & Sequence Diagrams
Unified Modelling Language
Object Interaction – Sequence Diagrams
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
UML Interaction diagrams
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

Systems Analysis and Design I Session 6 Object Interaction

Recap Further discussion of class diagrams (Section 7.5.2, pp 198 – 201) Stereotypes: entity, boundary, control; association class Software and Specification Reuse Section 20.2 (pp. 585 – 586) Section 8.2 (pp. 234 – 237) Section 8.4 (pp. 246 – 247) Section 8.5.1 – 8.5.2 (pp. 252 – 253) Adding Further Structure (to Class Diagrams) Section 8.3.1 – 8.3.3 (pp. 237 – 244) Section 14.4.4 (pp. 409 – 410) In this lecture you will learn … 2 2

Today Object Interaction and Collaboration CRC Cards Section 9.2 (pp. 260 – 262) CRC Cards Section 7.6 (pp. 215 – 218) Communication Diagrams Section 7.4 (pp. 194 – 197) Section 9.4 (pp. 280 – 284) Sequence Diagrams Section 9.3 – 9.3.3 (pp. 262 – 276) Model Consistency Section 9.7 (p. 289) In this lecture you will learn … 3 3

Object Interaction & Collaboration How do you communicate, interact, and collaborate? Message Passing Objects communicate by sending messages This is a metaphor! When an object sends a message to another object, an operation is invoked in the receiving object The Campaign object sends a message to each of its Advert object currentAdvertCost = anAdvert.getCost() The aim of modelling object interaction is to determine the most appropriate scheme of message passing between objects to support a particular user requirement 4 4

Object Interaction & Collaboration Appropriate distribution of object responsibility improves software modularity Each class tends not to be unduly complex, and as a result is easier to develop, to test and to maintain. Each class is relatively small and self-contained, and as a result has a much greater potential for reuse. The system is more resilient to changes in its requirements (see next slide) A modular system is easier to be maintained and upgraded to achieve high reliability to be implemented in small, manageable increments 5 5

Real-world requirements Application that caters for these requirements Equivalent areas of change—a highly resilient system. A small change in requirements causes a much greater change in software—not a resilient system. 6 6

CRC Cards Class–Responsibility–Collaboration (CRC) cards An effective technique for exploring the possible ways of allocating responsibilities to classes and the collaborations that are necessary to fulfil the responsibilities Brainstorm the classes Allocate each class to a team members For each use case, role play the interaction to distribute responsibilities among classes: each object identifies the object that he/she thinks is most appropriate to take on a needed responsibility for collaboration each object should be as lazy as possible, refusing to take on any responsibility unless persuaded by its fellow objects 7 7

Format of CRC Cards Class Name: Collaborations Responsibilities Responsibilities of the class are listed in this section. Collaborations with other classes are listed here, together with a brief description of the purpose of the collaboration. 8 8

CRC Cards: Use Case Example Use Case: Add a new advert to a campaign A campaign can consist of many adverts. Details of each advert are entered into the system with a target completion date and estimated cost. Glossary: Campaign: Adverts are organised into campaigns in order to achieve a particular objective.... Client: A company or organisation that wishes to obtain the services to develop and manage an advertising campaign, and design and produce adverts for the campaign

Advert provides advert details. Advert constructs new object. Class Name Client Responsibilities Collaborations Provide client information. Campaign provides campaign details. Provide list of campaigns. Class Name Campaign Responsibilities Collaborations Provide campaign information. Provide list of adverts. Add a new advert. Advert provides advert details. Advert constructs new object. Class Name Advert Responsibilities Collaborations Provide advert details. Construct adverts. 10 10

Dynamic Analysis with UML Sequence Diagrams Communication Diagrams Interaction Overview Diagrams Timing Diagrams In UML 1.x, communication diagrams are called collaboration diagrams interaction overview diagrams and timing diagrams do not exist 11 11

Sequence Diagrams A sequence diagram shows an interaction between objects arranged in a time sequence. Sequence diagrams can be drawn at different levels of detail and to meet different purposes at several stages in the development life cycle. Sequence diagrams are typically used to represent the detailed object interaction that occurs for one use case or for one operation. 12 12

Sequence diagram Frame label Sequence diagram is enclosed in a frame :Client :Campaign :Advert getName listCampaigns listAdverts Advert newAd:Advert addNewAdvert Lifeline Activation 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 Frame label Sequence diagram is enclosed in a frame “sd” is used to determine the interaction diagram; interaction

Sequence Diagrams: Basic elements Objects (or subsystems, components or other connectable elements) involved in interaction appear horizontally across the page Vertical dimension represents time Each object is represented by a lifeline. Once a message is received, the operation that has been invoked begins to execute The period of time during which an operation executes is called the execution occurrence or activation of an operation shown by a rectangle on the relevant lifeline. Messages are usually shown by a solid horizontal arrow A synchronous message or procedural call is shown with a full arrowhead, causes the invoking operation to suspend execution until the focus of control has been returned to it. It is optional to show reply messages (with dashed arrows) Why? Assume that control is returned to the originating object at the end of the activation in a destination object (except for asynchronous messages). 14 14

Sequence Diagrams: Example Figure 9.4 on p. 265 :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 Active State on lifeline showing pre-condition Message reply showing return of control 16 16

Boundary & Control Classes Most use cases imply at least one boundary object that manages the dialogue between the actor and the system The control object is represented by the lifeline :AddAdvert and this manages the overall object communication.

Control lifeline Boundary lifeline :Client :Campaign :Advert listCampaigns listAdverts Advert newAd:Advert :CampaignManager sd Add a new advert to a campaign loop :AddAdvertUI :AddAdvert addNewAdvert getClient selectClient selectCampaign getCampaignDetails startInterface [For all clients] showClientCampaigns showCampaignAdverts createNewAdvert [For all client’s campaigns] [For all campaign’s adverts] getAdvertDetails Boundary lifeline

Sequence Diagrams: Reflexive Message :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] Reflexive message A reflexive message that an object sends to itself is shown by a message arrow that starts and finishes at the same object lifeline. Figure 9.7 on p. 268 An object can send a message to itself. 19 19

Sequence Diagrams: Flow Control Sequencing is shown by arranging messages vertically in the order of their occurrences Recall: the vertical dimension represents time. Selection (branching) is shown by a combined fragment rectangle with the interaction operator ‘alt’ (a short form of alternatives) The alt combined fragment has two (or more) compartments known as operands. Each operand corresponds to one of the alternatives in the combined fragment and should have an interaction constraint to indicate under what conditions it executes. Iteration (looping) is shown by a combined fragment rectangle with the interaction operator ‘loop’ The interaction in the loop combined fragment repeats as long as the guard condition in the interaction constraint evaluates as true. 22 22

Figure 9.16 on p. 275 alt interaction operator shows branching :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 Figure 9.16 on p. 275 23 23

Figure 9.3 on p. 263 Frame label 24 Lifeline Activation or Execution :Client :Campaign :Advert getName listCampaigns listAdverts Advert newAd:Advert addNewAdvert Lifeline Activation 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 A sequence diagram is enclosed in a frame Frame label 24 24

25

Sequence Diagrams: Object Creation and Destruction Figure 9.6 on p. 267 listAdverts deleteAdvert Object destruction :Campaign :Advert delete getAdvertDetails X loop sd Delete advert Object creation is shown with the construction message (dashed arrow) going to the object symbol. Object destruction is indicated by a large X on the lifeline on the destruction point. 26 26

Sequence Diagrams: Handling Complexity Complexity interactions can be modelled using various different techniques Interaction fragments Lifelines for subsystems or groups of objects Continuations Interaction Overview Diagrams Interaction occurrences and 27 27

Interaction fragments: Example :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 :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 the “Check campaign budget” sequence diagram 28 28

Interaction Fragment example (cont’d) Interaction fragment that is also referenced in Check campaign budget sequence diagram :Campaign :Advert getCost sd Get campaign budget loop getOverheads checkCampaignBudget :CampaignManager [For all campaign’s adverts]

Lifelines for subsystems or groups of objects :Client :Campaign :Advert listCampaigns listAdverts Advert newAd:Advert :CampaignManager sd Add a new advert to a campaign loop :AddAdvertUI :AddAdvert addNewAdvert getClient selectClient selectCampaign getCampaignDetails startInterface [For all clients] showClientCampaigns showCampaignAdverts createNewAdvert [For all client’s campaigns] [For all campaign’s adverts] getAdvertDetails Boundary lifeline Control lifeline Lifelines for subsystems or groups of objects Complex interactions can also be split up using lifelines to represent groups objects and their interactions or to present subsystems.

Lifelines for subsystems or groups of objects :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 createNewAdvert Lifelines for subsystems or groups of objects Lifeline representing the interaction between a group of objects Complex interactions can also be split up using lifelines to represent groups objects and their interactions or to present subsystems. Complex interactions can also be split up using lifelines to represent groups objects and their interactions or to present subsystems.

Sequence diagram referenced in the :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 campaign sequence diagram

Using Continuations NB: Dashed arrows are NOT part of UML! getCost Within budget Budget spent :LifelineA :LifelineB :LifelineC alt sd Calculate costs [else] ref Identify under spend [Within budget] sd Authorise expenditure authorize stopExpenditure Calculate costs NB: Dashed arrows are NOT part of UML! Continuations are used to link sequence diagrams

Communication Diagrams Communication diagrams hold the same information as sequence diagrams Can be drawn at various levels of detail and during different stages in the system development process Communication diagrams show links between objects that participate in the collaboration offer a view of object interactions that is easy to relate to the underlying collaborations because of visibility of links between objects (lifelines) No time dimension, sequence order is captured with sequence numbers Not suitable for complex interactions 34 34

Communication Diagrams: Notation Message order is captured with sequence numbers, which are written in a nested style to indicate the nesting of control within the interaction that is being modelled: e.g., message 3.1.2 occurs after message 3.1.1, and both are contained with the activation of message 3.1 :Campaign anAdvert:Advert getCost currentAdvertCost = anAdvert.getCost() 35 35

Control lifeline Boundary lifeline :Client :Campaign :Advert listCampaigns listAdverts Advert newAd:Advert :CampaignManager sd Add a new advert to a campaign loop :AddAdvertUI :AddAdvert addNewAdvert getClient selectClient selectCampaign getCampaignDetails startInterface [For all clients] showClientCampaigns showCampaignAdverts createNewAdvert [For all client’s campaigns] [For all campaign’s adverts] getAdvertDetails Boundary lifeline

Communication Diagrams: Example Figure 9.21 on p. 282 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 37 37

Communication Diagrams: Message Labels Type of message Syntax 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 38 38

sd Check campaign budget :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] :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

Model Consistency The communication/sequence diagrams should be mutually consistent with the class diagrams The allocation of operations to objects must be consistent with the class diagram and the message signature must match that of the operation Can be enforced through CASE tools Every sending object must have the object reference for the destination object Either an association exists between the classes or another object passes the reference to the sender Message pathways should be carefully analysed. This issue is key in determining association design 40 40

Take Home Messages Object Interaction and Collaboration CRC Cards Communication Diagrams Sequence Diagrams Model Consistency In this lecture you have learned about … 41 41