36
Avancier Copyright Avancier Limited 2012 Avancier Methods UML distilled popular diagram types Including some Figures from the UML 2.4.1 standard (Know that UML is enormous It would take a week to learn all of it)

ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

  • Upload
    ngothu

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Avancier Methods UML distilled – popular diagram types

Including some Figures from the UML 2.4.1 standard

(Know that UML is enormous

It would take a week to learn all of it)

Page 2: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Structure diagrams – most popular

► Class diagram: a system's classes, with their attributes and interrelationships

► Deployment diagram: execution environments and artefacts deployed onto hardware.

► Component diagram: components and the dependencies among these components.

► Package diagram: logical groupings in a system and dependencies among groupings.

Copyright Avancier Limited 2012

Page 3: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Class diagram: Classes

A class (or type) is

► a specification for objects (or instances) that

► can be instantiated at run time to do some work.

A class specifies

► the data variables (or attributes) an object holds or maintains.

► the operations (or methods) an object can perform

Copyright Avancier Limited 2012

ClassName

Attribute:Type = initial value

operation (arg list):return type

ClassName

► Operation is a only a signature.

► Not a method body (the procedure that produces the return

type from the argument list)

Page 4: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited

Class diagram

► What are the basic components of a software system?

► How are they related?

► Software architects decompose applications into classes (not

only data-entity-centric classes like the ones shown here).

Page 5: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Two kinds of relationship in UML

► An association

shows that two

objects can talk to

each other by

message passing.

► A generalisation-

specialisation

shows that a

subtype class

extends a super type

class by inheriting

operations from it.

Class A

Class B

1

1

Department

Employee

1

*

Order

Order Line

1

*

Dialogue Box

Control

1

*

Data Type <<superclass>>

Number <<subclass>>

Character <<subclass>>

Page 6: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Generalisation – Specialisation relations

Copyright Avancier Limited 2012

Page 7: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Class diagram: relationships

Aggregation Composition

Copyright Avancier Limited 2012

Association

Class A

Class B

1

1

Department

Employee

1

*

Class

Pupil

Team

Player

1

Order

Order Line

1

*

Dialogue Box

Control

1

*

Generalisation (class hierarchy)

You have to annotate w “disjoint”

to express mutual exclusion

Class <<superclass>>

Class <<subclass>>

Class <<subclass>>

1..30 11

1

Ape

Human

Page 8: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Interface

► An interface is a special kind of class,

and to be used, it requires a special kind

of relationship.

► An interface is an abstract super type;

this means it has operation signatures,

but not operation implementations, so it

cannot be instantiated as an object.

► This super type is connected by an

idealisation-realisation relationship to a

subtype which contains implementations

for the abstract operation signatures

■ This relationship is a subtype of

generalisation-specialisation, and

realisation is a subtype of inheritance.

Account

Current Account

Deposit Account

Page 9: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Required and provided interfaces

► UML 2.0 class diagrams brought new diagram elements, such

as ports, slots, provided and required interfaces.

Copyright Avancier Limited 2012

Page 10: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Two other kinds of relationship

► Subtle differences in the arrow and its head make a difference

Implementation (or realisation)

Class or Component

Interface

Dependency (usually reflects one or more invocations)

A B

Page 11: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Relations in UML

Relationship UML Meaning

Association End associated with End

Association Aggregation

Association Composition

Inheritance Specialisation Child is a specialisation of Parent. Child can do what Parent

can do.

Inheritance Realisation Child does what Parent offers

Dependency Source depends on Target, may be affected by a change to

target.

Data flow

Trigger

???

► The meanings of the lines

Page 12: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Class diagram: Ways to show a class

► Hiding or showing attributes and operations

Copyright Avancier Limited 2012

Page 13: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Deployment diagram:

► execution environments and artefacts deployed onto hardware.

Copyright Avancier Limited 2012

Page 14: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Stereotyped boxes and lines

Nodes computational units or processors,

and within them components or packages

Lines connections (communication paths) and

dependencies (as per package diagram)

Copyright Avancier Limited 2012

Processor A

Component 2

TCP/IP

Processor B

Component 1

Component 2

<<communication>>

Client PC

TCP/IP

{>50m/sec}

A “stereotyped” node

Page 15: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Component diagram:

► components and the dependencies among these components. ■ Components shown as boxes.

■ Interfaces shown as lollipops.

■ Dependencies shown in two ways.

Copyright Avancier Limited 2012

UML 2

Lollipop grabber

UML 1

Dependency arrow

Component Component

Component Component

Page 16: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Why dwell on component diagrams?

► Martin Fowler tends to dismiss UML component diagrams

(can't see how they differ from class diagrams).

► But I find them better for teaching architecture definition.

■ components are technology neutral - do not have to be OOPL

classes.

■ components usually represent physical deployable chunks

of software - not just logical abstractions.

■ the concepts of interfaces and dependencies on interfaces

are shown more graphically.

■ this session on component diagrams leads naturally to discussion

of methodologies - CBD and SOA.

Page 17: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Package diagram:

► logical groupings in a system and dependencies among groupings.

Copyright Avancier Limited 2012

Package Name Package Name

Package Name

Class 1 Class 2

Class 3

dependency

Page 18: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Behaviour diagrams – most popular

► Use case diagram: processes that actors of a system are involved in, and dependencies between use cases.

► Activity diagram: step-by-step flow of work - shows the overall flow of control.

► State machine diagram the states and state transitions of a process.

► Interaction diagram ■ Sequence diagram: a sequence of message-based interactions

between objects or components

■ Communication diagram: a sequence of message-based interactions between objects or components

Copyright Avancier Limited 2012

Page 19: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Use case diagram:

► processes that actors of a system are involved in…

Copyright Avancier Limited 2012

Page 20: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Use case diagram:

► processes that actors of a system are involved in...

Copyright Avancier Limited 2012

Page 21: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Use case diagram:

► processes that actors of a system are involved in,

► and dependencies between use cases.

Copyright Avancier Limited 2012

Sign on system

User

Log On

Some common

process

Force

Change Password

<<includes>>

<<extends>>

Change

Directory

Entry

Change

Password

<<includes>>

<<includes>>

Page 22: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

► step-by-step flow of work

► shows the overall flow of control.

Copyright Avancier Limited 2012

Page 23: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

► step-by-step flow of work

► shows the overall flow of

control.

Copyright Avancier Limited 2012

Assess

Incident

Contact

Manager

Sound

Alarm

Shut off

Machine

Leave

Building

[emergency]

[disaster]

* [for all machines]

[synchronisation condition]

Page 24: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

► step-by-step flow of work

► shows the overall flow of control.

Copyright Avancier Limited 2012

Page 25: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

► Swimlanes divide the behaviour between structural components

Copyright Avancier Limited 2012

Page 26: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

Copyright Avancier Limited 2012

► Quadrant divides behaviour between structural components and

locations

Page 27: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Activity diagram:

► Interrupt event in interruptive activity region

Copyright Avancier Limited 2012

Page 28: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier State machine diagram

► the states and state transitions of a process.

Copyright Avancier Limited 2012

Page 29: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier State machine diagram

Similar to activity diagrams Nodes: states rather than steps Lines: transitions "decorated” to indicate the triggering method

call or condition

Copyright Avancier Limited 2012

Born

Voter

Dead

18th Birthday

Vote

Death

Birth

Logged On

Logged Off

Waiting

Authentication

Enter Id

Change P’word

Id match

Id mismatch

Log Off

Disconnection

Page 30: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier State machine diagram

Copyright Avancier Limited 2012

Page 31: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Interaction diagram Sequence diagram:

► a sequence of message-based interactions between objects or

components

Copyright Avancier Limited 2012

Page 32: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier Two contrasting design patterns

► Chain

► Choreography

► Fork

► Orchestration

Copyright Avancier Limited 2012

Order

Closure

Order

Closure Order

Closure

Order

Closure

Discount

Enquiry

Order ItemCustomer Order ProductOrder Closure

Chain or

Staircase style

Order

Closure

Order

Closure

Order

Closure

Order

Closure

Discount

Enquiry

Order ItemCustomer Order ProductOrder Closure

Comb or

Flat style

Page 33: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Copyright Avancier Limited 2012

Interaction diagram Sequence diagram:

Marriot Hotel Chain

MarriotNewark Hotel

bookRoom (dates): void

bookRoom (dates): void

*[for each day] isRoom:=free(): boolean

X

[isRoom]

Operation lifeline Activation bar

Object lifeline

Message

Object [of] Class

Iteration

Deletion

window User Interface

aBooking Booking

aNotice Notice

sequence

Object Instantiation

Page 34: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Interaction diagram Sequence diagram:

► Sequence diagrams can

be broken up into

"interaction fragments",

which may be

represented in the same

or a separate diagram

*alt = if/else Upper part will be

executed if alt = true

alt = false

sd – named sequence diagram ref – reference to "interaction fragment" defined elsewhere loop – repeat interaction fragment alt – selection P ar – concurrent (parallel) regions seq – partial ordering (default) (aka "weak") strict – strict ordering assert – required (i.e. causal) opt – optional "exemplar" neg – "can’t happen" or a negative specification

Copyright Avancier Limited 2012

Page 35: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Interaction diagram Sequence diagram:

► a sequence of message-based interactions between objects or components

Copyright Avancier Limited 2012

Page 36: ISEB Certificates in enterprise and Solution architecture ...grahamberrisford.com/AM 1 Methods/6PRODUCTSandTECHNIQUES/UML/UML... · UML distilled – popular diagram ... Martin Fowler

Avancier

Interaction diagram Communication diagram:

► a sequence of message-based interactions between objects or components

Copyright Avancier Limited 2012