Title: Art for Chapter 2, Modeling with UML
1Art for Chapter 2,Modeling with UML
2Figure 2-1, A UML use case diagram describing the
functionality of a simple watch.
3Figure 2-2, A UML class diagram describing the
elements of a simple watch.
4Figure 2-3, A UML sequence diagram for the
SimpleWatch.
5Figure 2-4, A UML statechart diagram for SetTime
use case of the SimpleWatch.
button2Pressed
button12Pressed
Blink
Hours
button1Pressed
button2Pressed
button12Pressed
Blink
Minutes
button1Pressed
button2Pressed
Blink
Stop
Seconds
Blinking
6Figure 2-5, An example of a UML activity diagram.
7Figure 2-6, A Model is an abstraction describing
a subset of a System. A View depicts selected
aspects of a Model. Views and Models of a single
System may overlap each other.
Scale model
Electrical
All blueprints
Airplane
Fuel
Flight simulator
8Figure 2-7, Example of describing a model with
different notations. 1 means 1..1, means
0..
RJL UML head/tail (either can mean 0 ..)
Book
1..1
0..
Chapter
1..1
0..
Book
Chapter
9Figure 2-8, A UML class diagram depicting two
classes Watch and CalculatorWatch.
CalculatorWatch is a refinement of Watch,
providing calculator functionality normally not
found in normal Watches.
Watch
time
date
SetDate(d)
CalculatorWatch
calculatorState
10Figure 2-8a Same UML class diagram depicting two
classes Subclass(es) are linked vertically below
a bar which has link up to superclass. (Multiple
refinements may be mutually exclusive or
overlapping, exhaustive or incomplete. One bar
is shown for each superclass if there is multiple
inheritance.)
Watch
time
date
SetDate(d)
CalculatorWatch
calculatorState
11Figure 2-9, An example of abstract class
(in italics)
OrganicCompound
Benzene
12Figure 2-10, A UML class diagram depicting
instances of two classes.
instanceOf
Watch
simpleWatch1291Watch
instanceOf
calculatorWatch1515
CalculatorWatch
CalculatorWatch
Also called an Object Diagram - RJLI.e,
object ltltisInstanceOfgtgt its class. Compare to
is_asubclassOf (open triangle) Compare to
isPartOf (open or filled diamond).
13Figure 2-11, Examples of message sends.
(Objects interact horizontally.)
WatchUser
pressButton2()
getTime()
GMTTime
getTimeDelta()
GMTTime
(time advances downward)
14Figure 2-12, The application domain model
represents entities of the environment which are
relevant to an air traffic control system (e.g.,
aircraft, traffic controllers).
Application Domain
Solution Domain
Application Domain Model
System Model
MapDisplay
TrafficControl
SummaryDisplay
FlightPlanDatabase
TrafficController
Aircraft
Airport
TrafficControl
FlightPlan
15Figure 2-13, An example of a UML use case
diagram Incident initiation in an accident
management system.
FRIEND
Report
Emergency
OpenIncident
FieldOfficer
Dispatcher
AllocateResources
16Figure 2-16, An example of an include
relationship.
include
OpenIncident
HelpDispatcher
include
AllocateResources
17Figure 2-18, An example of an extend
relationship.
18Figure 2-20, An example of a generalization
relationship.
Authenticate
WithPassword
Authenticate
Authenticate
WithCard
19Figure 2-22, An example of a UML class diagram
classes that participate in the ReportEmergency
use case.
reports
1
Incident
EmergencyReport
1..
reportsGenerated
incidentsGenerated
Dispatcher
FieldOfficer
1
1
nameString
nameString
badgeNumberInteger
badgeNumberInteger
initiator
author
20Figure 2-22a, Same UML class diagram example
redrawn with super- or aggregate classes above or
to left of sub- or component classes.
Dispatcher
FieldOfficer
nameString
nameString
badgeNumberInteger
badgeNumberInteger
initiator
1
author
1
reportsGenerated
incidentsGenerated
reports
EmergencyReport
Incident
1
1..
21Figure 2-23, An example of a UML object diagram
objects that participate in the warehouseOnFire
scenario.
report_1291
incident_1515
bobFieldOfficer
name Bob D.
badgeNumber 132
johnDispatcher
name John D.
aliceFieldOfficer
badgeNumber 12
name Alice W.
badgeNumber 23
22Figure 2-24, Example of a one-directional
association.
Polygon
Point
Here, I would prefer that UML had put the
arrowhead or direction indicator near the middle
of a link which is traversable in one direction
only. RJL
23Figure 2-25, An example of an association class.
Allocates
roleString
notificationTimeTime
FieldOfficer
Incident
nameString
1
resources
badgeNumberInteger
incident
1..
24Figure 2-26, Alternative model for Allocation, as
an Associative Entity.
Allocation
1
1
roleString
notificationTimeTime
incident
1
Incident
resources
1..
FieldOfficer
nameString
badgeNumberInteger
This is an uncommon example of an Association
class - RJL. (All FieldOfficer resources must be
allocated at the same time (and have the same
Role)! every FieldOfficer MUST BE Allocated to
an Incident. ) See the next slide, which is not
a compatible generalization of this one.)
25Figure 2-26a, Alternative model for Allocation.
FieldOfficers may be allocated to multiple
incidents concurrently. Each Allocation instance
relates one FieldOfficer to one
incident notificationTime is unique to one
FieldOfficer, Incident pair Some FieldOfficers
may be uncommitted. (See pp 53-54)
FieldOfficer
nameString
Incident
badgeNumberInteger
incident
1
resource
1
0..
1..
Allocation
1
roleString
notificationTimeTime
26Figure 2-27, Examples of aggregations.(Hollow
diamonds in UML indicate sharable items, not
private components, therefore not
cascade-deletable.)
27Figure 2-28, Examples of multiplicity.
Author or co-author
28Figure 2-29, Example of a hierarchical file
system. A recursive implementation of a
tree-structure.
29Figure 2-30, Example of a nonhierarchical file
system. Directory to FileSystemElement is
many-to-many,so multiple directories can share
the same file object there could be an
attributed binary associative entity inbetween.
- RJL
Exercise What does attributed mean? How would
you add the Unix symbolic link as a third
subclass to this model? (See Bachman File
Structure models, CACM )
30Figure 2-31, Example of how a qualified
association use reduces multiplicity.
Deprecated by me RJL
Without qualification
1
filename
With qualification
0..1
1
31Figure 2-32, An example of a generalization.
32Figure 2-33, Examples of operations provided by
the Incident class.
33Figure 2-34, Example of a sequence diagram
setting the time on 2Bwatch. (Same as
SimpleWatch, Fig. 2-3)
34Figure 2-35, Examples of conditions and iterators
in sequence diagrams.
a
b
c
igt0 op1()
ilt0 op2()
op3()
35Figure 2-36, Example of a collaboration diagram
Setting the time on 2Bwatch.
2BwatchOwner
1p
ressButtons1And2()
2pressButton1()
3pressButton2()
1.1
blinkHours()
4pressButtons1And2()
2.1blinkMinutes()
4.2stopBlinking()
2BwatchInput
2BwatchDisplay
3.1i
ncrementMinutes()
4.1c
ommitNewTime()
3.2r
efresh()
2BwatchTime
36Figure 2-37, A UML statechart diagram for the
Incident class.
Active
Inactive
Closed
Archived
incidentHandled
incidentDocumented
incidentArchived
37Figure 2-38, Statechart diagram for 2Bwatch set
time function.
38Figure 2-39, Internal transitions associated with
the SetTime state.
39Figure 2-40, Refined statechart associated with
the SetTime state.
SetTime
b1
b1
BlinkHours
BlinkMinutes
BlinkSeconds
b2/incr sec.
b2/incr hour
b2/incr min.
b1
b1
BlinkYear
BlinkMonth
BlinkDay
b2/incr year
b2/incr mo.
b2/incr day
b1
b1
40Figure 2-41, A UML activity diagram for Incident.
41Figure 2-42, Example of decision in the
OpenIncident process.
42Figure 2-43, An example of complex transitions in
a UML activity diagram.
43Figure 2-44, An example of swimlanes in a UML
activity diagram.
Dispatcher
FieldOfficer
44Figure 2-45, Example of packages use cases of
FRIEND organized by actors.
45Figure 2-46, Example of packages.
46Figure 2-47, Example of packages.
47Figure 2-48, An example of a note. Notes can be
attached to a specific element in a diagram.
DispatcherStation
FieldStation
Dispatcher
FieldOfficer
The Emer
gencyReport
class is defined in FieldStation
and used in both stations.
EmergencyReport
Incident
48Figure 2-49, Examples of stereotypes.
entity
boundary
control
Year
ChangeDateControl
ButtonBoundary
entity
boundary
entity
Month
LCDDisplayBoundary
Day
49Figure 2-50, An example of constraint.
reports
1
EmergencyReport
Incident
1..
ordered by time of receipt