1 sad2 - uml 2 nd lecture sequence diagram and other dynamic views lecturer: dr dimitrios makris...

25
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] ) )

Upload: claude-harvey

Post on 30-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

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]))

2

Last week

Review of SAD1-UML Review of Unified Process

Workshop: Introduction to StarUML

3

Summary of this session

Sequence Diagram Other Dynamic Views

Activity Diagrams Collaboration (Communication)

Diagram State Diagram Timing Diagram Interaction Overview Diagram

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

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.

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

7

Activity Diagram Activity States Start-End Branch-Merge,

(diamonds) Guards

Fork-Join (Synch bar)

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

9

Sequence Diagram Basic Notation (I)

Objects Timeline Message

s

10

Sequence Diagram Basic Notation (II)

Lifeline, Activation, Creation, Destruction.

Return messages

Recursive calls

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.

12

Sequence Diagram in UML 2 (I)

Head of lifelines: Use participants instead of objects

:Order:Order

UML 2: participant

UML 1.x: object

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

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

15

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

objects Significantly improved in UML2.0

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

17

Collaboration (Communication) Diagram

Objects, Messages (Numbering)

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

19

State Diagram example

20

Timing Diagram (I)

New in UML 2.0

Usually related to a state diagram

Two representations

21

Timing Diagram (II)

New in UML 2.0

Usually related to a state diagram

Two representations

22

Interaction OverviewDiagram

New in UML 2.0

Combination of activity diagram and sequence diagram

23

Question Why UML has so many different

diagrams to represent dynamic views?

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.

25

What is next? This week

Workshop on Sequence Diagram

Next week Lecture on Class Diagram (Advanced

Notation)