Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
©L
aw
ren
ce
Ch
un
g1
Mo
du
le 3
–A
dv
an
ce
d F
ea
ture
s:
Pa
rt I
-S
tru
ctu
ral
Dia
gra
ms
©L
aw
ren
ce
Ch
un
g2
3 b
as
ic b
uild
ing
blo
ck
s o
f U
ML-D
iag
ram
sG
rap
hic
al
rep
res
en
tati
on
of
a s
et
of
ele
me
nts
.
Re
pre
se
nte
d b
y a
co
nn
ec
ted
gra
ph
: V
ert
ice
s a
re t
hin
gs
; A
rcs
are
re
lati
on
sh
ips
/be
ha
vio
rs.
5 m
os
t c
om
mo
n v
iew
s b
uilt
fro
m
UML 1.x: 9 diagram types
.UML 2.0: 12 diagram types
Be
ha
vio
ral
Dia
gra
ms
Represent the dynamicaspects.
–U
se
ca
se
–S
eq
ue
nc
e;
Co
llab
ora
tio
n
–S
tate
ch
art
–A
cti
vit
y
Str
uc
tura
l D
iag
ram
s
Represent the static aspects of a system.
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
Be
ha
vio
ral
Dia
gra
ms
–U
se
ca
se
–S
tate
ch
art
–A
cti
vit
y
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–C
om
po
sit
e S
tru
ctu
re
–P
ac
ka
ge
Inte
rac
tio
n D
iag
ram
s
–S
eq
ue
nc
e;
Communication
–In
tera
cti
on
Ov
erv
iew
–T
imin
g
©L
aw
ren
ce
Ch
un
g3
Cla
ss
Dia
gra
ms
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–Composite Structure
–P
ac
ka
ge
©L
aw
ren
ce
Ch
un
g4
Class Diagram
Thre
e m
odel
ing p
ersp
ectives
for Cla
ss D
iagra
m
�C
onceptu
al:
the
dia
gra
m r
efl
ec
ts t
he
do
ma
in
�Specific
ation
:fo
cu
s o
n i
nte
rfa
ce
s o
f th
e s
oft
wa
re (
Ja
va
su
pp
ort
s i
nte
rfa
ce
s)
�Im
ple
menta
tion
:c
las
s (
log
ica
l d
ata
ba
se
sc
he
ma
) d
efi
nit
ion
to
be
imp
lem
en
ted
in
co
de
an
d d
ata
ba
se
.
The basis for all object modeling
All things lead to this
Mos
t use
rs o
f OO
met
hods
take
an
impl
emen
tatio
n pe
rspe
ctive
, whi
Mos
t use
rs o
f OO
met
hods
take
an
impl
emen
tatio
n pe
rspe
ctive
, whi
Mos
t use
rs o
f OO
met
hods
take
an
impl
emen
tatio
n pe
rspe
ctive
, whi
Mos
t use
rs o
f OO
met
hods
take
an
impl
emen
tatio
n pe
rspe
ctive
, whi
ch is
a s
ham
e be
caus
e th
e ot
her
ch is
a s
ham
e be
caus
e th
e ot
her
ch is
a s
ham
e be
caus
e th
e ot
her
ch is
a s
ham
e be
caus
e th
e ot
her
pers
pect
ives
are
ofte
n m
ore
usef
ul.
pers
pect
ives
are
ofte
n m
ore
usef
ul.
pers
pect
ives
are
ofte
n m
ore
usef
ul.
pers
pect
ives
are
ofte
n m
ore
usef
ul.-
-Mar
tin F
owle
r
•M
os
t c
om
mo
n d
iag
ram
.
•S
ho
ws
a s
et
of
cla
ss
es
, in
terf
ac
es
, a
nd
co
llab
ora
tio
ns
an
d t
he
irre
lati
on
sh
ips
(d
ep
en
de
nc
y,
ge
ne
raliz
ati
on
, a
ss
oc
iati
on
an
d r
ea
liza
tio
n);
no
tes
to
o.
•R
ep
res
en
ts t
he
sta
tic
vie
w o
f a
sy
ste
m (
Wit
h a
cti
ve
cla
ss
es
, s
tati
c p
roc
es
sv
iew
)
©L
aw
ren
ce
Ch
un
g5
Names
Custom
er
Acc
ount
Ban
k
Java:
:aw
t::P
oly
gon
simple name -start w. upper case
pat
h n
ame
= p
ackag
e nam
e ::pac
kag
e nam
e::n
ame
only
the n
am
e c
om
part
ment, o
k
Attributes
short n
oun -
star
t w
. lo
wer
cas
e
bal
ance
: Rea
l = 0
type/
clas
s
def
ault v
alue
<<constructor>>
+addAccount()
<<process>>
+setBalance( a : Account)
+getBalance(a: Account): Amount
… <<query>>
isV
alid
( lo
gin
ID : S
trin
g): B
oole
an
signat
ure
Operations
ma
y c
au
se
ob
jec
t to
ch
an
ge
sta
te
Classes
ellip
sis
for additio
nal
attri
bute
s o
r opera
tions
ste
reoty
pes to c
ate
gorize
©L
aw
ren
ce
Ch
un
g6
Responsibilities
•A
co
llab
ora
tor
is a
lso
a c
las
s w
hic
h t
he
(c
urr
en
t) c
las
s i
nte
rac
ts w
ith
to
fu
lfill
a r
es
po
ns
ibili
ty
Responsibilities
--handles deposits
--reports fraud to m
anagers
Acc
ount
•a
ny
thin
g t
ha
t a
cla
ss
kn
ow
s o
r d
oe
s
(Co
ntr
ac
t o
r o
blig
ati
on
)
•A
n o
pti
on
al
4th
ite
m c
arr
ied
ou
t b
y a
ttri
bu
tes
an
d o
pe
rati
on
s.
•F
ree
-fo
rm t
ex
t; o
ne
ph
ras
e p
er
res
po
ns
ibili
ty.
•T
ec
hn
iqu
e -
CR
C c
ard
s (
Cla
ss
-Re
sp
on
sib
ility
-Co
llab
ora
tor)
; K
en
t B
ec
k a
nd
Wa
rd
Cu
nn
ing
ha
m’8
9
Cu
sto
me
r
Ac
co
un
tO
pe
ns
ac
co
un
t
Kn
ow
s n
am
e
Kn
ow
s a
dd
res
s
Ac
co
un
t
Ma
na
ge
rK
no
ws
in
tere
st
rate
Kn
ow
s b
ala
nc
e
Ha
nd
les
de
po
sit
s
Re
po
rts
fra
ud
to
ma
na
ge
r
©L
aw
ren
ce
Ch
un
g7
Scope & Visibility
+addMessage( m : Message ) : Status
#setCheckSum()
-encrypt()
header : FrameHeader
uniqueID : LongF
ram
e
cla
ss s
cope
public
pro
tecte
d
pri
vate
•P
ub
lic-
ac
ce
ss
allo
we
d f
or
an
y o
uts
ide
cla
ss
ifie
r (+
).
•P
rote
cte
d-
ac
ce
ss
allo
we
d f
or
an
y d
es
ce
nd
an
t o
f th
e c
las
sif
ier
(#).
•P
riv
ate
-a
cc
es
s r
es
tric
ted
to
th
e c
las
sif
ier
its
elf
(-)
.
•(u
sin
g a
do
rnm
en
ts i
n J
Bu
ilde
r)
Insta
nce s
cope
•In
sta
nce
Sc
op
e —
ea
ch
in
sta
nc
e o
f th
e c
las
sif
ier
ho
lds
its
ow
n v
alu
e.
•C
lass
Sc
op
e —
on
e v
alu
e i
s h
eld
fo
r a
ll in
sta
nc
es
of
the
cla
ss
ifie
r(u
nd
erl
ine
d).
-getClassName()
Public
cla
ss
Private
cla
ss
Pro
tecte
dcla
ss
Public
meth
od
Public
attri
bute
©L
aw
ren
ce
Ch
un
g8
co
ns
ole
Po
rt [
2..
* ]
: P
ort
Ne
two
rkC
on
tro
ller
1
Co
ntr
olR
od3
multip
licity
sin
gle
ton
pu
blic
cla
ss
Sin
gle
ton
{p
riv
ate
sta
tic
Sin
gle
ton
in
sta
nc
e =
nu
ll;
pri
va
te S
ing
leto
n()
{}
pu
blic
sta
tic
Sin
gle
ton
ge
tIn
sta
nc
e()
{
if (
ins
tan
ce
==
nu
ll) {
ins
tan
ce
= n
ew
Sin
gle
ton
();
} retu
rn i
ns
tan
ce
;
}
}
Multiplicity
Sin
gle
ton
-in
stan
ce
+ g
etIn
stan
ce():S
ingle
ton
co
ns
ole
Po
rt [
2..
* ]
: P
ort
Ne
two
rkC
on
tro
ller
Usin
g D
esig
n P
att
ern
©L
aw
ren
ce
Ch
un
g9
Relationships
Window
open()
close()
ConsoleWindow
DialogBox
Control
Event
association
dependency
generalization
Set
TopC
ontroller
auth
oriza
tionLev
el
star
tUp()
shutD
ow
n()
Connec
t()
<<in
terf
ace>
>
UR
LStrea
mH
andle
r
open
Connec
tion()
par
seU
RL()
setU
RL()
toExte
rnal
Form
()
Pow
erM
anag
er
Chan
nel
Iter
ator
Controller
Em
bed
ded
Agen
t
<<frie
nd>>
genera
lization
(multip
le inherita
nce)
associa
tion n
avig
ation
ste
reoty
ped d
ependency
realization
©L
aw
ren
ce
Ch
un
g1
0
AudioClip
Dependency
•A
ch
an
ge
in
on
e t
hin
g m
ay
aff
ec
t a
no
the
r.
record(m:Microphone)
start()
stop()
Microphone
name
dependency
•T
he
mo
st
co
mm
on
de
pe
nd
en
cy
be
twe
en
tw
o c
las
se
s i
s o
ne
wh
ere
on
e
cla
ss
<<
us
e>
>s
an
oth
er
as
a parameter to an operation
.
Cours
eSch
edule
addCours
e(c
: Cours
e)
rem
oveC
ours
e(c
: Cours
e
Cours
e
Us
ua
lly i
nit
ial
cla
ss
dia
gra
ms
will
no
t h
av
e a
ny
sig
nif
ica
nt
nu
mb
er
of
de
pe
nd
en
cie
s i
n t
he
be
gin
nin
g o
f a
na
lys
is
bu
t w
ill a
s m
ore
de
tails
are
id
en
tifi
ed
.
Using relationship
©L
aw
ren
ce
Ch
un
g1
1
Dependency –Among Classes
Abstr
actC
lass {abstr
act}
att
rib
ute
co
nc
rete
Op
era
tio
n()
abstractOperation()
<<
me
tac
las
s>
>
MetaClassName
<<
inte
rfa
ce
>>
InterfaceName
operation()
ClassName
-sim
ple
Att
rib
ute
: T
yp
e =
De
fau
lt
#c
las
sA
ttri
bu
te:
Ty
pe
+/d
eri
ve
dA
ttri
bu
te:
Ty
pe
+o
pe
rati
on
(in
arg
: T
yp
e =
De
fau
lt):
Re
turn
Ty
pe
ob
jec
tNa
me
: C
las
sN
am
e
Att
rib
ute
= v
alu
e
sim
ple
Att
rib
ute
: T
yp
e =
De
fau
lt
cla
ss
Att
rib
ute
: T
yp
e
/de
riv
ed
Att
rib
ute
: T
yp
e
ClientClass
<<
us
e>
>
<<
ins
tan
ce
Of>
>
<<
ins
tan
ce
Of>
> realization
genera
lization
©L
aw
ren
ce
Ch
un
g1
2
Dependency –Among Classes
•E
igh
t S
tere
oty
pe
s o
f D
ep
en
de
nc
y A
mo
ng
Cla
ss
es
–bind
: t
he
so
urc
e i
ns
tan
tia
tes
th
e t
arg
et
tem
pla
te u
sin
g t
he
giv
en
ac
tua
l p
ara
me
ters
–derive
: t
he
so
urc
e m
ay
be
co
mp
ute
d f
rom
th
e t
arg
et
–friend
: t
he
so
urc
e i
s g
ive
n s
pe
cia
l v
isib
ility
in
to t
he
ta
rge
t
–in
sta
nceO
f : t
he
so
urc
e o
bje
ct
is a
n i
ns
tan
ce
of
the
ta
rge
t c
las
sif
ier
–instantiate
: t
he
so
urc
e c
rea
tes
in
sta
nc
es
of
the
ta
rge
t
–powertype
: t
he
ta
rge
t is
a p
ow
ert
yp
e o
f th
e s
ou
rce
; a
po
we
rty
pe
is
a
cla
ss
ifie
r w
ho
se
ob
jec
ts a
re a
ll th
e c
hild
ren
of
a g
ive
n p
are
nt
–refine
: t
he
so
urc
e i
s a
t a
fin
er
de
gre
e o
f a
bs
tra
cti
on
th
an
th
e t
arg
et
–use
: t
he
se
ma
nti
cs
of
the
so
urc
e e
lem
en
t d
ep
en
ds
on
th
e s
em
an
tic
s
of
the
pu
blic
pa
rt o
f th
e t
arg
et
©L
aw
ren
ce
Ch
un
g1
3
De
pe
nd
en
cy
–A
mo
ng
Us
e C
as
es
•T
wo
Ste
reo
typ
es
of
De
pe
nd
en
cy
Am
on
g U
se
Ca
se
s:
–extend
:th
e t
arg
et
us
e c
as
e e
xte
nd
s t
he
be
ha
vio
r o
f th
e s
ou
rce
–include
:th
e s
ou
rce
us
e c
as
e e
xp
licit
ly i
nc
orp
ora
tes
th
e b
eh
av
ior
of
an
oth
er
us
e c
as
e at a location
sp
ec
ifie
d b
y t
he
so
urc
e
Use Case A
Use Case B
Use Case C
<<
ex
ten
d>
><
<in
clu
de
>>
System
Ac
tor
<<
ac
tor>
>
Actor
Supply Customer Info.
Request Catalog
<<
ex
ten
d>
>
<<
inc
lud
e>
>
Order Processing System
Sa
les
Pe
rso
n
Order Item
Make Paymen
t
<<
inc
lud
e>
><
<in
clu
de
>>
Th
e s
ale
s p
ers
on
as
ks
fo
r th
e c
ata
log
Place Order
Extension points
Ad
dit
ion
al
req
ue
sts
:
aft
er
cre
ati
on
of
the
ord
er
1*
©L
aw
ren
ce
Ch
un
g1
4
Generalization
•F
ou
r S
tan
da
rd C
on
str
ain
ts
–complete
: a
ll c
hild
ren
in
th
e g
en
era
liza
tio
n h
av
e b
ee
n
sp
ec
ifie
d;
no
mo
re c
hild
ren
are
pe
rmit
ted
–in
com
ple
te:
no
t a
ll c
hild
ren
ha
ve
be
en
sp
ec
ifie
d;
ad
dit
ion
al
ch
ildre
n a
re p
erm
itte
d
–disjoint:
ob
jec
ts o
f th
e p
are
nt
ha
ve
no
mo
re t
ha
n o
ne
of
the
ch
ildre
n a
s a
ty
pe
–overl
appin
g:
ob
jec
ts o
f th
e p
are
nt
ma
y h
av
e m
ore
tha
n o
ne
of
the
ch
ildre
n a
s a
ty
pe
•O
ne
Ste
reo
typ
e
–implementation
: th
e c
hild
in
he
rits
th
e i
mp
lem
en
tati
on
of
the
p
are
nt
bu
t d
oe
s n
ot
ma
ke
pu
blic
no
r s
up
po
rt i
ts i
nte
rfa
ce
s
©L
aw
ren
ce
Ch
un
g1
5
Generalization –Along Roles
dis
crim
inato
r
©L
aw
ren
ce
Ch
un
g1
6
Generalization –Among Actors
Sa
les
Pe
rso
n
Place Order
Extension points
Ad
dit
ion
al
req
ue
sts
:
aft
er
cre
ati
on
of
the
ord
er
1*
Sa
les
Ma
na
ge
r
Grant Credit
1*
Sa
les
pe
rso
n c
an
do
on
ly “
Pla
ce
Ord
er”
;
Sa
les
ma
na
ge
r c
an
do
bo
th “
Pla
ce
Ord
er”
an
d “
Gra
nt
Cre
dit
”
©L
aw
ren
ce
Ch
un
g1
7W
ha
t’s
th
e d
iffe
ren
ce
be
twe
en
att
rib
ute
s a
nd
as
so
cia
tio
ns
?
Associations
Professor
Course
teaches
relationship name
direction indicator:
how to read relation name
teacher
class
(domain) role names (range)
Multiplicity
defines the number of objects associated with
an instance of the association.
Default of 1;
Zero or more (*);
n..m; range from n to m inclusive
1..*
*
•R
ep
res
en
t c
on
ce
ptu
al
rela
tio
ns
hip
s b
etw
ee
n c
las
se
s(c
f. d
ep
en
de
nc
y w
ith
no
co
mm
un
ica
tio
n/m
es
sa
ge
pa
ss
ing
)
navigability
{visibility} {/} role name {: interface name}
©L
aw
ren
ce
Ch
un
g1
8
Associations –A Question
•H
ow
wo
uld
yo
u m
od
el
the
fo
llow
ing
sit
ua
tio
n?
“You have two files, say homework1 and myPet, where homework1 is
read-accessible only by you, but myPet is write-accessible by anybody.”
Yo
u c
ou
ld c
rea
te t
wo
cla
ss
es
, F
ile a
nd
Us
er.
Ho
me
wo
rk1
an
d M
yP
et
are
file
s,
an
d y
ou
are
a u
se
r.
File
Use
r
Approach 1
: N
ow
, w
ou
ld y
ou
as
so
cia
te t
he
file
ac
ce
ss
rig
ht
wit
h F
ile?
Approach 2
: O
r, w
ou
ld y
ou
as
so
cia
te t
he
file
ac
ce
ss
rig
ht
wit
h U
se
r?
ho
me
wo
rk1
:File
my
Pe
t:F
ile
<<
ins
tan
ce
Of>
>
u:U
se
r
<<
ins
tan
ce
Of>
>
anyoneE
lse:
Use
ran
yoneE
lse:
Use
r
©L
aw
ren
ce
Ch
un
g1
9Association generalization is not automatic, but should be explicit in UML 1.x (not in UML2.0)
Associations –Links
–lin
k i
s a
se
ma
nti
c c
on
ne
cti
on
am
on
g o
bje
cts
.
–A
lin
k i
s a
n i
ns
tan
ce
of
an
as
so
cia
tio
n.
Company
1..*
*
employee
employer
: Company
assign(development)
w : W
orker
link
named object
anonym
ous object
class
association
class
Worker
+setSalary( s : Salary)
+setD
ept( d : Dept)
works for
association name
<<
ins
tan
ce
Of>
><
<in
sta
nc
eO
f>>
?
©L
aw
ren
ce
Ch
un
g2
0
Associations –Link Attributes
•L
ink
Att
rib
ute
s
Th
e m
os
t c
om
pe
llin
g r
ea
so
n f
or
ha
vin
g l
ink
att
rib
ute
s i
s f
or-
ma
ny
-to
-ma
ny
re
lati
on
sh
ips
File
Use
r
acce
ss p
erm
ission
File
Use
r
acce
ss p
erm
ission
•A
ss
oc
iati
on
Cla
ss
AccessRight
*1..*
link attribute
association class
•W
ith
a r
efa
cto
rin
g(“
reif
ica
tio
n”)
File
Use
r*
1..*
acce
ss p
erm
ission
AccessRight
11
visual tie
©L
aw
ren
ce
Ch
un
g2
1
Modeling Structural Relationships
The model above is from Rational Rose. How did the composite sym
bol ( )get loaded versus the
aggregation?Use the Role Detail and select aggregation and then the “by value”radio button.
School
Instructor
Course
Department
Student
*
1..*
1..*
1
has
5 555member
*
*attends 4 444
*
1..*
3 333teaches
1..*
1..*
1..*
1..*
0..1
1chairperson
5 555assigned to
�C
on
sid
eri
ng
a b
un
ch
of
cla
ss
es
an
d t
he
ir a
ss
oc
iati
on
re
lati
on
sh
ips
©L
aw
ren
ce
Ch
un
g2
2
Modeling Structural Relationships
Composite is a stronger form of aggregation.
Composite parts live and die with the whole.
Composite parts may belong to only one composite.
Liver
Body
Heart
Wheel
Car
Engine
Composite
Company
Department
1..*
association
multip
lici
ty
aggregation
part
whole
-s
tru
ctu
ral
as
so
cia
tio
n r
ep
res
en
tin
g “
wh
ole
/pa
rt”
rela
tio
ns
hip
.
-“h
as
-a”
rela
tio
ns
hip.
Aggregation
Part
-> w
hole
?
Body
Liver
Heart
Can aggregations of objects be cyclic?
©L
aw
ren
ce
Ch
un
g2
3
Work
Des
kjo
bId
: int
retu
rned
Item
*0..1
Qualifier
, ca
nnot ac
cess
per
son w
ithout know
ing the
acco
unt #
Ba
nk
ac
co
un
t #
Pe
rso
n
Sq
ua
re
*
0..
1
1 1
Association –Qualification
Ch
es
sb
oa
rd
ran
k:R
an
k
file
:File
©L
aw
ren
ce
Ch
un
g2
4
Association –Interface Specifier
work
er : IEm
plo
yee
super
visor : IM
anag
er
*
1Per
son
Interface Specifier
association
Realization
•A
se
ma
nti
c r
ela
tio
ns
hip
be
twe
en
cla
ss
ifie
rs i
n w
hic
h o
ne
cla
ss
ifie
r s
pe
cif
ies
a c
on
tra
ct
tha
t a
no
the
r g
ua
ran
tee
s t
o c
arr
y o
ut.
•In
th
e c
on
tex
t o
f in
terf
ac
es
an
d c
olla
bo
rati
on
s
•An interface can be realized by many classes/components
•A class/component may realize many interfaces
IMa
na
ge
r
getProject()
getSchedule()
Pe
rso
n
©L
aw
ren
ce
Ch
un
g2
5
Mo
de
ling
a L
og
ica
l D
ata
ba
se
•C
las
s d
iag
ram
s t
o p
rov
ide
mo
re s
em
an
tic
s
•F
rom
a g
en
era
l c
las
s d
iag
ram
, fi
rst
ide
nti
fy c
las
se
s w
ho
se
sta
tem
us
t b
e p
ers
iste
nt
(e.g
. a
fte
r y
ou
tu
rn o
ff t
he
co
mp
ute
r, t
he
da
ta s
urv
ive
s,
alt
ho
ug
h t
he
pro
gra
m d
oe
sn
’t).
•C
rea
te a
cla
ss
dia
gra
m u
sin
g s
tan
da
rd t
ag
ge
d v
alu
e,
(e.g
. {p
ers
iste
nt}
).
•In
clu
de
att
rib
ute
s a
nd
as
so
cia
tio
ns
.
•U
se
to
ols
, if
av
aila
ble
, to
tra
ns
form
lo
gic
al
de
sig
n (
e.g
., t
ab
les
an
d a
ttri
bu
tes
) in
to p
hy
sic
al
de
sig
n (
e.g
., l
ay
ou
t o
f d
ata
on
dis
k a
nd
in
de
xin
g m
ec
ha
nis
ms
fo
rfa
st
ac
ce
ss
to
th
e d
ata
).
1..*
School
{ persistent}
name : Name
address : String
phone : Number
addStudent()
removeStudent()
getStudent()
getAllStudents()
addDepartment()
removeDepartment()
getDepartment()
getAllDepartments()
Student
{ persistent}
name : Name
studentId : Number
Instructor
{ persistent}
name : Name
Department
{ persistent}
name : Name
addInstructor()
removeInstructor()
getInstructor()
getAllInstructors()
Course
{ persistent}
name : Name
courseId : Number
1..*
1..*
1..*
1..*
1..*
1..*
*
0..1
0..1
chairperson
**
*
Is m
appin
g 1
-1?
©L
aw
ren
ce
Ch
un
g2
6
Forward/
Re
ve
rseEngineering
•tr
an
sla
te a
co
llab
ora
tio
n i
nto
a l
og
ica
l d
ata
ba
se
sc
he
ma
/op
era
tio
ns
•tr
an
sfo
rm a
mo
de
l in
to c
od
e t
hro
ug
h a
ma
pp
ing
to
an
im
ple
me
nta
tio
n l
an
gu
ag
e.
•S
tep
s–
Se
lec
tiv
ely
us
e U
ML
to
ma
tch
la
ng
ua
ge
se
ma
nti
cs
(e
.g.
ma
pp
ing
mu
ltip
le i
nh
eri
tan
ce
in
a c
olla
bo
rati
on
dia
gra
m i
nto
a p
rog
ram
min
g l
an
gu
ag
e w
ith
on
ly s
ing
le i
nh
eri
tan
ce
me
ch
an
ism
).
–U
se
tagged values
to i
de
nti
fy l
an
gu
ag
e..
public abstract class EventHandler
{
private EventHandler successor;
private Integer currentEventId;
private String source;
EventHandler() {}
public void handleRequest() {}
}
successor
EventH
andle
r{ Java}
currentEventId : Integer
source : Strings
handle
Request() : void
Client
{ Java}
•tr
an
sla
te a
lo
gic
al
da
tab
as
e s
ch
em
a/o
pe
rati
on
s i
nto
a c
olla
bo
rati
on
•tr
an
sfo
rm c
od
e i
nto
a m
od
el
thro
ug
h m
ap
pin
g f
rom
a s
pe
cif
ic i
mp
lem
en
tati
on
la
ng
ua
ge
.
©L
aw
ren
ce
Ch
un
g2
7
Ob
jec
t D
iag
ram
s
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t–
Co
mp
on
en
t
–D
ep
loy
me
nt
–Composite Structure
–P
ac
ka
ge
©L
aw
ren
ce
Ch
un
g2
8
Instances & Object Diagrams
�“i
ns
tan
ce
”a
nd
“o
bje
ct”
are
la
rge
ly s
yn
on
ym
ou
s;
us
ed
in
terc
ha
ng
ea
bly
.
�d
iffe
ren
ce
:
�in
sta
nc
es
of
a class
are
ca
lled
ob
jec
ts o
r in
sta
nc
es
; b
ut
�in
sta
nc
es
of
oth
er
ab
str
ac
tio
ns
(c
om
po
ne
nts
, n
od
es
, u
se
ca
se
s,
an
d
as
so
cia
tio
ns
) a
re n
ot
ca
lled
ob
jec
ts b
ut
on
ly i
ns
tan
ce
s.
What is an instance of an association called?
Object Diagrams
�v
ery
us
efu
l in
de
bu
gg
ing
pro
ce
ss
.–
wa
lk t
hro
ug
h a
sc
en
ari
o (
e.g
., a
cc
ord
ing
to
us
e c
as
e f
low
s).
–Id
en
tify
th
e s
et
of
ob
jec
tsth
at
co
llab
ora
te i
n t
ha
t s
ce
na
rio
(e
.g.,
fro
m u
se
ca
se
flo
ws
).
–E
xp
os
e t
he
se
ob
jec
t’s
sta
tes
, a
ttri
bu
te v
alu
es
an
d l
ink
sa
mo
ng
th
es
e o
bje
cts
.
Are
use c
ases o
bje
cts
?
How
in the “
4+1”?
©L
aw
ren
ce
Ch
un
g2
9
: key
Code
: key
Code
Instances & Objects
-V
isu
al
Re
pre
se
nta
tio
n
: M
ultim
edia
:: A
udio
Strea
mt : Tra
nsa
ctio
n
myCustom
er
r : Fra
meR
ender
Thre
ad
c : Phone
[Wai
tingForA
nsw
er]
myCustom
er
id : S
SN
= “
432-8
9-1
738”
active
= T
rue
agen
t :
nam
ed insta
nce
insta
nce w
ith c
urr
ent sta
te
insta
nce w
ith a
ttribute
valu
es
active o
bje
ct
(with a
thic
ker bord
er;
ow
ns a
thre
ad o
r pro
cess a
nd c
an
initia
te c
ontr
ol activity)
multio
bje
ct
orp
han insta
nce
(type u
nknow
n)
anonym
ous insta
nce
©L
aw
ren
ce
Ch
un
g3
0
Instances & Objects
-M
od
elin
g C
on
cre
te I
ns
tan
ce
s
•E
xp
os
e t
he
ste
reo
typ
es
, ta
gg
ed
va
lue
s,
an
d a
ttri
bu
tes
.
•S
ho
w t
he
se
in
sta
nc
es
an
d t
he
ir r
ela
tio
ns
hip
s i
n a
n o
bje
ct
dia
gra
m.
curr
ent: T
ransa
ctio
n
prim
aryA
gen
t
[sea
rchin
g]
: Tra
nsa
ctio
n: Tra
nsa
ctio
n
Loan
Offic
er<<instanceOf>>
curr
ent :=
ret
riev
e()
Instances & Objects
-M
od
elin
g P
roto
typ
ica
l In
sta
nc
es
•S
ho
w t
he
se
in
sta
nc
es
an
d t
he
ir r
ela
tio
ns
hip
s i
n a
n i
nte
rac
tio
n d
iag
ram
or
an
a
cti
vit
y d
iag
ram
.
a: C
allingA
gen
tc:
Connec
tion
1 : create
2: enableConnection
2.1 : startBilling
What could
this
mean?
©L
aw
ren
ce
Ch
un
g3
1
Ins
tan
ce
s &
Ob
jec
ts–
Mo
re E
xa
mp
les
clie
nt
servers
1: aServer := find(criteria)
d: D
irec
tory
1: sort()
list()
conte
nts: File
conte
nts: File
d: D
irec
tory
1: addElement(f)
addFile(f:File)
conte
nts: File
conte
nts: File
:Ser
ver
:Ser
ver
aSer
ver
:Ser
ver
2: process(request)
c : Com
pan
y
s : D
epar
tmen
t
nam
e = “
Sal
es”
uss
: D
epar
tmen
t
nam
e = “
US S
ales
”
erin
: P
erso
n
nam
e = “
Erin”
emplo
yee
ID =
4362
title
= “
VP o
f Sal
es”
rd : D
epar
tmen
t
nam
e = “
R&
D”
: Conta
ctIn
fom
atio
n
addre
ss =
“1472 M
ille
r St.”
man
ager
call ::= label [guard] [“*”] [return-val-list “:=“] msg-name “(“arg-list “)”
d: D
irec
tory
1*: changeMode(readOnly)
secureAll()
f: F
ile
*
©L
aw
ren
ce
Ch
un
g3
2
Co
mp
on
en
t D
iag
ram
s
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–Composite Structure
–P
ac
ka
ge
©L
aw
ren
ce
Ch
un
g3
3
Component Diagram
�S
ho
ws
a s
et
of
co
mp
on
en
ts a
nd
th
eir
re
lati
on
sh
ips
.
�R
ep
res
en
ts t
he
sta
tic
im
ple
me
nta
tio
nv
iew
of
a s
ys
tem
.
�C
om
po
ne
nts
ma
p t
o o
ne
or
mo
re c
las
se
s,
inte
rfa
ce
s,
or
co
llab
ora
tio
ns
.
classes
loanOfficer.dll
component
LoanOfficer
LoanPolicy
CreditSearch
Registrar.exe
Course.dll
Student.dll
Com
ponents
and their R
ela
tionship
sM
appin
g o
f C
om
ponents
into
Cla
sses
UML1.x –implementation view
©L
aw
ren
ce
Ch
un
g3
4
Component Diagram
UML2.0 –architectural view
•S
ho
rt h
isto
ry b
eh
ind
arc
hit
ec
ture
•A
rch
ite
ctu
re s
till
an
em
erg
ing
dis
cip
line
•C
ha
llen
ge
s,
a b
um
py
ro
ad
ah
ea
d
•U
ML
an
d a
rch
ite
ctu
re e
vo
lvin
g i
n p
ara
llel
•C
om
po
ne
nt
dia
gra
m i
n n
ee
d o
f b
ett
er
form
aliz
ati
on
an
d e
xp
eri
me
nta
tio
n
Big
dem
and, hm
m…
©L
aw
ren
ce
Ch
un
g3
5
Co
mp
on
en
t D
iag
ram
–a
no
the
r e
xa
mp
le(w
ww
.cs
.tu
t.fi
/ta
pa
htu
ma
t/o
lio2
00
4/r
ich
ard
so
n.p
df)
©L
aw
ren
ce
Ch
un
g3
6
Co
mp
on
en
t D
iag
ram
–a
no
the
r e
xa
mp
le(w
ww
.cs
.tu
t.fi
/ta
pa
htu
ma
t/o
lio2
00
4/r
ich
ard
so
n.p
df)
©L
aw
ren
ce
Ch
un
g3
7
Co
mp
on
en
t D
iag
ram
–a
no
the
r e
xa
mp
le(w
ww
.cs
.tu
t.fi
/ta
pa
htu
ma
t/o
lio2
00
4/r
ich
ard
so
n.p
df)
©L
aw
ren
ce
Ch
un
g3
8
Component Diagram
UML2.0 –architectural view
Component
Component
Ex
plic
it d
es
cri
pti
on
of in
terf
aces
:
�p
rov
ide
d s
erv
ice
s t
o o
the
r c
om
po
ne
nts
�re
qu
es
ted
se
rvic
es
fro
m o
the
r c
om
po
ne
nts
�A
n i
nte
rfa
ce
is
a c
olle
cti
on
of
1..
* m
eth
od
s,
an
d 0
..*
att
rib
ute
s
�In
terf
ac
es
ca
n c
on
sis
t o
f s
yn
ch
ron
ou
s a
nd
/ o
r a
sy
nc
hro
no
us
op
era
tio
ns
�A
port
(square
) is
an
in
tera
cti
on
po
int
be
twe
en
th
e c
om
po
ne
nt
an
d i
ts e
nv
iro
nm
en
t.
�C
an
be
na
me
d;
Ca
n s
up
po
rt u
ni-
dir
ec
tio
na
l (e
ith
er
pro
vid
e o
r re
qu
ire
)o
r b
i-d
ire
cti
on
al
(bo
th p
rov
ide
an
d r
eq
uir
e)
co
mm
un
ica
tio
n;
Ca
n s
up
po
rt m
ult
iple
in
terf
ac
es
.
�p
os
sib
ly c
on
cu
rre
nt
inte
rac
tio
ns
�fu
lly i
so
late
an
ob
jec
t’s
in
tern
als
fro
m i
ts e
nv
iro
nm
en
t
lollip
op
socket
Stu
de
nt
Stu
de
ntA
dm
inis
tra
tio
n
Stu
de
ntS
ch
ed
ule
Ac
ce
ss
Co
ntr
ol
En
cri
pti
on
Pe
rsis
ten
ce
Da
taA
cc
es
s
security
Data[1..*]
Inco
min
g
sig
nal
s/ca
lls
Inco
min
g
sig
nal
s/ca
llsO
utg
oin
g
sig
nal
s/ca
lls
Ou
tgo
ing
si
gn
als/
calls
caller or callee?
©L
aw
ren
ce
Ch
un
g3
9
Component Diagram:
UM
L 1
.x a
nd
UM
L 2
.0(h
ttp
://w
ww
.ag
ilem
od
elin
g.c
om
/art
ifa
cts
/co
mp
on
en
tDia
gra
m.h
tm)
©L
aw
ren
ce
Ch
un
g4
0
Component Diagram
:U
ML
1.x
an
dU
ML
2.0
(htt
p:/
/ww
w.a
gile
mo
de
ling
.co
m/a
rtif
ac
ts/c
om
po
ne
ntD
iag
ram
.htm
)
So, how
many d
iffe
rent conventions for
com
ponents
in U
ML2.0
?
©L
aw
ren
ce
Ch
un
g4
1
Building a Component
�s
imp
lifie
d t
he
po
rts
to
eit
he
r p
rov
ide
or
req
uir
e a
sin
gle
in
terf
ac
e
�re
lati
on
sh
ips
be
twe
en
po
rts
an
d i
nte
rna
l c
las
se
s i
n t
hre
e d
iffe
ren
t w
ay
s:
i) a
s s
tere
oty
ped d
ele
gate
s(f
low
), a
s d
ele
gate
s,
an
d a
s r
ealize
s (
log
ica
l->
ph
ys
ica
l) r
ela
tio
ns
hip
s
�C
oh
es
ive
re
us
e a
nd
ch
an
ge
of
cla
ss
es
; a
cy
clic
co
mp
on
en
t d
ep
en
de
nc
y ?
??
.
©L
aw
ren
ce
Ch
un
g4
2
Component Diagram
–Connector & Another Example
dele
gation
Left d
ele
gation: direction o
f arr
ow
head indic
ate
s
“pro
vid
es”
dele
gation
assem
bly
connecto
r
�a
co
nn
ec
tor:
ju
st
a l
ink
be
twe
en
tw
o o
r m
ore
co
nn
ec
tab
le e
lem
en
ts (
e.g
., p
ort
s o
r
inte
rfa
ce
s)
�2
kin
ds
of
co
nn
ec
tors
: assembly a
nd
delegation
. F
or
“w
irin
g”
�A
n a
ssem
bly
co
nn
ec
tor:
a b
ind
ing
be
twe
en
a p
rov
ide
d i
nte
rfa
ce
an
d a
re
qu
ire
d
inte
rfa
ce
(o
r p
ort
s)
tha
t in
dic
ate
s t
ha
t o
ne
co
mp
on
en
t p
rov
ide
s t
he
se
rvic
es
req
uir
ed
by
an
oth
er;
sim
ple
lin
e/b
all-a
nd-s
ocket/lo
llip
op-s
ocket nota
tion
�A
dele
gation
co
nn
ec
tor
bin
ds
a c
om
po
ne
nt’
s e
xte
rna
l b
eh
av
ior
(as
sp
ec
ifie
d a
t
a p
ort
) to
an
in
tern
al
rea
liza
tio
n o
f th
at
be
ha
vio
r b
y o
ne
of
its
pa
rts
(provide-provide,
request-request).
Rig
ht dele
gation: dir
ection o
f arr
ow
head indic
ate
s
“re
quests
”
sto
re
So, w
hat le
vels
of abstr
actions for connections?
©L
aw
ren
ce
Ch
un
g4
3
Structured Class
�A
structured class(ifier) i
s d
efi
ne
d,
in w
ho
le o
r in
pa
rt,
in t
erm
s o
f a
nu
mb
er
of
parts
-c
on
tain
ed
in
sta
nc
es
ow
ne
d o
r re
fere
nc
ed
by
th
e s
tru
ctu
red
cla
ss
(ifi
er)
.
�W
ith
a s
imila
r m
ea
nin
g t
o a
composition
rela
tio
n
�A
str
uc
ture
d c
las
sif
ier’
s p
art
s a
re c
rea
ted
wit
hin
th
e c
on
tain
ing
cla
ss
ifie
r
(eit
he
r w
he
n t
he
str
uc
ture
d c
las
sif
ier
is c
rea
ted
or
late
r) a
nd
are
de
str
oy
ed
wh
en
th
e c
on
tain
ing
cla
ss
ifie
r is
de
str
oy
ed
.
�L
ike
cla
ss
es
an
d c
om
po
ne
nts
, c
om
bin
e t
he
de
sc
rip
tiv
e c
ap
ab
iliti
es
of
str
uc
ture
d c
las
sif
iers
wit
h p
ort
s a
nd inte
rfaces
Com
ponents
exte
nd c
lasses
wit
h a
dd
itio
na
l fe
atu
res
su
ch
as
�th
e a
bili
ty t
o o
wn m
ore
types o
f ele
ments
tha
n c
las
se
s c
an
; e
.g.,
pa
ck
ag
es
,
co
ns
tra
ints
, u
se
ca
se
s,
an
d a
rtif
ac
ts
�d
ep
loy
me
nt
sp
ec
ific
ati
on
s t
ha
t d
efi
ne
th
e e
xe
cu
tio
n p
ara
me
ters
of
a c
om
po
ne
nt
de
plo
ye
d t
o a
no
de
label /r
ole
Nam
e : type
connecto
r
Any d
iffe
rence?
com
ponent or
cla
ss?
©L
aw
ren
ce
Ch
un
g4
4
mo
ve
()re
siz
e()
dis
pla
y()
ori
gin
Sh
ap
e
IUn
kn
ow
n<
<ty
pe
>>
Int
{ v
alu
es
ra
ng
e f
rom
-2**
31
to
+2
**3
1 -
1 }
<<
sig
na
l>>
Off
Ho
ok
Pro
ce
ss
lo
an
<<
su
bs
ys
tem
>>
Cu
sto
me
r S
erv
ice
eg
b_
se
rve
r
ke
rne
l32
.dll
cla
ss
inte
rface
data
type
sig
nal
use c
ase
subsyste
m
node
com
ponent
mo
ve
()re
siz
e()
dis
pla
y()
ori
gin
Sh
ap
e
<<
typ
e>
>In
t{
va
lue
s r
an
ge
fro
m-2
**3
1 t
o +
2**
31
-1
}
<<
sig
na
l>>
Off
Ho
ok
Pro
ce
ss
lo
an
<<
su
bs
ys
tem
>>
Cu
sto
me
r S
erv
ice
me
mb
ers
hip
_s
erv
er
ke
rne
l32
.dll
cla
ss
inte
rface
data
type
sig
nal
use c
ase
node
com
ponent
an
as
yn
ch
ron
ou
s s
tim
ulu
s
co
mm
un
ica
ted
be
twe
en
in
sta
nc
es
Classifiers
•C
las
sif
ier—
me
ch
an
ism
th
at
de
sc
rib
es
str
uc
tura
l (e
.g.
cla
ss
att
rib
ute
s)
an
d
be
ha
vio
ral
(e.g
. c
las
s o
pe
rati
on
s)
fea
ture
s.
In
ge
ne
ral,
th
os
e modeling
elements
tha
t c
an
ha
ve
instances
are
ca
lled
cla
ss
ifie
rs.
•cf. Packages and generalization relationships do not have instances.
Genera
lizable
Ele
ment, C
lassifie
r, C
lass, C
om
ponent?
©L
aw
ren
ce
Ch
un
g4
5
Structured Class–Another Example
what kin
d?
©L
aw
ren
ce
Ch
un
g4
6
De
plo
ym
en
t D
iag
ram
s
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–Composite Structure
–P
ac
ka
ge
©L
aw
ren
ce
Ch
un
g4
7
Deployment Diagram
J2
EE
Se
rve
r
Me
mb
ers
hip
Se
rve
r
IIS
+ P
hP
Se
rve
r
To
mc
at
Se
rve
r
TC
P/I
P
TC
P/I
P
De
cN
et
•S
ho
ws
a s
et
of processing
no
de
s a
nd
th
eir
re
lati
on
sh
ips
.
•R
ep
res
en
ts t
he
sta
tic
de
plo
ym
en
t v
iew
of
an
architecture
.
•N
od
es
ty
pic
ally
en
clo
se
on
e o
r m
ore
co
mp
on
en
ts.
©L
aw
ren
ce
Ch
un
g4
8
Structural Diagrams-Deployment Diagram
(htt
p:/
/ww
w.a
gile
mo
de
ling
.co
m/a
rtif
ac
ts/d
ep
loy
me
ntD
iag
ram
.htm
)
Stu
de
nt
ad
min
istr
ati
on
ap
plic
ati
on
�P
hy
sic
al
no
de
s -
ste
reo
typ
e device
�WebServer
-p
hy
sic
al
de
vic
e o
r
so
ftw
are
art
ifa
ct
�RMI/message bus
: c
on
ne
cti
on
ty
pe
�N
od
es
ca
n c
on
tain
oth
er
no
de
s
or
so
ftw
are
art
ifa
cts
re
cu
rsiv
ely
�D
ep
loy
me
nt
sp
ec
s:
co
nfi
gu
rati
on
file
s:
na
me
an
d p
rop
ert
ies
©L
aw
ren
ce
Ch
un
g4
9
Structural Diagrams -Deployment Diagram
(htt
p:/
/ww
w.a
gile
mo
de
ling
.co
m/a
rtif
ac
ts/d
ep
loy
me
ntD
iag
ram
.htm
)
Is t
his
be
tte
r?
�M
ore
co
nc
rete
�Im
ple
me
nta
tio
n-o
rie
nte
d
©L
aw
ren
ce
Ch
un
g5
0
Co
mp
os
ite
Str
uc
ture
Dia
gra
ms
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–Composite Structure
–P
ac
ka
ge
©L
aw
ren
ce
Ch
un
g5
1
Composite Structure Diagrams
(htt
p:/
/ww
w.a
gile
mo
de
ling
.co
m/a
rtif
ac
ts/c
om
po
sit
eS
tru
ctu
reD
iag
ram
.htm
)
Enroll in Seminar
En
roll
Stu
de
nt
pre
req
:
Se
min
ar
En
rollm
en
t
Se
min
ar
se
ats
: In
teg
er
wa
itL
ist:
Stu
de
nt
Co
urs
e
req
: C
ou
rse
co
ns
tra
ine
r
de
sir
ed
se
min
ar
ap
plic
an
t
reg
istr
ati
on
Ad
d t
oW
ait
lis
t
De
term
ine
elig
ibili
ty
De
term
ine
Se
at
av
aila
bili
ty
ap
plic
an
ts
em
ina
r
ex
isti
ng
stu
de
nts
de
sir
ed
co
urs
e
•Depicts the internal structure of a classifier (such as a class,
component, or collaboration), including the interaction points of the
classifier to other parts of the system.
structured class, structured component, structured use case, structured node, structured interface,
…
En
roll
in S
em
ina
r
En
roll
Stu
de
nt
pre
req
:
Se
min
ar
En
rollm
en
t
Se
min
ar
se
ats
: In
teg
er
wa
itL
ist:
Stu
de
nt
Co
urs
e
req
: C
ou
rse
co
ns
tra
ine
r
de
sir
ed
se
min
ar
ap
plic
an
t
reg
istr
ati
on
<<refine>
>
©L
aw
ren
ce
Ch
un
g5
2
Va
ria
tio
ns
[Ru
mb
au
gh
–U
ML
2.0
Re
fere
nc
e:
p2
34
]
Sale
bu
ye
r: A
ge
nt
ite
m:
Pro
pe
rtys
elle
r: A
ge
nt
role
nam
e
role
type
role
collabora
tion n
am
e
Collabora
tion d
efinitio
n
ShiloPurchase: Sale
Sh
ilo:
La
ndit
em
Ed
wa
rd:
Arc
hit
ec
tB
ala
: A
na
lys
t
bu
ye
rs
elle
rro
le n
am
e
Collabora
tion u
se in o
bje
ct dia
gra
m
collabora
ting o
bje
ct
collabora
tion n
am
euse n
am
e
©L
aw
ren
ce
Ch
un
g5
3
©L
aw
ren
ce
Ch
un
g5
4
Str
uc
tura
l D
iag
ram
s
–C
las
s;
Ob
jec
t
–C
om
po
ne
nt
–D
ep
loy
me
nt
–C
om
po
sit
e S
tru
ctu
re
–Package
©L
aw
ren
ce
Ch
un
g5
5
Packages
©L
aw
ren
ce
Ch
un
g5
6
Packages
•P
ac
ka
ge
—g
en
era
l-p
urp
os
e m
ec
ha
nis
m f
or
org
an
izin
g e
lem
en
ts i
nto
gro
up
s.
Business rules
Client
Sensors::Vision
{ version = 2.24 }
sim
ple
na
me
s
enclo
sin
g p
ackage n
am
e
package n
am
e
pa
th n
am
es
+ OrderForm
+ TrackingForm
-Order
Client
Client
+OrderForm
+TrackingForm
-Order
gra
ph
ica
l n
es
tin
gte
xtu
al
ne
sti
ng
vis
ibility
•N
es
ted
Ele
me
nts
: C
om
po
sit
e r
ela
tio
ns
hip
(W
he
n t
he
wh
ole
die
s,
its
pa
rts
die
as
we
ll, b
ut
no
t n
ec
es
sa
rily
vic
e v
ers
a)
•(C
++
na
me
sp
ac
e;
sp
ec
ializ
ati
on
me
an
s “
de
riv
ed
”)
Vis
ibili
ty
+/-
/#
•P
ac
ka
ge
s t
ha
t a
re f
rie
nd
s t
o a
no
the
r m
ay
se
e a
ll th
e e
lem
en
ts o
fth
at
pa
ck
ag
e,
no
ma
tte
r w
ha
t th
eir
vis
ibili
ty.
•If
an
ele
me
nt
is v
isib
le w
ith
in a
pa
ck
ag
e,
it i
s v
isib
le w
ith
in a
ll p
ac
ka
ge
s
ne
ste
d i
ns
ide
th
e p
ac
ka
ge
.
©L
aw
ren
ce
Ch
un
g5
7
Dependency –Among Packages
•T
wo
Ste
reo
typ
es
of
De
pe
nd
en
cy
Am
on
g P
ac
ka
ge
s:
–access
: th
e s
ou
rce
pa
ck
ag
e i
s g
ran
ted
th
e r
igh
t to
re
fere
nc
e t
he
ele
me
nts
of
the
ta
rge
t p
ac
ka
ge
(:: convention)
–import
: a
kin
d o
f a
cc
es
s;
the
public
co
nte
nts
of
the
ta
rge
t p
ac
ka
ge
en
ter
the
fla
t n
am
es
pa
ce
of
the
so
urc
e a
s i
f th
ey
ha
d b
ee
n d
ec
lare
d i
nth
e s
ou
rce
pa
ck
ag
eN
am
e
pa
ck
ag
eN
am
e
su
bP
ac
ka
ge
Na
me
pa
ck
ag
eN
am
e
Pa
ck
ag
eC
las
s
<<
imp
ort
>>
<<
ac
ce
ss
>>
+ OrderForm
+ TrackingForm
-Order
Client
+OrderRules
-GUI:Window
Policies
<<import>>
+Window
+Form
#EventHandler
GUI
<<import>>
import
s
export
s
©L
aw
ren
ce
Ch
un
g5
8
Access and Import
An
im
po
rte
d e
lem
en
t c
an
be
giv
en
a l
oc
al
alia
s a
nd
a l
oc
al
vis
ibili
ty
©L
aw
ren
ce
Ch
un
g5
9
Modeling Groups of Elements
•L
oo
k f
or
“clu
mp
s”
of
ele
me
nts
th
at
are
se
ma
nti
ca
lly c
los
e t
o o
ne
an
oth
er.
•S
urr
ou
nd
“c
lum
ps
”w
ith
a p
ac
ka
ge
. H
igh c
ohesio
n &
hig
h c
oupling
•Id
en
tify
pu
blic
ele
me
nts
of
ea
ch
pa
ck
ag
e.
•Id
en
tify
im
po
rt d
ep
en
de
nc
ies
.
utd.administration
Tools.db
registration
db interfaces
Cloudscape
OracleJava.awt
Use Case package Diagram
•In
clu
de
d a
nd
ex
ten
din
g u
se
ca
se
s b
elo
ng
in
th
e s
am
e
pa
ck
ag
e a
s t
he
pa
ren
t/b
as
e u
se
ca
se
•C
oh
es
ive
, a
nd
go
al-
ori
en
ted
pa
ck
ag
ing
•A
cto
rs c
ou
ld b
e i
ns
ide
or
ou
tsid
e e
ac
h p
ac
ka
ge
©L
aw
ren
ce
Ch
un
g6
0
Class Package Diagrams
(htt
p:/
/ww
w.a
gile
mo
de
ling
.co
m/a
rtif
ac
ts/p
ac
ka
ge
Dia
gra
m.h
tm)
•C
las
se
s r
ela
ted
th
rou
gh
in
he
rita
nc
e,
co
mp
os
itio
n o
r c
om
mu
nic
ati
on
o
fte
n b
elo
ng
in
th
e s
am
e p
ac
ka
ge
Seminar
Registration
<<application>>
Schedule
Student
Professor
Java
Infrastructure
<<technical>>
<<im
port
>>
Contact
Point
<<im
port
>>
<<im
port
>>
<<im
port
>>
<<im
port
>>
•A
fra
me
de
pic
ts t
he
co
nte
nts
of
a p
ac
ka
ge
(o
r c
om
po
ne
nts
, c
las
se
s,
op
era
tio
ns
, e
tc.)
•H
ea
din
g:
rec
tan
gle
wit
h a
cu
t-o
ff b
ott
om
-rig
ht
co
rne
r, [
kin
d]
na
me
[p
ara
me
ter]
Se
min
ar
Co
urs
e
En
rollm
en
tL
oc
ati
on
Tim
e
1
0..
*
1..
*1
1..
*
1
he
ld a
t
Pa
ck
ag
e S
ch
ed
ule
A f
ram
e e
nc
ap
su
late
s
a c
olle
cti
on
of
co
llab
ora
tin
g i
ns
tan
ce
s o
r
refe
rs t
o a
no
the
r re
pre
se
nta
tio
n o
f s
uc
h
©L
aw
ren
ce
Ch
un
g6
1
Common Mechanisms
•Ad
orn
me
nts
No
tes
& C
om
pa
rtm
en
ts
•Ex
ten
sib
ility
Me
ch
an
ism
s
–S
tere
oty
pe
s -
Ex
ten
sio
n o
f th
e U
ML
me
tac
las
se
s.
–T
ag
ge
d V
alu
es
-E
xte
ns
ion
of
the
pro
pe
rtie
s o
f a
UM
L e
lem
en
t.
–C
on
str
ain
ts -
Ex
ten
sio
n o
f th
e s
em
an
tic
s o
f a
UM
L e
lem
en
t.
©L
aw
ren
ce
Ch
un
g6
2
Ad
orn
me
nts
•T
ex
tua
l o
r g
rap
hic
al
ite
ms
ad
de
d t
o a
n e
lem
en
t’s
ba
sic
no
tati
on
.
•N
ote
s-
Gra
ph
ica
l s
ym
bo
l fo
r re
nd
eri
ng
co
ns
tra
ints
or
co
mm
en
ts a
tta
ch
ed
to a
n
ele
me
nt
or
co
llec
tio
n o
f e
lem
en
ts;
No
Se
ma
nti
c I
mp
ac
t
Ren
der
ed a
s a
rect
angle
with a
dog-e
ared
corn
er.
See
sm
artC
ard.d
oc
for
det
ails
about th
is routine.
May c
onta
in c
om
bin
ation o
f
text and g
raphic
s.
May c
onta
in U
RLs lin
kin
g
to e
xte
rnal docum
ents
.
See
http://w
ww
.rat
ional
.com
for re
late
d info
.
Ad
dit
ion
al
Ad
orn
me
nts
•P
lac
ed
ne
ar
the
ele
me
nt
as
–T
ex
t
–G
rap
hic
•S
pe
cia
l c
om
pa
rtm
en
ts f
or
ad
orn
me
nts
in
–C
las
se
s
–C
om
po
ne
nts
–N
od
es
Transaction
Exceptions
addAction()
Resource Locked
named
compartment
anonym
ous
compartment
Client
bill.exe
report.exe
contacts.exe
©L
aw
ren
ce
Ch
un
g6
3
Ste
reo
typ
es
•A
llow
co
ntr
olle
d e
xte
ns
ion
of
me
tam
od
el
cla
ss
es
. [U
ML
11
_M
eta
mo
de
l_D
iag
ram
s.p
df]
•G
rap
hic
ally
re
nd
ere
d a
s–
Na
me
en
clo
se
d i
n g
uill
em
ets
(<<
>>
)
•<
<s
tere
oty
pe
>>
–N
ew
ic
on
«metaclass»
ModelElement
Internet
•T
he
ne
w b
uild
ing
blo
ck
ca
n h
av
e
•it
s o
wn
sp
ec
ial
pro
pe
rtie
s t
hro
ug
h a
se
t o
f ta
gg
ed
va
lue
s
•it
s o
wn
se
ma
nti
cs
th
rou
gh
co
ns
tra
ints
•M
ec
ha
nis
ms
fo
r e
xte
nd
ing
th
e U
ML
vo
ca
bu
lary
.
•A
llow
s f
or
ne
w m
od
elin
g b
uild
ing
blo
ck
s o
r p
art
s.
©L
aw
ren
ce
Ch
un
g6
4
Ta
gg
ed
Va
lue
s
Server
{channels = 3}
<<library>>
accounts.dll
{customerOnly}
tagged v
alu
es
•a
(n
am
e,
va
lue
) p
air
de
sc
rib
es
a p
rop
ert
yo
f a
mo
de
l
ele
me
nt.
•P
rop
ert
ies
allo
w t
he
ex
ten
sio
n o
f “m
eta
model”
ele
me
nt
att
rib
ute
s.
•m
od
ifie
s t
he
se
ma
nti
cs
of
the
ele
me
nt
to w
hic
h i
t re
late
s.
•R
en
de
red
as
a t
ex
t s
trin
g e
nc
los
ed
in
bra
ce
s {
}
•P
lac
ed
be
low
th
e n
am
e o
f a
no
the
r e
lem
en
t. «subsystem»
AccountsPayable
{ dueDate = 12/30/2002
status = unpaid }
©L
aw
ren
ce
Ch
un
g6
5
Constraints
Portfolio
BankAccount
{secure}
A s
imple
constr
ain
t
•E
xte
ns
ion
of
the
se
ma
nti
cs
of
a U
ML
ele
me
nt.
•A
llow
s n
ew
or
mo
dif
ied
ru
les
•R
en
de
red
in
bra
ce
s {
}.
–In
form
ally
as
fre
e-f
orm
te
xt,
or
–F
orm
ally
in
UM
L’s
Ob
jec
t C
on
str
ain
t L
an
gu
ag
e (
OC
L):
E.g
., {
se
lf.w
ife
.ge
nd
er
= f
em
ale
an
d s
elf
.hu
sb
an
d.g
en
de
r =
ma
le}
Constr
ain
t acro
ss m
ultip
le e
lem
ents
Corporation
BankAccount
{or} Person
id : {SSN, passport}
Department
Person*
*
1..*
1member
manager
{subset}
Person
age:
Inte
ger
Company
emplo
yer
sem
plo
yee
s
0..*
0..*
Company
self.employees.forAll(Person p |
p.age >= 18 and p.age <= 65)
©L
aw
ren
ce
Ch
un
g6
6
Appendix
Some Additional Material
©L
aw
ren
ce
Ch
un
g6
7
Classes: Notation and Semantics
Class -Name
attribute-name-1 : data-type-1 = default-value-1
attribute-name-2 : data-type-2 = default-value-2
operation-name-1 ( argument-list-1) : result-type-1
operation-name-2 ( argument-list-2) : result-type-2
responsibilities
To model the <<semantics>> (meaning) of a class:
�Spec
ify the
body o
f ea
ch m
ethod (pre
-/post-c
onditio
ns an
d invar
iants)
�Spec
ify the
stat
e m
achin
e fo
r th
e cl
ass
�Spec
ify the
collab
ora
tion for th
e cl
ass
�S
pe
cif
y t
he
re
sp
on
sib
iliti
es
(c
on
tra
ct)
©L
aw
ren
ce
Ch
un
g6
8
Attributes
•Synta
x[ vis
ibility ] n
am
e [ m
ultip
lici
ty ] [ : type
] [ = initia
l-val
ue
] [ {pro
per
ty-s
trin
g }
]
•V
isib
ility
+public;
-privat
e; #
pro
tect
ed; {def
ault =
+}
•ty
pe
–Ther
e ar
e se
ver
al d
efin
ed in R
atio
nal
Rose
.
–Y
ou c
an d
efin
e your ow
n.
•pro
per
ty-s
trin
gBuilt-in
pro
per
ty-s
trin
gs:
–changeable
—no res
tric
tions (d
efau
lt)
–addOnly
—val
ues
may
not be
rem
oved
or al
tere
d, but m
ay b
e ad
ded
–frozen—
may
not be
chan
ged
after
initia
liza
tion
Or you c
an d
efin
e your ow
n: e.
g. {le
af}
Na
me
an
d p
rop
ert
yid
: I
nte
ge
r {
fro
ze
n }
Na
me
, ty
pe
, a
nd
in
itia
l v
alu
eo
rig
in :
Po
int
= {
0,
0 }
Na
me
, m
ult
iplic
ity
, a
nd
ty
pe
na
me
[ 0
..1
] :
Str
ing
Na
me
an
d c
om
ple
x t
yp
eh
ea
d :
*It
em
Na
me
an
d t
yp
eo
rig
in :
Po
int
Vis
ibili
ty a
nd
na
me
+ o
rig
in
Na
me
on
lyo
rig
in
©L
aw
ren
ce
Ch
un
g6
9
Operations
•Synta
x[ visib
ility ] n
ame
[ (p
aram
eter
-list ) ] [ : re
turn
-type
] [ (p
roper
ty-s
trin
g) ]
•V
isib
ility
+public;
-privat
e; #
pro
tect
ed; {def
ault =
+}
•par
amet
er-list sy
nta
x[ direc
tion ] n
ame
: ty
pe
[ = d
efau
lt-v
alue
]
•direc
tion
–in
—in
put par
amet
er; m
ay n
ot be
modifie
d
–out—
outp
ut par
amet
er; m
ay b
e m
odifie
d
–inout—
input par
amet
er; m
ay b
e m
odifie
d
•pro
per
ty-s
trin
g–
leaf
–isQuery—
stat
e is
not af
fect
ed
–sequential—
not th
read
saf
e
–guarded
—th
read
saf
e (J
ava
synch
roniz
ed)
–concurrent—
typic
ally
ato
mic
; sa
fe for m
ultip
le flo
ws of co
ntrol
©L
aw
ren
ce
Ch
un
g7
0
Template Classes
; P
rim
itiv
e T
yp
es
•A
te
mp
late
cla
ss
is
a p
ara
me
teri
ze
d e
lem
en
t a
nd
de
fin
es
a f
am
ily o
f c
las
se
s
•In
ord
er
to u
se
a t
em
pla
te c
las
s,
it h
as
to
be
in
sta
nti
ate
d
•In
sta
nti
ati
on
in
vo
lve
s b
ind
ing
fo
rma
l te
mp
late
pa
ram
ete
rs t
o a
ctu
al
on
es
, re
su
ltin
g i
n a
c
on
cre
te c
las
s
+ b
ind
( in
i :
Ite
m;
in v
: V
alu
e )
: B
oo
lea
n+
is
Bo
un
d(
in i
: I
tem
) :
Bo
ole
an
{is
Qu
ery
}
Ma
p
Item
Value
Buckets : int
Ma
p<
Cu
sto
me
r, O
rde
r, 3
>
Ord
erM
ap
<<
bin
d>
> (
Cu
sto
me
r, O
rde
r, 3
)
explicit b
indin
g
implicit b
indin
g
tem
pla
te c
lass
tem
pla
te p
ara
mete
rs
Uses <<bind>>
Item
Value
Buckets
Primitive Types
using a class
notation
<<enumeration>>
Boolean
false
true
<<dataType>>
Int
{ value range
–2**31 to +2**31-1
}
const
rain
t
ster
eoty
pe
©L
aw
ren
ce
Ch
un
g7
1
Interface: A Java Example
pu
blic
in
terf
ac
e S
ou
nd
Fro
mS
pa
ce
Lis
ten
er
ex
ten
ds
Ev
en
tLis
ten
er
{
vo
id h
an
dle
So
un
dF
rom
Sp
ac
e(S
ou
nd
Fro
mS
pa
ce
Ev
en
tOb
jec
t s
fse
o);
} pu
blic
cla
ss
Sp
ac
eO
bs
erv
ato
ry i
mp
lem
en
ts S
ou
nd
Fro
mS
pa
ce
Lis
ten
er
pu
blic
vo
id h
an
dle
So
un
dF
rom
Sp
ac
e(S
ou
nd
Fro
mS
pa
ce
Ev
en
tOb
jec
t s
fse
o)
{
so
un
dD
ete
cte
d =
tru
e;
ca
llFo
rPre
ss
Co
nfe
ren
ce
();
}
Can y
ou d
raw
a U
ML d
iagra
m c
orr
espondin
g to this
?
©L
aw
ren
ce
Ch
un
g7
2
Package Diagrams: Standard Elements
•Façade
—o
nly
a v
iew
on
so
me
oth
er
pa
ck
ag
e.
•Framework
—p
ac
ka
ge
co
ns
isti
ng
ma
inly
of
pa
tte
rns
.
•Stub
—a
pa
ck
ag
e t
ha
t s
erv
es
as
a p
rox
y f
or
the
pu
blic
c
on
ten
ts o
f a
no
the
r p
ac
ka
ge
.
•Subsystem
—a
pa
ck
ag
e r
ep
res
en
tin
g a
n i
nd
ep
en
de
nt
pa
rt o
f th
e s
ys
tem
be
ing
mo
de
led
.
•System
—a
pa
ck
ag
e r
ep
res
en
tin
g t
he
en
tire
sy
ste
m
be
ing
mo
de
led
.
Is <
<im
port
>> tra
nsitiv
e?
Is v
isib
ility tra
nsitiv
e?
Does <
<fr
iend>> a
pply
to a
ll types o
f vis
ibility: +, -, #
?
©L
aw
ren
ce
Ch
un
g7
3
Dependency –Among Objects
•3
Ste
reo
typ
es
of
De
pe
nd
en
cy
in
In
tera
cti
on
s a
mo
ng
Ob
jec
ts:
–become
: th
e t
arg
et
is t
he
sa
me
ob
jec
t a
s t
he
so
urc
e b
ut
at
a l
ate
r p
oin
t in
tim
e a
nd
wit
h p
os
sib
ly d
iffe
ren
t v
alu
es
, s
tate
, o
r ro
les
–call:
th
e s
ou
rce
op
era
tio
n i
nv
ok
es
th
e t
arg
et
op
era
tio
n
–copy
: th
e t
arg
et
ob
jec
t is
an
ex
ac
t, b
ut
ind
ep
en
de
nt,
co
py
of
the
so
urc
e