SWT - Diagrammatics
-
Upload
deacon-cline -
Category
Documents
-
view
36 -
download
3
description
Transcript of SWT - Diagrammatics
SWT - Diagrammatics
Lecture 4/4 - Diagramming in OO Software Development - partB4-May-2000
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
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
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
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
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
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
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
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>>
A Use Case Diagram example
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
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.
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
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...
A Sequence Diagram example
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.
A Collaboration Diagram example
myOrder: Order
myitem: Item
stocktem: Item
op: OrderProperties1 : Enter item description
2 : get details
3 : *get
4 : getProperties
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]
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
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.
An Activity Diagram example
Get temperature
Heat up Cool down
[ too cold ] [ too hot ]
Switch off heating Open windows
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
A Component Diagram example
UI
Data Processor
DataManager
DatabaseExternalSystem
OrderProcessingSystem
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
A Deployment Diagram example
CMclientJFC
CMclientAWT
CMclientCMD
NamingServer<robin>
CMServers<zeus>
CMServers<robin>
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
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
The end of diagrammatics course