11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams
2 Interaction diagrams Sequence diagrams – ordered by time –Shows the flow of logic through a scenario Collaboration diagrams – shows the communications among objects –Use to assess the impact of interactions Activity diagrams – focuses on the flow of activities, useful for understanding complex procedures
3 Sequence diagrams Describe the time sequence of interactions among classes Contain these elements: –Class roles –Lifelines –Activations –Messages B&R 7.2
4 Example class model..1 Project Activity Resource Task * * Assigned to Filled diamond – composition relationship
5 Example class model..2 Skill Resource HourlySalaried Resource-Skill * *
6 Sequence diagrams Example..1 Res Manager Win :UserInterface :Resource:Skill:Resource-skill :Resource Manager Find resource by name Find resource Find skill assign skill to resource Find skill by name Assign skill to resource [Resource is not assigned skill]
7 Proj Manager Win :UserInterface :Project:Activity:Task :Project Manager Find project by name Remove project Find activity by project Remove task Find task by activity Remove activity Remove project No more task No more activity Sequence diagrams Example..2
8 Collaboration diagrams Describe interactions among classes and associations Contains these elements –Class roles –Association roles –Messages flows
9 Collaboration diagrams Example..1
10 Collaboration diagrams Example..2
11 Collaboration diagrams Example: Remove project
12 Activity diagrams Shows the sequence of steps that make up a complex process, like a flowchart Shows flows of control similar to a sequence diagram, but focuses on operation rather than on objects Each activity is represented by an elongated ovals p.140, 7.3; p.155, 8.3 B&R
13 Activity diagrams : example 1
14 Branches –Symbol : Hollow diamond –Condition [square bracket] Initiation & Termination – solid circle, a bull’s eye (a solid circle surrounded by a a hollow circle) Concurrent activities –One activity can be split into several concurrent activities (a fork of control) –Then be combined into a single activity (a merge of control) –A fork or a merge is shown by a synchronization bar (a heavy line with arrows coming in or out of it) Activity diagrams.. 2
15 Activity diagrams : example 2
16 Sending & receiving signals –Convex pentagon, sending –Concave pentagon, receiving Swimlanes – shows organizational responsibility for activities Activity diagrams.. 3
17 Activity diagrams Sending & receiving signals
18 flight attendant Ground crew Catering Activity diagrams: Swimlanes
19 Reading for this lecture Chapter 7 & 8, Blaha & Rumbaugh Study the interaction diagrams in the examples – essBookExample/index.html – Example/index.html