Sie sind auf Seite 1von 22

TheUni

ver
si
tyofI
owa
CS:2820 (22C:22)

Object-Oriented Software Development


S
pri
ng2
015

TheDomai
nMode
l
by
Mauricio Monsalve
De
sig
nroad
● Be
ginni
ngt
hede
sig
n
● DomainModel
des
cri
besthe
domai
n(cont
ext
)
● I
tisf
oll
owedb yt
he
Sy
ste
mS yste
m
Di
agram(s
)
● The
nf ol
l
owst
heOO
Des
ignModel
(
s)
Domai
nMode
l
Vis
ualrepr
esentati
onofconcept
ual
cl
assesorr
eal-s
ituat
ionobj
ectsi
na
domain
● Theobj
ect
s(c
once
ptualcl
ass
es)oft
he
domai
narenots
oftwar
eobject
s(cl
ass
es)
● I
nUML,theDomainModeli
sil
l
ust
rat
edwit
ha
etofc
s lassdi
agr
amswithoutmethods
● Al
soknownasVi
sua
lDi
ct
ion
ary
● P
erhapsmos
tes
sent
ial
diag
ram
Domai
nMode
l
● Conc
ept
ualc
las
s:i
dea,t
hing
,obj
ect
● I
tma ybecons
idere
dinte
rmsof
– S
ymbol—wor dsori
magesr
epr
ese
nti
ngt
he
c
oncept
ualcl
ass
● Vi
sua
lde
pic
ti
on,d
iag
ram
– I
ntensi hede
on—t -ni
ti
onoft
hec
onc
ept
ual
c
lass
● Co
mpr
ehe
nsi
ved
e⇠n
iti
on
– Extensi
on—thesetofexampl
est
owhi
cht
he
concept
ual
clas
sappl
ies
● Ex
ten
siv
ede
⇠ni
ti
on
Domai
nMode
l
Domai
nMode
l
● Conc
ept
ualc
las
sesonl
y!
● Notindomai
nmodel
– Sof
twar
eart
if
act
s
● Wi
ndo
ws,d
ata
bas
es,e
tc.
● Un
les
sdo
mai
niss
oft
war
e
– Re
spons
ibi
l
it
iesorme
thods
● Th
eya
repa
rto
fth
ede
sig
nan
dth
eso
ftwa
re
Dr
awi
ngt
heDM

Conc eptshave
namesand
attr
ibutes
(s
omet imes),but
notmet hods
Dr
awi
ngt
heDM
Dr
awi
ngt
heDM
zero or more;
* T
"many"
Associ
ati
onss
houl
dhave
speci
$cnames—andsocl
ass
es
1..*
T one or more

has
”isab
adn
ame
!

1..40 Mult
ipl
i
cityshouldbekept
T one to 40
si
mpleatthi
ss tagethoug
h;
conc
eptualmodelingdœsnot
5 needtobeaspr ecis
e
T exactly 5

3, 5, 8
T exactly 3, 5, or 8
Dr
awi
ngt
heDM
Cl
ass
esal
soi
ncl
udeat
tri
but
esr
elevantt
othedomai
n

At
tri
butedshoul
dha vesi
mplet ypes(
number
s,t
ext
,bool
eans
,et
c.)
—thi
sisno
tsorel
eva
nta tt
hiss
tag
e ,t
hou
gh

Theysomet
imesc
anbe“ deri
ved”
,meani ngt
hattheycanbei
nfer
red,by
meansofafor
mula,f
rom ot
heratt
ribut
esorassoci
ati
ons

Sale Math Person

- dateTime : Date + pi : Real = 3.14 {readOnly} firstName


- / total : Money middleName : [0..1]
lastName

Private visibility Public visibility readonly


attributes attribute with initialization Optional value
Dr
awi
ngt
heDM
Exampl
eofas
soc
iat
ionandder
ivedat
tri
but
e

SalesLineItem Item Each line item records a


0..1 Records-sale-of 1
separate item sale.
For example, 1 tofu package.

SalesLineItem Item
0..1 Records-sale-of 1..* Each line item can record a
group of the same kind of items.
For example, 6 tofu packages.

SalesLineItem Item
0..1 Records-sale-of 1..*
/quantity

derived attribute from


the multiplicity value
Dr
awi
ngt
heDM
● Pi
ckex
act
,spe
ci-
cnamesf
orobj
ect
s,as
soc
iat
ions
,et
c
● At
tri
but
ess
houl
dha
vet
ri
vi
alt
ypes(
number
s,t
ext
,et
c)
● Kee
pthemos
trel
evantas
soc
iat
ionsi
ntheDM
● Encapsulaton—don'
i tc
onnecteveryt
hingt
o
ever
ything!
– Objectsshoul
dha
vestrongi
nternal
cohesi
on
(
attri
butes)
– Objec
tsshoul
dbeas
soc
iat
edt
ofe
wot
herobj
ect
s
(
lo
wc oupli
ng)
● Pr
obl
em:wher
edoweg
etourobj
ect
sfr
om?
Ge
tti
ngt
hec
onc
ept
s
● Reuseexi
st
ingmodel
s
– Copyoradaptex
ist
ing
,we
llac
cept
edmode
ls
– Us
eex
ist
ingDM whe
nmodi
f
yingas
yst
em
● Cat
egoryl
i
sts
– T
able9.
1inbook
● I
denti
fynounphrases(
eas
y!)
– Pi
cknouns,e
ve nt
s
– F
ull
ydr
ess
edus
ecas
esar
egr
eats
our
ce
– e:na
Bewar tur
all
ang
uag
eisi
mpr
eci
se
Ge
tti
ngmor
econc
ept
s
Cashier
Worse a "simple" attribute, but being
name used as a foreign key to relate to
currentRegisterNumber another object

Cashier Register
Better 1 Works-on 1
name number


Forei
gnkeys”i
denti
fyot
herconc
ept
s.“
Keys
”ar
eident
i$er
s;t
heyhol
da
1
-to-
1rel
ati
onwithanobjec
t
Ge
tti
ngmor
econc
ept
s

Item

description Worse
price
serial number
itemID

Anot
herf
orei
gnkeyexampl
e

ProductDescription
Item
description Describes Better
price 1 * serial number
itemID
Ge
tti
ngmor
econc
ept
s
Flight
Airport
date Flies-to Worse
number 1 name
time *

Associ
ati
onsshouldnothaveat
tri
but
es;i
fonedœs
have,t
henc hancesar
eitisanobj
ect

Flight
FlightDescription Better
Described-by
date
time * 1 number

*
Describes-flights-to
1

Airport

name
Ge
tti
ngmor
econc
ept
s
ItemID Address

Product 1 1 1 1 street1
OK id Store
Description street2
manufacturerCode
countryCode cityName
...

Product Store
Description
OK address : Address
itemId : ItemID

New obj
ect
sar
econdi
ti
onalt
other
elevanc
eto
themodel

Al
so,c
ompos
itedat
atypesmaybeobj
ect
s
Ge
tti
ngmor
econc
ept
s
Payment
not useful
amount : Number

Payment Quantity Unit


Has-amount Is-in
1 1
* amount : Number * ...

Payment quantities are pure data


values, so are suitable to
amount : Quantity better
show in attribute section

Payment variation: Money is a


specialized Quantity whose
amount : Money unit is a currency
Ne
xtGe
nex
ampl
e Records-sale-of

Product
Ledger Product Description
Catalog Contains
1 itemID
1..*
description
1 1
1 price
0..1 Records-
Used-by Describes
accounts-
Sales for * *
LineItem Store
Item
Stocks
quantity name
1
address
1
* 1..*
1..*
1
Contained-in Logs- Houses
1 completed 1..*

Sale * Register

dateTime Captured-on id
0..1 1
/ total
1
1 1
Is-for  Works-on
Paid-by

1 1 1

CashPayment Customer Cashier

amountTendered id
De
sig
nMode
l(l
at
er)
● Wewillus
eadetai
l
edClas
sDi
agr
am t
o
de
scr
ibetheDe
signModel
● Wewi l
lev
olv
eandi
nf
erOOc
las
sesf
rom t
he
conc
epts
● Wemi
ghtdr
opc
onc
ept
saswe
ll
● Ot
herc
las
seswi
l
lcomef
rom s
yst
em ne
eds
● Theas
soc
iat
ionswi
l
lbemuc
hmor
espe
ci-
c
● Codecanbepar
ti
al
lyi
nf
err
edf
rom De
sig
n
Model
Thoug
hts
● Nos
ing
lec
orr
ectans
wer
—noe
xac
tsc
ien
cee
it
her
!
● I
tmi
ghtt
aket
obe
comef
ami
l
iarwi
tht
hei
deas
● I
tmaybeg
oodt
ost
artwi
thas
impl
edomai
n
mode
l
● The
n,c
hec
kwha
tiswr
ong
—-x
● F
ixi
ngma
yaddc
ompone
nts
● I
ter
ateunt
ilg
oodqual
i
ty
● Don'
tconne
ctal
ltoal
l
!
Cr
edi
ts

Not
esand-
gur
esadapt
edf
rom
Appl
yi
ngUMLa ndPat
ter
ns:AnIntr
odu
cti
ont
o
Obj
ect-
Ori
ent
edAnal
ysi
sandDe si
gnand
I
ter
ati
veDeve
lopmen
tbyC.Lar man.3r
d
edi
ti
on.Pr
enti
ceHal
l/
Pearson,2
005.

Das könnte Ihnen auch gefallen