19
1 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams http://www.uic.edu.hk/~kentsang/SWE/SWE.htm

11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

Embed Size (px)

Citation preview

Page 1: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

11

Software EngineeringDr. K. T. Tsang

Lecture 6

Interaction Diagramshttp://www.uic.edu.hk/~kentsang/SWE/SWE.htm

Page 2: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

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

Page 3: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

3

Sequence diagrams

• Describe the time sequence of interactions among classes

• Contain these elements:– Class roles– Lifelines– Activations– Messages

• B&R 7.2

Page 4: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

4

Example class model ..1

Project

Activity

Resource Task

1

1

1

1..*

1..*

* Assigned to

Filled diamond – composition relationship

Page 5: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

5

Example class model ..2

Skill

Resource

Hourly Salaried

Resource-Skill

*

*

Page 6: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

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]

Page 7: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

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

Page 8: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

8

Collaboration diagrams

• Describe interactions among classes and associations

• Contains these elements– Class roles– Association roles– Messages flows

Page 9: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

9

Collaboration diagrams Example ..1

Page 10: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

10

Collaboration diagrams Example ..2

Page 11: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

11

Collaboration diagrams Example: Remove project

Page 12: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

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

Page 13: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

13

Activity diagrams : example 1

Page 14: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

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

Page 15: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

15

Activity diagrams : example 2

Page 16: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

16

• Sending & receiving signals– Convex pentagon, sending– Concave pentagon, receiving

• Swimlanes – shows organizational responsibility for activities

Activity diagrams .. 3

Page 17: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

17

Activity diagrams

Sending & receiving signals

Page 18: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

18

flight attendant Ground crew Catering

Activity diagrams: Swimlanes

Page 19: 11 Software Engineering Dr. K. T. Tsang Lecture 6 Interaction Diagrams kentsang/SWE/SWE.htm

19

Reading for this lecture

• Chapter 7 & 8, Blaha & Rumbaugh

• Study the interaction diagrams in the examples– http://www.cs.gordon.edu/courses/cs211/

AddressBookExample/index.html– http://www.cs.gordon.edu/courses/cs211/

ATMExample/index.html