30
SWT - Diagrammatics Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000

SWT - Diagrammatics

Embed Size (px)

DESCRIPTION

SWT - Diagrammatics. Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000. Previous Lecture Review. OO Introduction, OO Design Notations, Booch-OMT-UML Objects, Messages / Control & Data Flow, Classes. Class Attributes and Operations, - PowerPoint PPT Presentation

Citation preview

Page 1: SWT - Diagrammatics

SWT - Diagrammatics

Lecture 4/4 - Diagramming in OO Software Development - partB4-May-2000

Page 2: SWT - Diagrammatics

Previous Lecture Review

– OO Introduction,– OO Design Notations, Booch-OMT-UML– Objects, Messages / Control & Data Flow, Classes.– Class Attributes and Operations,– Visibility of Attributes and Operations,– Relationships :

– Association, Multiplicity, Aggregation,– Dependency, Inheritance.

– Object Oriented Views

Page 3: SWT - Diagrammatics

Overview– Introduction to UML

– Goals, History - Timeline, External influences– The 9 types of UML diagrams :

– Use Case, Class, Object, Sequence, Collaboration,– Statechart, Activity, Component, Deployment

– Flow of data between views– UML references

Page 4: SWT - Diagrammatics

UML• Unified Modelling Language UML

– Comprehensive syntax – Language, Process and Tool independent.

• Four goals :– To represent complete systems– To establish explicit coupling between concepts and

executable code– To take into account scaling factors– To allow use by both humans and computers

Page 5: SWT - Diagrammatics

UML Timeline

Various OO Methodologies

Booch’91

OMT-1

OOSE

OMT-2

Booch’93 Unified Method 0.8

UnifiedMethod0.9

UML 1.0 UML1.1

UML Partners

1995 1996Jan 1997

Sep1997

Page 6: SWT - Diagrammatics

External InfluencesOrigin ElementBooch Categories / SubsystemsEmbley Singleton classes / Composite objectsGOF Frameworks / PatternsHarel StatechartsJacobson Use CasesMeyer Pre/Post conditionsOdell Dynamic classification / EventsOMT AssociationsShlaer-Mellor Object LifecyclesWrifs-Brock Responsibilities / Collaborations

Page 7: SWT - Diagrammatics

UML diagram typesUser Requirements

1.Use Case : system functions from a user’s perspectiveStatic Structure

2.Class : objects and their relationships3.Object : classes and their relationships

Interaction

4.Sequence : dynamic object interaction5.Collaboration : object and their links/interactions6.Statechart : behaviour of a class that has states 7.Activity : operation behaviour (as a set of actions)

Implementation

8.Component : software components9.Deployment : software on particular hardware platforms

Page 8: SWT - Diagrammatics

1. Use case diagrams• Use case diagrams :

– Describe the behaviour of a system from a user’s perspective.– Depict relationships between the system and its environment.– Allow the definition of the systems’ boundaries.

• A use case diagram can be seen as an instance of interaction between “actors” and the system.

Use caseUser

Programmer Architect

Tester

Analystexpresses

implementsdesigns

verifies

understands

Page 9: SWT - Diagrammatics

Use Case diagrams

• May contain any of the following relationships :– Communicates :

– Uses :

– Extends :<<extends>>

Use Case B

Use Case A Use Case B

Use Case A Use Case B

triggers

<<uses>>

Page 10: SWT - Diagrammatics

A Use Case Diagram example

Page 11: SWT - Diagrammatics

2. Class Diagrams

Class name

+ Public Operation( )# Protected Operation( )- Private Operation( )

+ Public Attribute# Protected Attribute- Private Attribute

Class nameAssociation

Multiplicity : 1,0..1,*,M..N, N, M..*

Class nameAggregation

Class nameDependency

Abstract Class Name

Inheritance

Page 12: SWT - Diagrammatics
Page 13: SWT - Diagrammatics
Page 14: SWT - Diagrammatics

3. Object Diagrams

• An object/instance diagram represents a concrete situation at a given time.

• It expresses both the static structure -found in class diagrams- and behaviour.

• Object diagrams contains objects connected by links.• Object Diagrams are mainly used to show a context of

interaction or to facilitate the understanding of a complex data structure.

Page 15: SWT - Diagrammatics

An Object Diagram examplemyCar : Car

myEngine : Engine

w1 : Wheel

w2 : Wheel

w3 : Wheel

w4 : Wheel

=

Car

Wheel

Engine

14

11

Composition with :

Or containment :myCar : Car

myEngine : Engine

Page 16: SWT - Diagrammatics

4. Sequence Diagrams• Sequence diagrams focus on displaying the interaction

between objects, without representing explicitly the context of interaction and the object’s state.

• Depicting the chronology of the message broadcast, they are useful in all stages of OO modelling.

: Caller : Phone : Recipient

picks updial tone

dialring

picks upsays hello...

Page 17: SWT - Diagrammatics

A Sequence Diagram example

Page 18: SWT - Diagrammatics

5. Collaboration Diagrams• Collaboration Diagrams express both the context of a group

of objects and the interaction between these objects.• Can be considered to be an extension of Object diagrams,

adding notation to represent object interaction.• Messages are depicted using lines decorated with an arrow

that points towards the recipient. • To indicate the sending order, messages are explicitly

numbered.

Page 19: SWT - Diagrammatics

A Collaboration Diagram example

myOrder: Order

myitem: Item

stocktem: Item

op: OrderProperties1 : Enter item description

2 : get details

3 : *get

4 : getProperties

Page 20: SWT - Diagrammatics

6. Statechart Diagrams

• A state machine can be used to describe formally the behaviour of objects in terms of states and events.

• Statecharts represent with :– states : the state of an object– transitions : the passing from one state to another– events : the occurrence of a given situation – guards : conditions for the triggering of events– actions and activities : operations of an object

initial intermediate final

event

event [cond]

Page 21: SWT - Diagrammatics

Two StateChart diagrams

URL delay

byte read

wait for length

read data

prefix read

length read

byte read [Count<Length]

Suffix read [Count==Length]

washing rinsing drying

Opened door

opened door

closed door

H

Page 22: SWT - Diagrammatics

7. Activity Diagrams

• Activity diagrams are : – a variant of statechart diagrams, organised according to actions. – targeted towards representing the internal behaviour of a method,

a mechanism or a use case.• An activity is represented by a round rectangle : • Decisions are represented using a diamond : • Synchronisation bars are used for synchronisation• Swimlanes are used to split the activity diagram in regions.

Page 23: SWT - Diagrammatics

An Activity Diagram example

Get temperature

Heat up Cool down

[ too cold ] [ too hot ]

Switch off heating Open windows

Page 24: SWT - Diagrammatics

8. Component Diagrams• Component diagrams depict software components and their

relationships within the implementation environment.• Components can be all kind of software elements : files,

libraries, databases etc. • Components contain two parts :• A dependency relationship between components usually

represent compilation dependencies.• Components may contain processes using

containment and can be grouped in subsystem components.

BodySpecification

B

A

Page 25: SWT - Diagrammatics

A Component Diagram example

UI

Data Processor

DataManager

DatabaseExternalSystem

OrderProcessingSystem

Page 26: SWT - Diagrammatics

9. Deployment Diagrams

• Deployment diagrams are used to illustrate the physical layout of the various hardware components that are needed for a system to operate.

• Hardware resources are represented by a cube : • Lines annotated with multiplicity information are used to

connect cubes.

DBServer

A B0..1

Page 27: SWT - Diagrammatics

A Deployment Diagram example

CMclientJFC

CMclientAWT

CMclientCMD

NamingServer<robin>

CMServers<zeus>

CMServers<robin>

Page 28: SWT - Diagrammatics

Flow of data between views

Classes & Attributes

events

Interaction Model

Use Case Model

State Model

Object Model

classes

operations

classes

operationsstates

interactions

Business Model -> Logical Model -> Component Model -> Deployment Model

Page 29: SWT - Diagrammatics

UML references

UML at rational : http://www.rational.com/uml/

List of tools supporting UML diagrams :http://plg.uwaterloo.ca/~migod/uml.html

Cetus page on UML :http://www.cetus-links.org/oo_uml.html

Page 30: SWT - Diagrammatics

The end of diagrammatics course