Top Banner
1 SAD2 - UML SAD2 - UML 2 2 nd nd Lecture Lecture Sequence Diagram Sequence Diagram and other dynamic views and other dynamic views Lecturer: Dr Dimitrios Lecturer: Dr Dimitrios Makris Makris ( ([email protected] ) )
25

1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris ([email protected]) [email protected].

Dec 30, 2015

Download

Documents

Claude Harvey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

1

SAD2 - UMLSAD2 - UML22ndnd Lecture Lecture

Sequence DiagramSequence Diagram

and other dynamic viewsand other dynamic views

Lecturer: Dr Dimitrios MakrisLecturer: Dr Dimitrios Makris(([email protected]))

Page 2: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

2

Last week

Review of SAD1-UML Review of Unified Process

Workshop: Introduction to StarUML

Page 3: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

3

Summary of this session

Sequence Diagram Other Dynamic Views

Activity Diagrams Collaboration (Communication)

Diagram State Diagram Timing Diagram Interaction Overview Diagram

Page 4: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

4

Summary of Elaboration Phase “A mile wide, an inch deep” approach Use Case Diagrams

Define the scope and the size of the project Capture Requirements

Conceptual Modelling (Class Diagrams) Define semantics Base for the final class diagrams

Before the Construction phase, use cases should be assessed and ranked

Page 5: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

5

Construction Phase Each Use Case defines an iteration

(Analysis, Design, Implementation, Testing) Analysis:

Write a detailed (full) Use Case. Use interaction (sequence) diagrams to visualise the

detailed Use Case. Design:

Convert the sequence diagram to collaboration. Enrich the class diagram with new classes, attributes

and methods. Some other types of diagrams (state, activity) may be

also used.

Page 6: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

6

Activity Diagram

It describes the sequencing of activities

It is the UML version of the flowchart diagram In addition, it also supports concurrent

activities Not necessarily an Object Oriented

diagram

Page 7: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

7

Activity Diagram Activity States Start-End Branch-Merge,

(diamonds) Guards

Fork-Join (Synch bar)

Page 8: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

8

Why to use Activity Diagrams

Applications Multithreaded Programming Business ModellingIn Software Development process Understanding workflow (elaboration

phase) Analysing a use case (construction phase) Describing a complicated sequential

algorithm

Page 9: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

9

Sequence Diagram Basic Notation (I)

Objects Timeline Message

s

Page 10: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

10

Sequence Diagram Basic Notation (II)

Lifeline, Activation, Creation, Destruction.

Return messages

Recursive calls

Page 11: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

11

Types of Messages Different types of messages → Different arrowheads Some confusion in books and tools, because notation

changed in the past Even Microsoft Visio & Schaum Outlines UML use the old

notation. For this module, use the following (UML 2.0) notation:

When an objects sends a synchronous message, it must wait for the return message to regain control.

When an object sends an asynchronous message, it does not have to wait for the reply and it can keep doing other things.

Page 12: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

12

Sequence Diagram in UML 2 (I)

Head of lifelines: Use participants instead of objects

:Order:Order

UML 2: participant

UML 1.x: object

Page 13: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

13

Sequence Diagram in UML2 (II)

Better control of iterative and conditional flow

Operators in interaction frames: Alt, opt, par,

loop, region, neg, ref, sd

Page 14: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

14

Sequence Diagram in practice

Keep diagrams simple A4 page If diagram too complicate, split it

Don’t try to capture every scenario Simple alternative scenarios can be avoid Powerful UML notation – Need for

simplicity New classes

Avoid (many) controller classes Avoid God classes

Page 15: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

15

Sequence Diagram Summary Dynamic View Represents sequencing of actions …and behaviour assigned to

objects Significantly improved in UML2.0

Page 16: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

16

Collaboration (Communication) Diagram

Renamed in UML 2.0 Collaboration & Sequence diagram

known as interactive diagrams Almost equivalent to sequence

diagram Focus on Objects Used to enrich the class diagram

Page 17: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

17

Collaboration (Communication) Diagram

Objects, Messages (Numbering)

Page 18: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

18

State Diagrams Describe dynamic behaviour of individual

object Object is treated as isolated Detect events and response

State is a set of values that defines same response to events If object in different state, then response may be

different for the same event State Diagram represents states and

transitions

Page 19: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

19

State Diagram example

Page 20: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

20

Timing Diagram (I)

New in UML 2.0

Usually related to a state diagram

Two representations

Page 21: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

21

Timing Diagram (II)

New in UML 2.0

Usually related to a state diagram

Two representations

Page 22: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

22

Interaction OverviewDiagram

New in UML 2.0

Combination of activity diagram and sequence diagram

Page 23: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

23

Question Why UML has so many different

diagrams to represent dynamic views?

Page 24: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

24

Summary Sequence Diagram shows both the

sequencing of actions and the interaction between objects.

Sequence Diagram is used to analyse and visualise a use case.

UML offers a variety of diagrams that represent dynamic views of the system.

Page 25: 1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.

25

What is next? This week

Workshop on Sequence Diagram

Next week Lecture on Class Diagram (Advanced

Notation)