Object Oriented Analysis and Design Class Notes
Object Oriented Analysis and Design Class Notes
Obj
ectOr
ient
edAnal
ysi
s&Desi
gn
ABr
iefHi
stor
y
The obj
ect
-or
ient
ed paradi
gm took i
ts shape f
rom t
he i
nit
ialconceptofa new
progr
ammingapproach,whi
let
heinter
estindesi
gnandanal
ysi
smet hodscamemuch
l
ater.
Thefi
rstobject
–orientedl anguagewasSi mula(Simulationofr ealsystems)that
wasdevelopedin1960byr esearchersatt heNorwegianComput i
ngCent er.
In1970,AlanKayandhi sr esearchgr oupatXer oxPARKcr eatedaper sonal
computernamed Dy nabookand t hef irstpureobj ect-ori
ented programmi ng
l
anguage( OOPL)-Smal ltalk,forprogrammi ngtheDy nabook.
Int
he1980s,Gr adyBoochpubl i
shedapapert i
tl
edObj ectOr i
entedDesi gnthat
mainl
ypresentedadesi gnf ort hepr ogrammi nglanguage,Ada.I ntheensui ng
edi
ti
ons,heextendedhi sideast oacompl et
eobject–orienteddesignmet hod.
Int
he1990s, Coadincorpor atedbehav iorali
deastoobj ect-or
ientedmet hods.
Theot
hersigni
fi
canti
nnovat
ionswereObj
ectModelli
ngTechniques(OMT)byJames
RumbaughandObject
-Or
ient
edSoftwar
eEngineer
ing(OOSE)byIvarJacobson.
Obj
ect
-Or
ient
edAnal
ysi
s
Object–Or
ient
edAnal
ysis(
OOA)ist heprocedureofi dent
if
yingsof
twar
eengi
neeri
ng
requir
ementsanddev
elopi
ngsoft
war especi
fi
cationsinter
msofasof twar
esyst
em’s
objectmodel,
whi
chcompri
sesofi
nteract
ingobjects.
Themai ndi ff
erencebetweenobj ect-
ori
entedanal
ysi
sandot herfor
msofanal ysi
sis
thatinobj ect-
ori
entedappr oach,requir
ementsareor gani
zedar oundobjects,which
i
ntegrat
ebot hdataandf unctions.Theyaremodelledafterreal
-worl
dobjectsthatthe
system i
nteractswith.I
ntradit
ionalanaly
sismethodol
ogies,t
het woaspects-functi
ons
anddata-ar econsideredsepar at
ely.
Gr
adyBoochhasdef
i “
nedOOAas,Obj
ect
-or
ient
edanal
ysi
sisamet
hodofanal
ysi
sthat
examinesrequir
ement
sfr
om theperspect
iveoft
hecl
assesandobj
ect
sfoundi
nthe
vocabul
aryofthepr
obl
em domai
n”.
Thepr
imar
ytasksi
nobj
ect
-or
ient
edanal
ysi
s(OOA)ar
e:
I
dentif
y i
ngobject
s
Organizi
ngtheobjectsbycreati
ngobjectmodel di
agram
Defi
ningtheinter
nalsoftheobjects,
orobjectatt
ri
butes
Defi
ningthebehav i
oroftheobjects,
i.
e.,
objectacti
ons
Descri
binghowt heobjectsi
nteract
Page1of1
Thecommonmodel
susedi
nOOAar
eusecasesand
obj
ectmodel
s.
Obj
ect
-Or
ient
edDesi
gn
Obj
ect–Ori
ented Design (OOD)i nvolv
es implementat
ion oft he conceptualmodel
pr
oducedduringobject-
ori
entedanalysi
s.InOOD,conceptsi
nt heanal ysi
smodel,which
ar
etechnology−i
ndependent,aremappedont oimplementi
ngcl asses,constrai
ntsare
i
dent
if
iedandi nt
erfacesaredesigned,resul
ti
nginamodelf orthesol uti
ondomain,i
.e.
,
adet
aileddescri
pti
onof how thesyst
em istobebuil
tonconcretet echnologi
es.
Thei
mpl
ement
ati
ondet
ail
sgener
all
yincl
ude:
Rest
ruct
uri
ngthecl
assdata(ifnecessar
y )
,
I
mplementati
onofmethods,i
.e.
,int
ernaldatast
ruct
uresandal
gor
it
hms,
I
mplementati
onofcontr
ol,
and
I
mplementati
onofassoci
ati
ons.
Gr
adyBoochhasdef
inedobj
ect
-or
ient gnas“
eddesi amet
hodofdesi
gnencompassi
ng
thepr
ocessofobject-
ori
ent
eddecomposi
ti
onandanotat
ionfordepi
cti
ngbothl
ogi
cal
andphysi
calaswellasst
ati
canddynami
cmodelsoft
hesyst
em underdesi
gn”
.
Obj
ect
-Or
ient
edPr
ogr
ammi
ng
Object
-or
ientedprogrammi ng
(OOP)isa programmingpar adi
gm baseduponobjects
(havi
ngbothdat aandmet hods)thatai
mstoi ncor
porat
et headvant
agesofmodulari
ty
andreusabil
i
t y
.Object
s,whichareusual
lyi
nstancesofclasses,
areusedtoi
nter
actwit
h
oneanothertodesignappl
icati
onsandcomput erprogr
ams.
Thei
mpor
tantf
eat
uresofobj
ect
–or
ient
edpr
ogr
ammi
ngar
e:
Someexampl
esofobject
-or
ient
edprogr
ammi
ngl
anguagesar
eC++,Jav
a,Smal
l
tal
k,
Del
phi
,C#,
Per
l,Py
thon,
Ruby,andPHP.
Gr
ady Booch has def
ined obj
ect
–or
ient
ed pr
ogr ng as “
ammi a met
hod of
i
mplementat
ioninwhichprogramsar eorgani
zedascooperat
ivecol
lect
ionsofobj
ect
s,
each ofwhi
ch repr
esentsan i nst
anceofsomecl ass,and whosecl assesar
eall
membersofahierar
chyofclassesunitedvi
ainher
it
ancerel
ati
onshi
ps”.
Page2of2
OOAD-Obj
ectModel
Theobj
ectmodel
visual
izestheel
ementsinasoft
wareappli
cat
ioni
ntermsofobj
ect
s.
I
nt hi
s chapter
,we wi l
llook i
nto the basi
c concept
s and ter
minol
ogi
es of
obj
ect
–ori
ent
edsy stems.
Obj
ect
sandCl
asses
Theconceptsofobj
ect
sandclassesar
eint
ri
nsi
cal
l
yli
nkedwi
theachot
herandf
orm
thef
oundati
onofobj
ect
–or
ient
edparadi
gm.
Obj
ect
Anobjectisareal-
worl
delementi nanobject–or
ient
edenv
ironmentt
hatmayhav
ea
phy
sicaloraconcept
ualexi
stence.Eachobj
ecthas:
I
dent i
tyt
hatdisti
nguishesitfr
om otherobject
sint hesy
stem.
Statethatdeterminesthechar act
eristi
cpropert
iesofanobjectaswel
last he
valuesoftheproperti
esthattheobjectholds.
Behaviorthatrepresentsexternal
l
yv isi
bleacti
vi
tiesperf
ormedbyanobjectin
termsofchangesi nitsstat
e.
Objectscanbemodel l
edaccor
dingt
ot heneedsoftheappli
cat
ion.Anobj
ectmayhav e
aphy si
calexi
stence,li
keacustomer,acar,et
c.;orani
ntangi
bleconcept
ualexi
stence,
l
ikeapr oj
ect,
apr ocess,et
c.
Cl
ass
Theconst
it
uent
sofacl
assar
e:
Asetofat t
ri
butesfort heobjectst hataretobei nstanti
atedfrom theclass.
General
ly,di
ff
erentobjectsofacl asshav esomedi f
ferenceinthevaluesofthe
at
tri
butes.Att
ri
butesareof tenr
eferredasclassdat a.
As etofoper ations t
hatpor tr
ayt he behav
ioroft he object
s oft he cl
ass.
Operati
onsarealsoreferredasfunctionsormet hods.
Exampl
e
Page3of3
Letusconsi
derasimpleclass,Cir
cle,t
hatrepr
esentsthegeometri
calf
igur
ecir
clei
na
two–di
mensional
space.Theattri
butesofthi
sclasscanbeident
if
iedasfoll
ows:
x–coor
d,t
odenotex–coor
dinat
eofthecent
er
y–coor
d,t
odenotey–coor
dinat
eofthecent
er
a,t
odenotet
heradi
usofthecir
cle
Someofi
tsoper
ati
onscanbedef
inedasf
oll
ows:
fi
ndArea()
,met hodtocalcul
atearea
fi
ndCir
cumf erence(
),methodtocalculat
ecir
cumference
scal
e(),methodt oi
ncreaseordecreasetheradi
us
Dur
ingi nstant
iation, v
aluesareassignedforatleastsomeoft heatt
ri
butes.Ifwecreate
anobjectmy _
circle,wecanassi gnv al
uesli
kex- coor
d:2, y
-coord:3,anda:4t odepict
i
tsstate.Now, i
ftheoper ati
onscale()isper
formedonmy _cir
clewit
hascal i
ngfact
orof
2,t
hev alueoft hev ari
ableawil
lbecome8.Thi soperati
onbr i
ngsachangei nthestate
ofmy _
ci r
cle,i
.e.
,t heobjecthasexhibit
edcertai
nbehav i
or.
Encapsul
ati
onandDat
aHi
ding
Encapsul
ati
on
Encapsulati
oni stheprocessofbi
ndingbothatt
ri
butesandmet hodstoget
herwit
hina
class.Throughencapsulati
on,t
hei
nternal
detai
l
sofacl asscanbehiddenfr
om out
side.
Itpermitst heelementsoft hecl
asst obeaccessedf rom out
sideonlythr
oughthe
i
nt er
faceprovidedbytheclass.
Dat
aHi
ding
Typical
ly,
acl assi
sdesignedsucht hatitsdata(at
tr
ibut
es)canbeaccessedonlybyi
ts
cl
assmet hodsandinsul
atedfrom directoutsi
deaccess.Thi
sprocessofinsul
ati
ngan
object’
sdataiscal
leddatahidi
ngori nfor
mat i
onhidi
ng.
Exampl
e
I
ntheclassCir
cle,dat
ahi
dingcanbeincor
por
atedbymakingatt
ri
butesinv
isi
blefr
om
out
sidethecl
assandaddi
ngt womoremethodstothecl
assforaccessi
ngclassdata,
namely:
set
Val
ues(
),met
hodt
oassi
gnvaluestox-coord,y
-coord,anda
get
Val
ues(
),met
hodt
oret
ri
evevaluesofx-coord,
y-coord,anda
Her
ethepri
vatedataoftheobj
ectmy_ci
rcl
ecannotbeaccesseddi
rect
lybyanymethod
t
hatisnotencapsul
atedwit
hinthecl
assCircl
e.I
tshoul
dinsteadbeaccessedt
hrough
Page4of4
t
hemet
hodsset
Val
ues(
)andget
Val
ues(
).
MessagePassi
ng
Anyappli
cat
ionr equi
resanumberofobj ect
si nt
eract
inginahar moniousmanner .
Object
sin a system maycommuni cate wit
h each otherusing message passi
ng.
Supposeasystem hastwoobject
s:obj
1andobj 2.Theobjectobj
1sendsamessaget o
obj
ectobj
2,i
fobj1want sobj
2toexecut
eoneofi tsmethods.
Thef
eat
uresofmessagepassi
ngar
e:
Messagepassi
ngbetweentwoobj ect
sisgeneral
lyuni
dir
ecti
onal.
Messagepassi
ngenablesall
int
eracti
onsbetweenobject
s.
Messagepassi
ngessenti
all
yinv
olvesinvoki
ngclassmethods.
Obj
ectsi
ndiff
erentpr
ocessescanbei nv
olvedi
nmessagepassi ng.
I
nher
it
ance
Inheri
tanceist hemechani sm t hatpermi t
snew cl assestobecr eatedoutofexi st
ing
classesbyext endingandr efiningitscapabi l
it
ies.Theexistingclassesarecall
edt he
basecl asses/par entclasses/ super -
classes,andt henewcl assesarecall
edtheder i
ved
classes/chil
dcl asses/subcl asses.Thesubcl asscani nheri
torderivetheatt
ri
butesand
met hodsoft hesuper -class(es)pr ovidedt hatthesuper -
classall
owsso.Besi des,the
subclassmayaddi tsownat tri
butesandmet hodsandmaymodi fyanyoft hesuper-
classmet hods.I nheri
tancedef inesan“ is–a”r elati
onshi
p.
Exampl
e
Ty
pesofI
nher
it
ance:
SingleInher i
tance: Asubclassder i
vesfr
om asi ngl
esuper -
class.
Mul t
ipleI nher i
tance: Asubclassderiv
esf r
om mor ethanonesuper -classes.
Mul t
ilevelI nheritance:Asubcl assderi
vesf rom asuper-classwhi chint ur
nis
derivedf rom anot herclassandsoon.
HierarchicalI nher i
tance:Acl asshasanumberofsubcl asseseachofwhi ch
mayhav esubsequentsubcl asses,continuingforanumberofl evels,soast o
form at reest ructure.
Hy br
idInher i
tance:Acombi nat i
onofmul t
ipleandmul t
il
evelinher
it
ancesoast o
form alat ti
cest ructure.
Page5of5
Thef
oll
owi
ngf
igur
edepi
ctst
heexampl
esofdi
ff
erentt
ypesofi
nher
it
ance.
Pol
ymor
phi
sm
Pol
ymor
phi
sm i
sor
igi
nal
l
yaGr
eekwor
dthatmeanst
heabi
l
ityt
otakemul
ti
plef
orms.I
n
Page6of6
obj
ect-or i
entedparadi
gm,pol ymor phism impli
esusingoperati
onsindiffer
entways,
dependingupont heinstancet heyareoper at
ingupon.Poly
mor phi
sm al
lowsobject
s
wit
hdi f
f erenti
nter
nalstr
ucturestohav eacommonext er
nali
nterf
ace.Pol
ymorphi
sm i
s
part
icularl
yef f
ecti
vewhil
ei mplementinginheri
tance.
Exampl
e
Gener
ali
zat
ionandSpeci
ali
zat
ion
General
i
zati
on and speci
ali
zat
ion r
epresenta hi er
archy ofr
elat
ionshi
ps bet
ween
cl
asses,wher
esubcl
assesinher
itf
rom super-
classes.
Gener
ali
zat
ion
I
nt hegeneral
i
zati
onpr ocess,t hecommonchar act
eri
sti
csofclassesarecombinedt
o
form aclassinahi gherl evelofhi er
archy,i
.e.
,subcl
assesar ecombinedtoforma
general
i
zedsuper-cl
ass.Itr epresentsan“is–a–ki nd–of ”rel
ati
onshi
p.Forexampl
e,
“cari
sakindoflandv ehi
cle” ,
or“ shi
pisakindofwatervehi
cle”
.
Speci
ali
zat
ion
Special
i
zati
onisthereversepr
ocessofgenerali
zati
on.Here,thedisti
ngui
shingfeat
ures
ofgroupsofobject
sar eusedtoform speci
ali
zedclassesfrom existi
ngcl
asses.Itcan
besaidthatt
hesubclassesarethespeci
ali
zedversi
onsoft hesuper-cl
ass.
Thef
oll
owi
ngf
igur
eshowsanexampl
eofgener
ali
zat
ionandspeci
ali
zat
ion.
Page7of7
Li
nksandAssoci
ati
on
Li
nk
Ali
nkrepr
esentsaconnecti
onthr
oughwhichanobj ectcoll
aborateswithotherobjects.
Rumbaughhasdef i
neditas“aphy si
calorconceptualconnectionbetweenobj ects”.
Thr
oughalink,oneobj
ectmayinvokethemethodsornav i
gat
et hroughanotherobject.
Ali
nkdepi
ctstherel
ati
onshi
pbetweentwoormor eobjects.
Associ
ati
on
Associ
ati
on i
sa group oflinkshavi
ng common st
ruct
ure and common behav
ior
.
Associ
ati
ondepi
ctsther
elat
ionshi
pbetweenobj
ect
sofoneormor eclasses.Al
i
nkcan
bedefi
nedasaninst
anceofanassoci
ation.
Degr
eeofanAssoci
ati
on
Degr
eeofanassociat
iondenotesthenumberofcl
assesi
nvol
vedi
naconnect
ion.
Degr
eemaybeunar
y,binar
y,ort
ernar
y.
Aunaryr el
ationshi
pconnectsobj
ectsofthesamecl ass.
Abinaryrelati
onshipconnect
sobjectsoftwoclasses.
Aternaryrelati
onshi
pconnectsobjectsofthr
eeormor ecl
asses.
Car
dinal
it
yRat
iosofAssoci
ati
ons
Cardi
nal
it
yofabi nar
yassoci
ati
ondenotesthenumberofinst
ancespar
ti
cipat
ingi
nan
associ
ati
on.Ther
earethr
eetypesofcar
dinal
it
yrat
ios,
namely:
One–to–One:Asingleobj
ectofclassAi sassoci
atedwi
thasingl
eobjectof
cl
assB.
One–to–Many:Asingleobjectofcl
assAi sassoci
atedwi
thmanyobjectsof
cl
assB.
Many–to–Many:AnobjectofclassAmaybeassoci at
edwit
hmanyobjectsof
cl
assB andconversel
yanobj ectofclassB maybeassoci at
edwit
hmany
obj
ect
sofclassA.
Aggr
egat
ionorComposi
ti
on
Aggregat
ionorcomposi t
ioni sar elat
ionshi
pamongcl assesbywhi chacl asscanbe
madeupofanycombi nationofobj ectsofotherclasses.I
tall
owsobj ectstobepl aced
dir
ectl
ywi t
hint hebodyofot herclasses.Aggr egat
ionisreferr
edasa“ part–of”or
“has–a”relat
ionshi
p,wit
ht he abili
tyto navigatef r
om the wholet oi ts part
s.An
aggregat
eobjectisanobjectthatiscomposedofoneormor eotherobjects.
Page8of8
Exampl
e
I
nther
elat
ionship,“acarhas–amot or
”,cari
sthewhol
eobj
ectort
heaggr
egat
e,and
t
hemot
orisa“ part–of
”thecar.Aggr
egati
onmaydenot
e:
Physi
calcont ai
nment:Example,acomput eriscomposedofmoni
tor
,CPU,
mouse,keyboard,andsoon.
Conceptualcontai
nment:Exampl
e,shar
ehol
derhas–ashar
e.
Benef
it
sofObj
ectModel
Now t
hatwehav
egonet hroughthecoreconceptsper
tai
ningt
oobjector
ient
ati
on,i
t
woul
dbewort
hwhil
etonotetheadvant
agesthatt
hismodelhast
oof
fer.
Thebenef
it
sofusi
ngt
heobj
ectmodel
are:
Ithelpsinfasterdev el
opmentofsof t
war e.
Itiseasyt omai ntain.Supposeamodul edev el
opsaner ror
,thenaprogr
ammer
canf ixthatparti
cularmodul e,whi l
et heot herpart
soft hesoftwar
earesti
l
lup
andr unning.
Itsupportsrel
ativelyhassle-
freeupgr ades.
Itenablesreuseofobj ect
s,designs,andf uncti
ons.
Itreducesdevelopmentr i
sks,parti
cularl
yi nint
egrat
ionofcomplexsyst
ems.
Page9of9
Phasesi
nObj
ect
-Or
ient
edSof
twar
eDev
elopment
Themajorphasesofsoftwar
edev elopmentusingobj
ect–or
ient
edmet hodol
ogyare
obj
ect
-or
ient
edanal
ysi
s,obj
ect
-or
ienteddesi
gn,andobj
ect-
ori
entedimpl
ementat
ion.
Obj
ect
–Or
ient
edAnal
ysi
s
I
nt hi
sst age,t heproblem i
sf ormul
ated,userrequi
rement
sar eidenti
fi
ed,andthena
modelisbui ltbaseduponr eal–wor
ldobject
s.Theanalysi
spr oducesmodelsonhow
thedesir
edsy stem shouldfuncti
onandhowi tmustbedev eloped.Themodelsdonot
i
ncludeanyi mpl ementati
ondet ai
lssothatitcanbeunderstoodandexami nedbyany
non–technical appl
i
cationexpert.
Obj
ect
–Or
ient
edDesi
gn
Object-
ori
ent
eddesi
gni
ncl
udest
womai
nst
ages,namel
y,sy
stem desi
gnandobj
ect
design.
Syst
em Desi
gn
I
nt hi
sstage,t
hecompl etearchitect
ureoft hedesi r
edsy stem isdesigned.Thesyst
em
i
sconceivedasasetofi nteract
ingsubsy stemst hatinturni scomposedofahi erar
chy
ofint
eract
ingobj
ects,groupedi ntoclasses.Sy st
em desi gni sdoneaccor di
ngtoboth
thesyst
em anal
ysi
smodel andthepr oposedsy stem architectur
e.Here,t
heemphasisis
ontheobject
scompr i
singthesyst em r
atherthant heprocessesi nthesystem.
Obj
ectDesi
gn
Inthisphase,adesignmodelisdevel
opedbasedonbot hthemodel
sdevelopedi
nthe
system anal
y si
sphaseandthear chi
tect
uredesignedinthesyst
em desi
gnphase.Al
l
theclassesrequir
edarei
dent
if
ied.Thedesignerdeci
deswhether
:
newclassesaretobecreat
edfrom scratch,
anyexi
stingcl
assescanbeusedint heirori
ginalfor
m,or
newclassesshouldbei
nheri
tedfr
om t heexistingcl
asses.
Theassociationsbetweentheidenti
fi
edclassesareestabli
shedandthehierarchiesof
classesareidenti
fi
ed.Besi
des,thedevel
operdesignstheinter
naldet
ail
softhecl asses
andt hei
rassociati
ons,i
.e.
,thedatastr
uctureforeachattr
ibuteandtheal
gor i
thmsf or
theoperati
ons.
Obj
ect
–Or
ient
edI
mpl
ement
ati
onandTest
ing
I
nthisstage,t
hedesignmodeldevelopedi
ntheobj
ectdesi
gnistr
ansl
atedintocodei
n
anappropri
atepr
ogramminglanguageorsoft
waret
ool.Thedat
abasesarecreat
edand
Page10of10
t
hespeci
fi
chardwar
er equi
rement
sareascert
ained.Oncethecodei
sinshape,i
tis
t
est
edusi
ngspeci
ali
zedtechni
questoi
dent
if
yandr emovet
heerr
orsi
nthecode.
Pr
inci
plesofObj
ect
-Or
ient
edSy
stems
Theconcept
ualf
rameworkofobj
ect
–ori
ent
edsystemsisbasedupont
heobj
ectmodel
.
Ther
earetwocategor
iesofel
ement
sinanobj
ect
-ori
ent
edsystem:
MajorEl
ements:Bymajor
,iti
smeantthatifamodeldoesnothav
eanyoneoft
hese
el
ements,i
tceasest
obeobj
ector
ient
ed.Thefourmaj
orel
ementsar
e:
Abstr
acti
on
Encapsul
ati
on
Modulari
ty
Hier
archy
MinorEl ement
s :Bymi nor,iti
s meantthatthese elements ar
e usef
ul,butnot
i
ndispensabl
epartoft
heobjectmodel
.Thet
hreeminorelementsare:
Typing
Concurrency
Persist
ence
Abst
ract
ion
Abstr
actionmeanst ofocusont heessent
ialfeat
uresofanelementorobj
ectinOOP,
i
gnoringitsext
raneousoraccidentalpr
opert
ies.Theessent
ialf
eatur
esarerel
ati
vet
o
thecontexti
nwhichtheobjecti
sbeingused.
Gr
adyBoochhasdef
inedabst
ract
ionasf
oll
ows:
“
Anabst racti
ondenotestheessentialchar
acter
ist
icsofanobjectthatdisti
nguishit
f
rom allotherki
ndsofobject
sandt husprovi
decr i
spl
ydef
inedconceptualboundari
es,
r
elat
ivetotheperspect
iveoft
heviewer.”
Encapsul
ati
on
Encapsulati
onisthepr ocessofbi
ndingbothattri
but
esandmet hodstoget
herwithi
na
class.Throughencapsulati
on,t
hei
nternal
detai
l
sofacl asscanbehiddenfr
om outsi
de.
Thecl asshasmet hodst hatpr
ovi
deuserint
erfacesbywhichtheservi
cesprovi
dedby
theclassmaybeused.
Page11of11
Modul
ari
ty
Modul
ari
tyi
sthepr
ocessofdecomposingaprobl
em (
progr
am)int
oasetofmodul es
soast
oreducet
heover
all
complexi
tyofthepr
obl
em.Boochhasdef
inedmodul
ari
tyas:
“Modul
ari
tyistheproper
tyofasy st
em t
hathasbeendecomposedi
nto asetof
cohesi
veandl
oosel
ycoupledmodul
es.
”
Modular
it
yisint
rinsi
cal
l
ylinkedwithencapsul
ati
on.Modulari
tycanbev i
sual
izedasa
wayofmappi ngencapsulatedabstract
ionsi
ntoreal
,physicalmodul
eshav inghi
gh
cohesi
onwit
hinthemodulesandtheirint
er–modul
eint
eract
ionorcoupl
i
ngi sl
ow.
Hi
erar
chy
I
nGr adyBooch’swor ds,“
Hier
archyisther ankingororderingofabstract
ion”
.Through
hi
erarchy
,asy stem canbemadeupofi nterr
elatedsubsystems,whichcanhav ethei
r
ownsubsy st
emsandsoonunt ilt
hesmal lestlevelcomponentsarereached.I
tusesthe
pr
inci
pleof“divi
deandconquer”.Hier
archyallowscoder eusabil
i
ty.
Thet
wot
ypesofhi
erar
chi
esi
nOOAar
e:
“IS–A”hier
archy:Itdefi
nest hehierar
chi
calr elat
ionshi
pini nher
itance,whereby
from asuper-cl
ass,anumberofsubcl assesmaybeder ivedwhi chmayagai n
havesubclassesandsoon.Forexampl e,ifweder i
veaclassRosef rom aclass
Flower,
wecansayt hatarose“is–a”fl
ower.
“PART–OF”hi er
archy:Itdefinesthehierarchicalrel
ati
onshipinaggr egati
onby
whichacl assmaybecomposedofot hercl asses.Forexampl e,af l
oweri s
composedofsepal s,petal
s,stamens,andcar pel.Itcanbesai dthatapet ali
sa
“part
–of”fl
ower.
Ty
ping
Accordingtothet heor
iesofabst ractdatatype,at y
pei sacharacter
izati
onofasetof
elements.InOOP,acl assisv i
sualizedasat ypehav i
ngproperti
esdi st
inctfrom any
othertypes.Typingistheenforcementoft henotionthatanobjectisani nstanceofa
singl
eclassort y
pe.Italsoenforcest hatobj
ectsofdiffer
entty
pesmaynotbegener all
y
i
nt er
changed;andcanbei nterchangedonl yinav eryrest
ri
ctedmanneri fabsolutel
y
requir
edtodoso.
Thet
wot
ypesoft
ypi
ngar
e:
Str
ongTy ping:Her e,theoper
ationonanobj ectischeckedatt heti
meof
compilat
ion, asi
ntheprogramminglanguageEi
ff
el.
We akTy ping:Her e,messagesmaybesentt oanycl ass.Theoperati
oni s
checkedonl yatthet
imeofexecuti
on,asintheprogramminglanguageSmal
ltal
k.
Page12of12
Concur
rency
Inanobj ect-
or i
ent
edenv i
ronment,t
hereareacti
veandi nact
iveobject
s.Theacti
ve
object
shav eindependentthr
eadsofcontr
olt
hatcanexecuteconcur
rentl
ywi
ththr
eads
ofotherobjects.Theacti
veobject
ssynchr
oni
zewithoneanotheraswellaswit
hpurel
y
sequenti
alobjects.
Per
sist
ence
Obj
ectOr
ient
edAnal
ysi
s
Inthesystem analy
sisorobject
-ori
entedanal
ysi
sphaseofsoft
waredevel
opment,t
he
system r
equir
ement saredetermined,thecl
assesar
eident
if
iedandtherel
ati
onshi
ps
amongclassesar eident
if
ied.
Thethreeanaly
sist
echni
questhatareusedi
nconj
unct
ionwit
heachotherf
orobj
ect
-
ori
ent
edanalysi
sareobj
ectmodell
ing,
dynami
cmodel
li
ng,andf
unct
ional
modell
i
ng.
Obj
ectModel
li
ng
Objectmodel l
ingdev el
opst hestati
cst r
uctureofthesof t
waresyst
em i
nt ermsof
obj
ect s.Iti
dent i
fi
est heobjects,
theclassesintowhi
chtheobject
scanbegroupedi
nto
andt her el
ationshipsbet weent heobjects.Ital
soident
if
iesthemainatt
ri
butesand
operationsthatchar acter
izeeachclass.
Thepr
ocessofobj
ectmodel
l
ingcanbev
isual
i
zedi
nthef
oll
owi
ngst
eps:
I
dent
if
yobject
sandgroupi
ntocl
asses
I
dent
if
ytherel
ati
onshi
psamongclasses
Page13of13
Createuserobj
ectmodeldiagr
am
Defi
neuserobjectat
tri
butes
Defi
netheoperati
onsthatshoul
dbeper
for
medont
hecl
asses
Reviewglossar
y
Dy
nami
cModel
li
ng
Aft
erthestati
cbehavioroft
hesyst
em isanal
yzed,i
tsbehav
iorwi
threspectt
otimeand
ext
ernalchangesneedstobeexamined.Thi
sisthepur
poseofdynamicmodelli
ng.
Dynami cModell
ingcanbedef i
nedas“awayofdescr
ibinghow anindi
vidualobject
respondstoevents,ei
theri
nter
nalev
ent
str
igger
edbyotherobj
ect
s,orexternalev
ent s
t
r i
ggeredbyt
heout si
deworld”.
Thepr
ocessofdy
nami
cmodel
l
ingcanbev
isual
i
zedi
nthef
oll
owi
ngst
eps:
I
dent i
fystat
esofeachobject
I
dent i
fyeventsandanaly
zet heappli
cabi
li
tyofacti
ons
Constructdynamicmodel di
agram,compr isi
ngofst
atet
ransi
ti
ondi
agr
ams
Expresseachst at
einter
msofobj ectatt
ributes
Vali
datethest at
e–tr
ansi
tiondiagr
amsdr awn
Funct
ionalModel
li
ng
FunctionalModell
i
ngisthefinalcomponentofobj ect-or
ientedanal
ysi
s.Thefuncti
onal
modelshowst heprocessest hatar eperformedwi thinanobj ectandhow thedata
changesasi tmov esbet
weenmet hods.I
tspeci fi
esthemeani ngoft heoper
ati
onsof
objectmodel l
ing and the actions ofdy namic model l
ing.The functi
onalmodel
correspondstothedat
aflowdiagr am oftr
adi t
ionalst
ructur
edanalysi
s.
Thepr
ocessoff
unct
ional
model
l
ingcanbev
isual
i
zedi
nthef
oll
owi
ngst
eps:
I
dentif
yall
theinputsandout put
s
Constr
uctdatafl
owdi agramsshowingf
unct
ional
dependenci
es
Stat
ethepurposeofeachf uncti
on
I
dentif
yconstr
aint
s
Speci
fyopti
mizati
oncr i
teri
a
St
ruct
uredAnal
ysi
svs.Obj
ectOr
ient
edAnal
ysi
s
TheStruct
uredAnaly
sis/
Struct
uredDesign(
SASD)appr
oachist
het r
adi
ti
onalappr
oach
ofsof
twaredev el
opmentbasedupont hewater
fal
lmodel
.Thephasesofdevel
opment
ofasystem usi
ngSASDar e:
Feasi
bil
i
tyStudy
Requi
rementAnaly
sisandSpeci
fi
cat
ion
Page14of14
Syst
em Desi
gn
I
mplementat
ion
Post
-i
mplementat
ionRev
iew
Now,wewilll
ookattherelat
iveadvant
agesanddi
sadv
ant
agesofst
ruct
uredanal
ysi
s
appr
oachandobj
ect
-ori
entedanaly
sisappr
oach.
Adv
ant
ages/
Disadv
ant
agesofObj
ectOr
ient
edAnaly
sis
Adv
ant
ages Disadv
ant
ages
Functional
it
yi srestr
ict
ed withi
n obj
ects.
Focuses on data rather than theThismayposeapr obl
em forsy
stemswhich
procedur
esasi
nSt
ruct
uredAnal
ysis. areintri
nsi
call
ypr
oceduralorcomputat
ional
i
nnat ure.
Thepri
nciplesofencapsul
ati
onanddat a
hi
ding help the devel
oper t
o developI
t cannot i
denti
fy whi
ch object
s woul
d
syst
emst hatcannotbet
amperedbyothergener
ateanopti
malsyst
em desi
gn.
part
softhesystem.
Thepri
nciplesofencapsul
ati
onanddat a
The object
-or
ient
ed models do noteasil
y
hi
ding help the devel
oper t
o develop
show t he communicat
ions between the
syst
emst hatcannotbet
amperedbyother
object
sinthesystem.
part
softhesystem.
It al
lows effecti
ve management of
Allthe inter
faces between the obj
ect
s
sof
tware complexi
ty by t
he vi
rt
ue of
cannotberepresent
edinasingl
ediagr
am.
modular
it
y.
Adv
ant
ages/
Disadv
ant
agesofSt
ruct
uredAnal
ysi
s
Adv
ant
ages Disadv
ant
ages
In tradit
ional st ruct
ured anal ysi
s
models, one phase shoul d be
Asitf
oll
owsat op-downapproachincontrastt
o
completedbef or
et henextphase.This
bot
tom-upapproachofobject-
ori
entedanalysi
s,
posesapr oblem indesign,par
ticul
arl
y
i
tcanbemor eeasil
ycomprehendedt hanOOA.
i
f error
s cr op up or r equi
rements
change.
Page15of15
Itis based upon f uncti
onal
it
y.The ov eral
l
The init
ialcostofconst ruct
ing t
he
purpose i s identi
fi
ed and t hen funct
ional
system i s hi
gh, since the whole
decomposi t
ion is done f or devel
opi
ng the
system needstobedesignedatonce
software.Theemphasi snotonlygivesabetter
l
eav i
ng v ery li
tt
le opti
on t o add
understandi
ngoft hesystem butal
sogenerates
functi
onali
tyl
ater.
mor ecompletesystems.
The specif
icat
ionsi nitare wri
tt
en i
n si
mpl
eItdoesnotsuppor
treusabi
l
ityofcode.
Engl
ishlanguage,andhencecanbemor eeasi
l
ySo,thetimeandcostofdev el
opment
anal
yzedbynon- techni
cal
personnel
. i
sinher
entl
yhi
gh.
Dy
nami
cModel
ing
State,whichist hesituati
onatapar ti
cul
arcondi
tionduri
ngtheli
fet
imeofan
object.
Transit
ion,achangeint hestat
e
Event,anoccurrencethattri
ggerst
ransi
ti
ons
Action,anunint
er r
upt
edandat omiccomput at
iont
hatoccursduet
osomeevent
,
and
Concurrencyoftransi
tions.
Astatemachi
nemodelsthebehav
iorofanobj ectasi tpassesthroughanumberof
st
atesini
tsli
fet
imeduetosomeev entsaswel lastheact i
onsoccur r
ingduetot
he
ev
ents.Ast
atemachi
neisgr
aphi
cal
lyrepresent
edthroughast at
etransi
ti
ondiagr
am.
St
atesandSt
ateTr
ansi
ti
ons
St
ate
Thest ateisanabstr
acti
ongivenbyt heval
uesoftheattr
ibutesthattheobjecthasata
part
icularti
meperiod.I
tisasituat
ionoccurr
ingforafi
nit
et i
meper i
odi ntheli
feti
meof
anobj ect,i
nwhichitful
fi
lscertai
nconditi
ons,perf
ormscertainacti
v i
ti
es,orwai t
sfor
cert
ainev entst
ooccur.Inst
atet r
ansit
iondiagr
ams,astateisrepresentedbyr ounded
rect
angl es.
Page16of16
Par
tsofast
ate
Name:Ast ri
ngdi f
ferenti
atesonestat
ef r
om anot
her.Astat
emaynothav eany
name.
E ntr
y/ExitActi
ons:I tdenotestheact
ivi
ti
esperf
ormedonenteri
ngandonexit
ing
thest at
e.
InternalTransi
tions:Thechangeswi t
hinastatethatdonotcauseachangein
thest at
e.
Su b–states:Stateswi t
hinstat
es.
I
nit
ialandFi
nalSt
ates
Thedef aultstart
ingstat
eofanobj ectiscall
editsi
niti
alstate.Thefinalstatei
ndicates
thecompl etionofexecut i
onofthest atemachine.Thei nit
ialandthef inalst
atesar e
pseudo- states,andmaynothav et hepar t
sofar egul
arst ateexceptname.I nst ate
transi
tiondi agrams,theini
ti
alst
ateisrepresent
edbyaf il
ledblackcircl
e.Thef i
nalstate
i
sr epresent edbyaf i
ll
edblackci
rcl
eenci r
cledwithi
nanotherunf i
ll
edblackcircl
e.
Tr
ansi
ti
on
Atransit
iondenotesachangei nt hestat
eofanobj ect
.Ifanobjecti
si nacertai
nstate
whenanev entoccurs,theobj ectmayper f
orm cert
ainactiv
iti
essubjectt
ospeci f
ied
condit
ionsandchanget hest at
e.Inthiscase,ast
ate−transi
ti
onissai
dt ohaveoccurred.
Thet r
ansiti
ongivest her elati
onshipbetweent hef i
rststateandt henew st at
e.A
tr
ansit
ionisgraphical
l
yr epresentedbyasol i
ddirect
edar cfr
om thesourcestatetothe
desti
nati
onstate.
Thef
ivepar
tsofat
ransi
ti
onar
e:
Exampl
e
Supposeaper sonistakingataxifr
om placeXtopl
aceY.Thestat
esoft heper
sonmay
be:Wai t
ing(wait
ingf ortaxi
),Ridi
ng( hehasgotat axiandistravell
inginit
),and
Reached (he hasr eached t
he desti
nation)
.The f
oll
owi
ng fi
gure depict
sthe st
ate
tr
ansit
ion.
Page17of17
Ev
ent
s
Eventsaresomeoccurr
encesthatcantr
iggerstat
etr
ansi
ti
onofanobj
ectoragr
oupof
object
s.Eventshaveal ocat
ionintimeandspacebutdonothav eat imeper
iod
associat
edwit
hit
.Eventsaregener
all
yassociat
edwit
hsomeacti
ons.
Exampl
esofev
ent
sar
emousecl
i
ck,
keypr
ess,
ani
nter
rupt
,st
ackov
erf
low,
etc.
Ev
entst
hatt
ri
ggert
ransi
ti
onsar
e wr
it
ten al
ongsi
de t
he ar
coft
ransi
ti
on i
n st
ate
di
agr
ams.
Exampl
e
Consider
ingtheexampl eshownintheabovefi
gure,t
het r
ansit
ionfr
om Wai t
ingstat
eto
Ri
dingstatetakesplacewhenthepersongetsataxi
.Likewise,
thefi
nalstat
ei sr
eached,
whenher eachesthedest i
nat
ion.Thesetwooccur r
encescanbet ermedasev ent
s
Get_TaxiandReach_ Desti
nati
on.Thef ol
l
owingf i
gureshowst heeventsi nast at
e
machine.
Ext
ernalandI
nter
nal
Event
s
Exter
naleventsar
ethoseeventst
hatpassfrom auserofthesyst
em t
otheobject
s
withi
nt hesyst
em.Forexample,mousecli
ckorkey−pressbytheuserar
eexternal
events.
Page18of18
I
nternalev
entsarethosethatpassfr
om oneobj
ectt
oanot
herobj
ectwi
thi
nasy
stem.
Forexample,
stackoverf
low,adivi
deer
ror
,et
c.
Def
err
edEv
ent
s
Defer
redeventsaret
hosewhicharenotimmediat
elyhandl
edbytheobj
ecti
nt he
cur
rentst
atebutarel
inedupinaqueuesothatt
heycanbehandl
edbytheobj
ectin
someotherstat
eatal
atert
ime.
Ev
entCl
asses
Eventcl
assindicatesagr oupofev entswit
hcommonst r
uctur
eandbehav ior.Aswi th
cl
assesofobj ects,eventclassesmayal sobeor gani
zedinahi er
archi
calst ructur
e.
Eventcl
assesmayhav eattr
ibut
esassociat
edwiththem,ti
mebeinganimplicitattri
but
e.
Forexample,wecanconsi dertheev ent
sofdepart
ureofaf l
i
ghtofanairl
i
ne, whichwe
cangroupint
ot hefoll
owingclass:
Fl
i
ght
_Depar
ts(
Fli
ght
_No,
From_
Cit
y,To_
Cit
y,Rout
e)
Act
ions
Act
ivi
ty
Acti
vi
tyisanoperati
onupont hestat
esofanobj ectthatr
equiressomet imeperi
od.
Theyaretheongoi
ngex ecuti
onswithi
nasy st
em thatcanbeinterr
upted.Acti
vi
ti
esare
showninacti
vi
tydi
agramst hatpor
traythef
lowfr
om oneactivi
tytoanother.
Act
ion
Anactionisanat omicoper
ati
ont hatexecutesasaresultofcert
ainevents.Byatomic,
i
tismeantt hatacti
onsareun-interr
uptibl
e,i
.e.
,i
fanactionstart
sexecuting,i
trunsi
nto
completi
onwi thoutbei
nginterruptedbyanyev ent
.Anact i
onmayoper ateuponan
obj
ectonwhi chanev enthasbeent ri
ggeredoronotherobjectsthatarev i
sibl
etothi
s
obj
ect.Asetofact i
onscompriseanact ivi
ty.
Ent
ryandExi
tAct
ions
Entr
yact i
oni stheact
iont
hati
sexecut
edonent
eri
ngast
ate,i
rr
espect
iveoft
he
tr
ansit
ionthatl
edint
oit
.
Likewise,t
heacti
onthati
sexecut
edwhilel
eav
ingast
ate,i
rr
espect
iveoft
het
ransi
ti
on
thatledoutofi
t,i
scall
edanexi
tacti
on.
Page19of19
Scenar
io
Scenari
oisadescri
ptionofaspecif
iedsequenceofacti
ons.Itdepi
ctsthebehaviorof
object
sundergoi
ngaspecifi
cacti
onseries.Thepr
imaryscenari
osdepicttheessenti
al
sequencesandthesecondar
yscenari
osdepictt
healt
ernat
ivesequences.
Di
agr
amsf
orDy
nami
cModel
li
ng
Ther
ear
etwopr
imar
ydi
agr
amst
hatar
eusedf
ordy
nami
cmodel
l
ing:
I
nter
act
ionDi
agr
ams
Int
eracti
on diagrams descr i
be t he dynamic behav
ioramong dif
fer
entobject
s.I t
compr i
sesofasetofobj ects,thei
rr el
ati
onshi
ps,andthemessagethatt
heobj ects
sendandr eceive.Thus,ani nter
actionmodel sthebehav
iorofagroupofi
nterr
elated
object
s.Thetwot ypesofinteracti
ondi agr
amsar e:
SequenceDiagram :I
trepresentsthetemporalorderingofmessagesi
natabul
ar
manner.
Coll
aborat
ionDiagram :Itrepresent
st hestr
ucturalorgani
zat
ionofobj
ect
sthat
sendandreceiv
emessagest hroughverti
cesandar cs.
St
ateTr
ansi
ti
onDi
agr
am
Statetransit
iondiagramsorst atemachinesdescri
bethedy nami
cbehavi
orofasingle
object.Iti
ll
ustr
atest hesequencesofstatesthatanobjectgoest
hroughinit
sli
fet
ime,
thetransit
ionsoft hestates,theevent
sandcondi ti
onscausingthetr
ansi
ti
onandt he
responsesduet ot heevents.
Concur
rencyofEv
ent
s
I
nasy
stem,
twot
ypesofconcur
rencymayexi
st.Theyar
e:
Sy
stem Concur
rency
Here,concur
rencyi
smodel
l
edinthesystem l
evel
.Theov
eral
lsy
stem i
smodell
edas
t
heaggr egat
ionofstat
emachi
nes,wher
eeachst at
emachi
neexecut
esconcur
rent
ly
wit
hot her
s.
Concur
rencywi
thi
nanObj
ect
Here,anobjectcani ssueconcurr
entevent
s.Anobjectmayhav estat
est hatare
composedofsub-st
ates,andconcur
rentev
ent
smayoccurineachoft
hesub-st
ates.
Concept
srel
atedt
oconcur
rencywi
thi
nanobj
ectar
easf
oll
ows:
Page20of20
(
a)Si
mpl
eandComposi
teSt
ates
Asimplestat
ehasnosub- st
ructure.Astat
ethathassi
mplerstatesnest
edinsi
deitis
cal
ledacompositestat
e.Asub-stateisastat
ethati
snestedinsi
deanotherst
ate.I
tis
general
l
yusedtoreducethecomplexit
yofastatemachi
ne.Sub-st
atescanbenestedto
anynumberoflev
els.
Composi
test
atesmayhav
eei
thersequent
ial
sub-
stat
esorconcur
rentsub-
stat
es.
(
b)Sequent
ialSub-
stat
es
Insequenti
alsub-st
ates,
thecont
rolofexecut
ionpassesf
rom onesub-
stat
etoanot
her
sub-st
ateoneaf t
eranotheri
nasequent i
almanner.Ther
eisatmostonei ni
ti
alst
ate
andonef i
nalstat
einthesest
atemachines.
Thef
oll
owi
ngf
igur
eil
l
ust
rat
est
heconceptofsequent
ial
sub-
stat
es.
(
c)Concur
rentSub-
stat
es
I
nconcur r
entsub-stat
es,thesub-statesexecuteinparall
el,ori
notherwords,eachst ate
hasconcurrentl
yexecuti
ngst atemachi neswi t
hinit
.Eachoft hestatemachineshasi ts
owniniti
alandfinalst
ates.I
foneconcur rentsub-st
atereachesit
sf i
nalst
atebef or
et he
other
,controlwaitsatitsfinalstate.Whenal lthenest edstatemachinesr eachtheir
fi
nalstat
es,thesub-st
atesjoinbackt oasi ngl
eflow.
Thef
oll
owi
ngf
igur
eshowst
heconceptofconcur
rentsub-
stat
es.
Page21of21
Funct
ionalModel
ing
Functi
onalModel l
ing gi
vesthepr ocessper spect
iveoftheobject-
ori
ented anal
ysi
s
modelandanov er
v i
ewofwhatthesy stem i
ssupposedtodo.I
tdef i
nesthefuncti
onof
theint
ernalprocessesinthesystem wi ththeai dofDataFl
ow Diagrams( DFDs).I
t
depi
ctsthef uncti
onalderi
vat
ionoft hedat av al
ueswit
houti
ndicatinghow theyare
deri
vedwhent heyarecomputed,orwhyt heyneedtobecomputed.
Dat
aFl
owDi
agr
ams
FunctionalModel l
i
ngisrepresentedthroughahi erarchyofDFDs.TheDFDi sagraphical
repr
esent at
ionofasy st
em thatshowst heinputst ot hesystem,thepr ocessi
ngupon
theinputs,theoutputsofthesy stem aswellast hei nter
naldatastores.DFDsill
ustr
ate
theser i
esoft r
ansfor
mat i
onsorcomput ati
onsper formedont heobjectsorthesystem,
andt heexternalcont
rolsandobj ect
sthataffectthet ransf
ormation.
Rumbaughetal.havedefi
nedDFDas, “Adataf
lowdi
agram i
sagr aphwhichshowst he
fl
ow ofdatavaluesfrom thei
rsourcesinobj
ectst
hroughprocessesthattransf
orm
them t
othei
rdesti
nati
onsonotherobject
s.”
Page22of22
Thef
ourmai
npar
tsofaDFDar
e:
Processes,
DataFlows,
Actors,and
DataStores.
Theot
herpar
tsofaDFDar
e:
Constr
aints,
and
Contr
olFlows.
Feat
uresofaDFD
Pr
ocesses
Processesar ethecomputat
ionalacti
vit
iest
hattransf
orm dat
av al
ues.Awholesyst
em
canbev isual
izedasahigh-l
evelprocess.Aprocessmaybef urt
herdiv
idedi
ntosmall
er
component s.Thelowest
-l
evelprocessmaybeasi mplefuncti
on.
Representat
ioni
nDFD:Apr ocessi
srepr
esent
edasanel l
i
psewi t
hit
snamewr
it
ten
i
nsideitandcont
ainsaf
ixednumberofi
nputandout
putdat
av al
ues.
Example:Thefoll
owingf
igur
eshowsapr
ocessCompute_
HCF_LCM thataccept
stwo
i
nteger
sasi nputsandoutput
sthei
rHCF(hi
ghestcommonfactor
)andLCM ( l
east
commonmul ti
ple)
.
Dat
aFl
ows
Dataf
lowrepr
esentsthefl
owofdatabetweent
wopr ocesses.Itcoul
dbebet weenan
act
orandaprocess,orbetweenadatastor
eandapr ocess.Adat afl
ow denot
esthe
val
ueofadatait
em atsomepointoft
hecomputat
ion.Thi
sv al
ueisnotchangedbythe
dat
afl
ow.
Repr
esent
ati
oninDFD :A dat
afl
ow i
sr epresentedbyadi
rect
edar
coranar
row,
l
abel
ledwi
ththenameoft
hedat
ait
em t
hatitcarr
ies.
Page23of23
I
nt heabov
ef i
gure,I
nteger_
aandI nt
eger_brepr
esentthei
nputdat
afl
owst
othe
pr
ocess,
whil
eL.C.
M.andH. C.F.ar
etheoutputdat
aflows.
Adat
afl
owmaybef
orkedi
nthef
oll
owi
ngcases:
Theout putvalueissenttoseveralplacesasshowni nt
hef oll
owingf
igure.Here,
theoutputar r
owsar eunl
abel
ledast heydenot et
hesamev alue.
Thedat af l
owcont ai
nsanaggr egatev al
ue,andeachofthecomponent sissent
todif
fer entplacesasshowni nthef oll
owingfigur
e.Here,eachoft hef or
ked
component sislabell
ed.
Act
ors
Act
orsar etheacti
veobject
sthatint
eractwit
hthesyst
em byei
therpr
oducingdat
aand
i
nputti
ngt hem tothesy st
em,orconsumi ngdataproducedbythesystem.Inother
words,actor
sserveasthesourcesandthesinksofdat
a.
Repr
esent
ati
oni
nDFD:Anactori
srepr
esent
edbyarectangl
e.Act
orsar
econnect
edt
o
thei
nput
sandout
put
sandli
eontheboundar
yoftheDFD.
Example:Thefoll
owi
ngf
igur
eshowst
heact
ors,
namel
y,Cust
omerandSal
es_
Cler
kina
count
ersalessyst
em.
Page24of24
Dat
aSt
ores
Datastoresarethepassiv
eobj ect
sthatactasareposi
toryofdata.Unl
i
keact
ors,t
hey
cannotperfor
m anyoperat
ions.Theyareusedtost
oredataandr et
ri
evet
hest
oreddata.
Theyrepresentadat
astructur
e, adi
skfi
le,
oratabl
einadat abase.
Representat
ioninDFD:Adat ast oreisrepresentedbyt woparall
elli
nescontai
ningthe
nameoft hedatast or
e.Eachdat astoreisconnect edt oatleastoneprocess.Input
arr
owscont aininformat i
ontomodi f
ythecont entsoft hedatast or
e,whileoutput
arr
ows cont ai
ni nformation r
etrieved fr
om t he dat a stor
e.When a par toft he
i
nformationistober etr
ieved,
theout putarrowisl abell
ed.Anunlabel
ledarr
owdenot es
ful
ldataretr
iev
al.Atwo-wayar rowi mpli
esbot hretri
evalandupdate.
Exampl
e:Thefoll
owi
ngf i
gureshowsadatastor
e,Sal
es_Record,
thatst
orest hedet
ail
s
ofal
lsal
es.I
nputtothedatastorecompri
sesofdetai
lsofsalessuchasi tem,bil
li
ng
amount
,dat
e,et
c.Tofindtheaver
agesal
es,thepr
ocessret
riev
esthesalesrecordsand
comput
estheaver
age.
Const
rai
nts
Const
rai
ntsspecif
ythecondit
ionsorrestri
cti
onsthatneedtobesatisf
iedovert
ime.
Theyall
ow addi
ngnew rul
esormodi f
yingexisti
ngones.Const
rai
ntscanappeari
nall
thet
hreemodelsofobj
ect-
ori
entedanal
y si
s.
InObjectModelli
ng,t heconst rai
ntsdefinether el
ati
onshipbet weenobjects.
Theymayal sodefi
net herelati
onshipbet
weent hediff
erentvaluesthatanobj
ect
maytakeatdiff
erenttimes.
InDynamicModel l
i
ng,t heconstrai
ntsdefinet
herelati
onshipbet weenthest
ates
andeventsofdif
ferentobjects.
In Funct
ional Modelling,t he constr
aints def
ine the r estr
ict
ions on the
tr
ansfor
mat i
onsandcomput ati
ons.
Repr
esent
ati
on:
Aconst
rai
nti
srender
edasast
ri
ngwi
thi
nbr
aces.
Exampl
e:Thef
oll
owi
ngf
igur
eshowsapor
ti
onofDFDf
orcomput
ingt
hesal
aryof
Page25of25
employeesofacompanyt hathasdeci
dedt ogi v
ei ncenti
vestoal
lemployeesofthe
sal
esdepartmentandincrementthesalaryofallempl oyeesoftheHRdepar t
ment.I
t
canbeseenthattheconst
raint{
Dept:
Sales}causesincenti
vetobecal
cul
atedonlyi
fthe
depart
mentissalesandt heconstr
aint{Dept:HR}causesi ncr
ementtobecomput ed
onl
yifthedepar
tmentisHR.
Cont
rolFl
ows
Apr ocessmaybeassoci at
edwi
thacertai
nBool
eanvalueandiseval
uat
edonl
yifthe
val
uei strue,t
houghitisnotadi
recti
nputtot
heprocess.TheseBool
eanval
uesare
cal
ledthecontrolf
lows.
Repr
esent
ati
oninDFD:Cont
rolfl
owsarerepr
esent
edbyadot
tedar
cfr
om t
hepr
ocess
pr
oduci
ngtheBool
eanval
uet
ot hepr
ocesscontr
oll
edbyt
hem.
Example:Thef oll
owingf
igurer epr
esentsaDFDf orari
thmeti
cdiv
isi
on.TheDivisori
s
test
ed fornon-zero.Ifi
ti s notzero,the cont
rolfl
ow OK has a v al
ue Tr
ue and
subsequent
lyt
heDi vi
deprocesscomput est
heQuot i
entandtheRemainder.
Dev
elopi
ngt
heDFDModelofaSy
stem
Page26of26
I
nordertodevel
opt
heDFDmodelofasystem,ahi
erar
chyofDFDsar econst
ruct
ed.
Thet
op-l
evel
DFDcompr
isesofasi
ngl
epr
ocessandt
heactor
sint
eract
ingwit
hit
.
Ateachsuccessi
vel owerl evel
,fur
therdetai
l
sar egradual
lyincl
uded.A pr ocessi
s
decomposed i
nto sub-processes,the dataflows among t he sub-
processes ar
e
i
denti
fi
ed,thecontr
olflowsar edeter
mined,andthedat astoresaredefined.Whil
e
decomposi
ngaprocess, t
hedat afl
owi nt
ooroutoftheprocessshouldmat chthedat
a
fl
owatthenextl
evelofDFD.
Thefunct
ionalmodelfortheWholesal
eSoftwar
eisgivenbelow.Thefi
gur
ebelow
showsthetop-
lev
elDFD.I
tshowsthesoftwar
easasingl
eprocessandt
heactor
sthat
i
nter
actwit
hit.
Theact
orsi
nthesy
stem ar
e:
Customer s
Salesperson
Propri
etor
I
nthesy
stem,
thr
eepr
ocessescanbei
dent
if
ied,
whi
char
e:
Regi
sterCust
omer
s
Page27of27
ProcessSal
es
Ascertai
nGi
fts
Thedat
ast
orest
hatwi
l
lber
equi
redar
e:
CustomerDetai
l
s
Sal
esDetail
s
Gif
tDetai
ls
Thefoll
owingfigureshowst hedetai
lsoft heprocessRegisterCustomer
.Thereare
thr
eeprocessesini t
,Ver
if
yDet ai
ls,GenerateC_Code,andUpdat eCustomerDetai
ls.
Whenthedet ai
l
soft hecustomerar eentered,t
heyareveri
fied.Ift
hedataiscor
rect,
C_Codeisgeneratedandt
hedat astor
eCust omerDetai
l
sisupdat ed.
Page28of28
Thef ol
lowingfigureshowst heexpansionoft heprocessAscert
ainGi ft
s.Ithastwo
processesini t
,FindTot alSal
esandDeci deTy peofGi f
tCoin.TheFi ndTotalSal
es
processcomput esthey earl
ytotalsal
escorrespondi
ngt oeachcustomerandr ecor
ds
thedata.Takingthisrecordandt hedeci
sionoft hepropr
iet
orasinputs,thegi
ftcoi
ns
areall
ottedthr
oughDeci deTypeofGi f
tCoi
npr ocess.
Adv
ant
agesandDi
sadv
ant
agesofDFD
Adv
ant
ages Di
sadv
ant
ages
Page29of29
DFDsdepi cttheboundar
iesofasy stem and
DFDstakeal
ongti
met ocr
eat
e,which
hence ar e hel pf
ul in por tr
aying t he
may not be f
easi
ble f
or pract
ical
rel
ati
onshipbetweentheexternalobject
sand
pur
poses.
theprocesseswit
hinthesystem.
The gr
aphicalrepr
esentat
ion ser
ves as aThey do nott hrow any li
ghton t
he
bl
uepri
ntfortheprogrammerst odevel
opaf requency of comput at
ions or t
he
syst
em. reasonsforcomputat
ions.
Thepr eparati
on ofDFDsi sacompl ex
DFDsprovi
dedet ai
l
edi
nfor
mat
ionaboutt
heprocess t hat needs consi der
able
syst
em pr
ocesses. experti
se.Also,i
tisdiff
icul
tforanon-
techni
calpersontounder
stand.
They ar
e used as a par
toft
he sy
stemThemethodofpr
eparat
ionissubjecti
ve
documentat
ion. andl
eav
esamplescopetobeimprecise.
Rel
ati
onshi
pbet
weenObj
ect
,Dy
nami
c,andFunct
ionalModel
s
TheObjectModel
,theDynamicModel,
andtheFuncti
onalModelar
ecompl
ement
aryt
o
eachot
herforacomplet
eObject
-Or
ient
edAnaly
sis.
Objectmodell
i
ngdev el
opsthestati
cstr
uctureoft
hesoftwaresystem i
nter
msof
obj
ects.Thusitshowsthe“doer
s”ofasy st
em.
DynamicModel l
ingdevel
opsthetemporalbehavi
oroftheobject
si nr
esponseto
ext
ernalevent
s.Itshowsthesequencesofoperat
ionsperf
ormedont heobj
ects.
Functi
onalmodel gi
vesanoverv
iewofwhatt hesyst
em shoul
ddo.
Funct
ionalModelandObj
ectModel
Thef
ourmai
npar
tsofaFunct
ional
Model
int
ermsofobj
ectmodel
are:
Page30of30
Funct
ionalModelandDy
nami
cModel
Obj
ectModelandDy
nami
cModel
Thedynamicmodelshowsthest
atusoft
heobjectsandtheoperat
ionsper
for
medon
theoccur
rencesofevent
sandthesubsequentchangesinstat
es.Thestateoft
he
obj
ectasaresul
toft
hechangesi
sshownintheobj
ectmodel.
UMLAnal
ysi
sModel
TheUni fi
edModeli
ngLanguage( UML)isagraphicallanguageforOOADt hatgi
vesa
standardwayt owr i
teasof twaresyst
em’
sbl uepri
nt.Ithelpstovisual
i
ze,speci
fy,
construct
,anddocumentthearti
fact
sofanobject-
orient
edsy st
em.I
tisusedtodepict
thestruct
uresandtherel
ati
onshi
psinacompl
exsy stem.
Br
iefHi
stor
y
I
twasdev elopedi n1990sasanamal gamati
onofsev eralt
echniques,prominent
ly
OOAD technique by Grady Booch,OMT (ObjectModeling Technique)by James
Rumbaugh,andOOSE( ObjectOri
ent
edSoftwar
eEngineeri
ng)byI varJacobson.UML
at
temptedtostandardi
zesemanticmodel
s,synt
acti
cnotat
ions,
anddi agramsofOOAD.
Sy
stemsandModel
sinUML
Sy
stem :A setofel
ementsorgani
zedtoachi
evecer t
ainobj
ect
ivesf
orm asy
stem.
Sy
stemsar
eof t
endiv
idedi
ntosubsy
stemsanddescr
ibedbyasetofmodel
s.
Model:Modeli
sasi mpli
fi
ed,complet
e,andconsi
stentabst
ract
ionofasy
stem,
creat
ed
f
orbett
erunder
standingofthesyst
em.
Vi
ew:
Avi
ewi
sapr
oject
ionofasy
stem’
smodel
from aspeci
fi
cper
spect
ive.
Concept
ualModelofUML
Page31of31
TheConcept
ual
Model
ofUMLencompassest
hreemaj
orel
ement
s:
Basi
cbui
l
dingbl
ocks
Rul
es
Commonmechanisms
Basi
cBui
ldi
ngBl
ocks
Thet
hreebui
l
dingbl
ocksofUMLar
e:
Things
Relati
onshi
ps
Diagrams
(
a)Thi
ngs:
Ther
ear
efourki
ndsoft
hingsi
nUML,
namel
y:
(
b)Rel
ati
onshi
ps:
Rel
ati
onshi
psaretheconnecti
onbet
weent
hings.Thef
ourt
ypesofr
elat
ionshi
pst
hat
canberepr
esent
edinUMLar e:
Page32of32
(c)Diagr
ams:Adi agr
am isagraphi
calrepr
esent
ati
onofasy st
em.I
tcompr
isesofa
groupofelement
sgeneral
l
yintheform ofagraph.UMLincl
udesni
nedi
agr
amsi nal
l
,
namely:
ClassDi agram
ObjectDi agram
UseCaseDi agr am
SequenceDi agr am
CollaborationDi agram
StateChar tDi agr am
Activit
yDi agram
ComponentDi agr am
Depl oymentDi agr am
Rul
es
UMLhasanumberofr ul
essothatthemodel
saresemant
ical
l
yself
-consi
stentand
rel
atedtoot
hermodel
sinthesy
stem har
moni
ousl
y.UMLhassemanti
cr ul
esforthe
fol
lowi
ng:
Names
Scope
Visibi
l
ity
I
nt egr
it
y
Execution
CommonMechani
sms
UMLhasf
ourcommonmechani
sms:
Specif
icat
ions
Adornment s
CommonDi visi
ons
Ext
ensibil
i
tyMechanisms
Speci
fi
cat
ions
I
nUML, behi
ndeachgr aphi
calnot
ati
on,thereisatext
ualst
atementdenoti
ngt
hesynt
ax
andsemantics.Thesearet hespeci
fi
cations.Thespecif
icat
ionsprovi
deasemanti
c
backpl
anethatcontai
nsal lthepart
sofasy stem andther el
ati
onshi
pamongthe
di
ffer
entpat
hs.
Ador
nment
s
Eachel
ementi
nUMLhasauni
quegr
aphi
calnot
ati
on.Besi
des,t
her
ear
enot
ati
onst
o
Page33of33
r
epr
esentt
hei
mpor
tantaspect
sofanel
ementl
i
kename,
scope,
visi
bil
i
ty,
etc.
CommonDi
vi
sions
Obj
ect-
ori
ent
edsy
stemscanbedi
vi
dedi
nmanyway
s.Thet
wocommonway
sof
di
vi
sionar
e:
Divisionofclassesandobject
s:Acl assi sanabst
ract
ionofagr oupofsi mi
lar
object s.Anobjectistheconcret
ei nstancethathasactualexistencei nt
he
system.
DivisionofInterfaceandImplementati
on:Ani nt
erf
acedefinesther ul
esfor
i
nter acti
on.I
mplementati
onistheconcretereal
i
zati
onoftherulesdefinedint
he
i
nter face.
Ext
ensi
bil
it
yMechani
sms
UMLi sanopen-
endedl
anguage.I
tispossi
blet
oextendthecapabi
li
ti
esofUMLi na
contr
oll
edmannert
osui
ttherequi
rement
sofasy st
em.Theextensi
bil
i
tymechani
sms
are:
St
ereotypes:I textendsthevocabularyoftheUML,throughwhi chnewbui
l
ding
bl
ockscanbecr eatedoutofexisti
ngones.
TaggedVal ues:Itextendsthepropert
iesofUMLbuil
dingbl ocks.
Constr
aints: I
textendsthesemant i
csofUMLbuildi
ngbl ocks.
Page34of34
UMLBasi
cNot
ati
ons
UMLdef
inesspeci
fi
cnot
ati
onsf
oreachoft
hebui
l
dingbl
ocks.
Cl
ass
Acl
assi
srepr
esent
edbyar
ect
angl
ehav
ingt
hreesect
ions:
t
hetopsecti
oncontai
ningthenameoft heclass
t
hemiddlesect
ioncontai
ningclassatt
ri
butes
t
hebott
om secti
onrepresent
ingoperati
onsofthecl
ass
Thev
isi
bil
i
tyoft
heat
tri
but
esandoper
ati
onscanber
epr
esent
edi
nthef
oll
owi
ngway
s:
Publ i
c:A publ icmemberi sv isi
blef r
om anywhereint hesystem.Inclass
diagram, i
tisprefixedbythesy mbol ‘
+’
.
Private:Apr ivatememberi sv i
sibl
eonl yf
rom wit
hint heclass.Itcannotbe
accessedf rom out si
detheclass.Apr i
vatememberisprefixedbythesymbol‘−’.
Protected:Apr otect
edmemberi sv isi
blef
rom wit
hint heclassandf r
om t he
subclassesi nherit
edf r
om thisclass,butnotfr
om outside.Itispref
ixedbyt he
symbol ‘#’
.
Anabst
ractcl
asshast
hecl
assnamewr
it
teni
nit
ali
cs.
Exampl e:Letusconsi
dertheCi r
cleclassint
roducedear l
ier
.Theatt
ri
butesofCircl
eare
x-coord,y-
coord,andradi
us.Theoper ati
onsar efindArea()
,fi
ndCi
rcumference()
,and
scale()
.Letusassumet hatx-coordandy -coordarepr i
vatedat
amember s,radiusisa
protecteddatamember ,andt hememberf unct
ionsar epubli
c.Thef ol
lowingfigur
e
givesthediagr
ammat i
crepresentat
ionoftheclass.
Obj
ect
Anobj
ecti
srepr
esent
edasar
ect
angl
ewi
tht
wosect
ions:
Thet
opsect
ioncont
ainst
henameoft
heobj
ectwi
tht
henameoft
hecl
assor
Page35of35
packageofwhi chiti
sani nstanceof.Thenamet akest
hefol
lowi
ngf or
ms:
o o bject
-name: class-
name
o o bject
-name: class-
name: :package-name
o c l
ass-name: incaseofanony mousobj ect
s
Thebot tom secti
onr epresentsthev aluesoft heatt
ri
but
es.Ittakesthef
orm
att
ri
bute-name=v alue.
Sometimesobj ect
sar erepresent
edusi ngroundedrect
angl
es.
Example:Letusconsi
deranobjectoft
hecl
assCir
clenamedc1.Weassumethatthe
cent
erofc1isat(
2,3)andther
adiusofc1i
s5.Thefol
lowi
ngfi
gur
edepi
ctst
heobject.
Component
Acomponentisaphy si
calandrepl
aceabl
epartofthesystem thatconf
ormst oand
pr
ovi
desthereal
izat
ionofasetofinter
faces.I
trepr
esent
st hephysi
calpackagi
ngof
el
ement
slikecl
assesandint
erf
aces.
Notat
ion:I
nUMLdiagr
ams,acomponenti
srepr
esent
edbyar
ect
angl
ewi
tht
absas
shownint
hefi
gur
ebel
ow.
I
nter
face
Int
erf
aceisacoll
ect
ionofmethodsofaclassorcomponent
.Itspeci
fi
est
hesetof
servi
cest
hatmaybeprov
idedbyt
hecl
assorcomponent
.
Notati
on:Gener
all
y,anint
erf
aceisdrawnasaci r
clet
ogetherwithitsname.An
i
nterf
acei
salmostalwaysatt
achedt
ot heclassorcomponentthatreal
izesi
t.The
f
ollowi
ngf
igur
egi
vesthenot
ati
onofanint
erf
ace.
Page36of36
Package
Apackageisanor
ganizedgr
oupofelements.Apackagemaycont
ainst
ruct
uralt
hings
l
ikecl
asses,
components,
andot
herpackagesini
t.
Notation:Gr aphi
call
y,apackageisrepr
esentedbyat abbedfolder
.A packageis
generall
ydrawnwi t
honl yit
sname.Howeveritmayhav
eaddi t
ionaldetai
l
saboutthe
contentsofthepackage.Seethef
oll
owi
ngfi
gures.
Rel
ati
onshi
p
Thenot
ati
onsf
ort
hedi
ff
erentt
ypesofr
elat
ionshi
psar
easf
oll
ows:
Usual
ly,el
ementsinar el
ati
onshi
pplayspecifi
crol
esintherel
ationshi
p.Ar
olename
si
gnif
iesthebehav
iorofanelementpar
ti
cipat
inginacer
tai
ncontext.
Exampl
e:Thef
oll
owi
ngf
igur
esshow exampl
esofdi
ff
erentr
elat
ionshi
psbet
ween
Page37of37
classes.Thef i
rstfi
gureshowsanassoci ati
onbetweentwocl asses,Depar t
mentand
Empl oyee,wherei
nadepartmentmayhav eanumberofempl oyeeswor kinginit
.Worker
i
st herol
ename.The‘ 1’alongsideDepart
mentand‘*’al
ongsideEmpl oy eedepictt
hat
the cardinal
it
yr at
ioisone–t o–many.The second fi
gure port
rayst he aggregat
ion
relati
onship,
aUni v
ersi
tyi
sthe“ whol
e–of”manyDepartments.
UMLSt
ruct
uredDi
agr
ams
UMLstructur
aldiagr
amsar ecat
egori
zedasfol
l
ows:cl
assdi
agr
am,obj
ectdi
agr
am,
componentdi
agram,anddepl
oymentdi
agram.
Cl
assDi
agr
am
A cl
assdiagr
am model
st hest
ati
cview ofasystem.Itcompri
sesofthecl
asses,
i
nter
faces,
andcol
l
abor
ati
onsofasyst
em;andther
elat
ionshi
psbet
weent
hem.
Cl
assDi
agr
am ofaSy
stem
Letusconsi
derasi
mpl
i
fiedBanki
ngSy
stem.
Page38of38
Abankhasmanybr anches.Ineachzone,onebr anchisdesignatedast hezonalhead
off
icethatsupervi
sest heotherbranchesinthatzone.Eachbr anchcanhav emul t
ipl
e
accountsandloans.Anaccountmaybeei t
herasav i
ngsaccountoracur r
entaccount.
A customermayopenbot hasav i
ngsaccountandacur rentaccount .However,a
customermustnothav e mor et han one sav
ings accountorcur rentaccount.A
customermayalsopr ocureloansfrom t
hebank.
Thef
oll
owi
ngf
igur
eshowst
hecor
respondi
ngcl
assdi
agr
am.
Page39of39
Cl
assesi
nthesy
stem:
Bank,
Branch,
Account
,Sav
ingsAccount
,Cur
rentAccount
,Loan,
andCust
omer
.
Page40of40
Rel
ati
onshi
ps:
Fr
om thecl assAccount
,twocl
asseshav
einher
it
ed,namel
y,Sav
ingsAccountand
Cur
rentAccount.
ACustomercanhaveoneCurr
entAccount: associat
ion,one–t
o–one
ACustomercanhaveoneSavi
ngsAccount: associati
on,one–to–one
ABranch“
has–a”numberofLoans:aggregation,one–to–many
ACustomercantakemanyl
oans:associ
at i
on, one–to–many
Obj
ectDi
agr
am
Anobjectdiagram model
sagroupofobj
ect
sandtheirl
inksatapoi
ntofti
me.Itshows
thei
nstancesoft hethi
ngsi
nacl assdi
agr
am.Objectdiagr
am i
sthestat
icpartofan
i
nter
acti
ondi agram.
Example:Thefoll
owingfi
gur
eshowsanobj
ectdi
agr
am ofapor
ti
onoft
hecl
ass
di
agram oft
heBanki
ngSyst
em.
Page41of41
ComponentDi
agr
am
Componentdi
agr
amsshow t
heor
gani
zat
ionanddependenci
esamongagr
oupof
component
s.
Componentdi
agr
amscompr
iseof
:
Component s
I
nterf
aces
Rel
ationshi
ps
PackagesandSubsy
stems(
opt
ional
)
Componentdi
agr
amsar
eusedf
or:
construct
ingsystemst hroughforwardandr ev
erseengineer
ing.
model i
ngconf i
gurati
onmanagementofsour cecodef il
eswhi l
edev
elopi
nga
system usinganobject-ori
ent
edpr ogr
ammi nglanguage.
represent
ingschemasi nmodel ingdatabases.
mo deli
ngbehaviorsofdy namicsystems.
Exampl
e
Page42of42
Thef ol
lowingfigur
eshowsacomponentdi agram tomodelasy stem’ssourcecodethat
i
s dev eloped using C++.I tshows f oursour ce code f
il
es,namel y
,my header.h,
otherheader.
h,pr i
ori
ty.
cpp,and other
.cpp.Two v ersi
onsofmy header
.h ar
eshown,
tr
acingf rom therecentv er
siontoitsancestor.Thef i
lepr
iorit
y.cpphascompi l
ation
dependency on ot her
.cpp.The f i
le other
.cpp has compi lati
on dependency on
otherheader.
h.
Depl
oymentDi
agr
am
Adeploymentdiagram putsemphasi
sontheconfi
gurat
ionofr
unt
imeprocessi
ngnodes
andtheircomponentst hatli
veonthem.Theyarecommonlycompri
sedofnodesand
dependenci
es,orassociati
onsbet
weenthenodes.
Depl
oymentdi
agr
amsar
eusedt
o:
Exampl
e
The foll
owing f
igure shows t
he topology of a comput
er syst
em that fol
l
ows
cl
ient
/serverar
chit
ecture.Thefi
gur
ei l
lustr
atesa nodester
eoty
ped asserverthat
Page43of43
compr isesofprocessors.Thef i
gureindi
catesthatfourormoreserver
saredeployedat
thesy stem.Connectedtot heserverarethecli
entnodes,whereeachnoderepresent
sa
terminaldev i
ce such as wor kst
ati
on,l apt
op,scanner,orpr i
nter.The nodes are
representedusingiconsthatclearl
ydepictthereal
-worl
dequiv
alent
.
UMLBehav
iour
alDi
agr
ams
UMLbehavi
oraldiagr
amsvisual
i
ze,speci
fy,const
ruct
,and documentthedynamic
aspect
sofasystem.Thebehavi
oraldi
agr
amsar ecategor
izedasfol
lows:usecase
Page44of44
di
agr
ams,
int
eract
iondi
agr
ams,
stat
e–char
tdi
agr
ams,
andact
ivi
tydi
agr
ams.
UseCaseModel
(
a)Usecase
Ausecasedescr
ibesthesequenceofacti
onsasystem per
for
msy i
eldi
ngvi
sibl
eresul
ts.
I
tshowstheint
eract
ionofthingsoutsi
dethesyst
em withthesyst
em it
sel
f.Usecases
maybeappl
iedtothewholesy st
em aswellasapar
tofthesystem.
(
b)Act
or
Anactorrepresentstherolest
hatt
heuser
softheusecasespl
ay.Anact
ormaybea
person(e.
g.st udent
,customer)
,adevi
ce(e.
g.workst
ati
on)
,oranot
hersyst
em (
e.g.
bank,i
nsti
tut
ion).
Thefol
l
owingfigur
eshowsthenotat
ionsofanact
ornamedSt
udentandausecase
cal
l
edGenerat
ePerfor
manceRepor
t.
(
c)Usecasedi
agr
ams
Usecasedi
agr
amspr esentanout
sideview ofthemannert
heel
ement
sinasy
stem
behav
eandhowtheycanbeusedinthecontext
.
Usecasedi
agr
amscompr
iseof
:
Usecases
Act
ors
Rel
ati
onshi
psl
i
kedependency
,gener
ali
zat
ion,
andassoci
ati
on
Usecasedi
agr
amsar
eused:
Tomodelthecontextofasyst
em byencl
osi
ngal lt
heacti
vi
ti
esofasy st
em
wi
thi
narectangl
eandfocusi
ngontheact
orsout
sidethesy
stem byi
nter
act
ing
wi
thi
t.
Page45of45
Tomodel
ther
equi
rement
sofasy
stem f
rom t
heout
sidepoi
ntofv
iew.
Exampl
e
Letus consi
deran Aut
omat
ed Tr
adi
ng House Sy
stem.We assume t
he f
oll
owi
ng
feat
uresoft
hesyst
em:
Thet r
adinghousehast ransacti
onswi t
ht wo ty
pesofcust omers,i
ndi
vidual
cust
omer sandcor
poratecustomers.
Oncethecustomerplacesanor der
,iti
sprocessedbythesalesdepar
tmentand
thecustomeri
sgiventhebil
l
.
Thesy st
em al
lowsthemanagert omanagecust omeraccountsandanswerany
queri
espostedbythecustomer.
I
nter
act
ionDi
agr
ams
I
nteract
iondiagr
amsdepi ctint
eract
ionsofobj
ect
sandthei
rrel
ati
onshi
ps.Theyalso
i
nclude the messages passed bet
ween t
hem.Ther
e aretwo ty
pes ofint
eract
ion
di
agrams:
SequenceDiagr
ams
Coll
aborat
ionDi
agr
ams
Page46of46
I
nter
act
iondi
agr
amsar
eusedf
ormodel
ing:
t
hecont
rol
flowbyti
meorderi
ngusingsequencediagrams.
t
hecont
rol
flowofor
gani
zati
onusingcoll
aborat
iondiagrams.
SequenceDi
agr
ams
Sequencedi
agramsar
eint
eract
iondi
agr
amst
hati
l
lust
rat
etheor
der
ingofmessages
accor
dingt
otime.
Notat
ions:Thesediagr
amsar eint
hef orm oftwo-dimensi
onalchart
s.Theobj ectst
hat
i
nit
iat
etheint
eract
ionareplacedonthex–axi s.Themessagest hattheseobjectssend
andrecei
veareplacedalongt hey–axis,i
nt heor derofincr
easingtimefrom t opto
bot
tom.
Example:Asequencedi
agr
am f
ort
heAut
omat
edTr
adi
ngHouseSy
stem i
sshowni
n
thef
oll
owingf
igur
e.
Col
labor
ati
onDi
agr
ams
Col
labor
ati
ondiagr
amsareint
eract
iondiagr
amst
hati
l
lust
rat
ethest
ruct
ureoft
he
obj
ectst
hatsendandr
ecei
vemessages.
Page47of47
Notat
ions:Inthesedi
agr
ams,theobjectsthatpart
ici
pat
eintheinter
act
ionareshown
usi
ng vert
ices.The l
i
nks t
hatconnectt he obj
ects ar
e used t
o send and r
ecei
ve
messages.Themessagei
sshownasal abel
edarrow.
Example:Col
labor
ati
ondi
agr
am f
ort
heAut
omat
edTr
adi
ngHouseSy
stem i
sil
l
ust
rat
ed
i
nt hef
igur
ebelow.
St
ate–Char
tDi
agr
ams
Ast at
e–chartdi
agr
am showsastat
emachi nethatdepi
ctst
hecontrolf
lowofanobj
ect
fr
om onest atet
oanot
her.Astat
emachinepor tr
aysthesequencesofstat
eswhi
chan
objectunder
goesduet
oev ent
sandthei
rresponsestoevent
s.
St
ate–Char
tDi
agr
amscompr
iseof
:
States:Si
mpleorComposite
Transit
ionsbetweenst
ates
Eventscausingtr
ansi
ti
ons
Acti
onsduet otheevent
s
St
ate-
char
tdi
agr
amsar
eusedf
ormodel
i
ngobj
ect
swhi
char
ereact
ivei
nnat
ure.
Exampl
e
IntheAutomatedTradi
ngHouseSyst
em,letusmodelOrderasanobj
ectandt
racei
ts
sequence.Thefol
l
owingfi
gur
eshowsthecorr
espondi
ngstat
e–char
tdi
agr
am.
Page48of48
Act
ivi
tyDi
agr
ams
An act
ivi
tydi
agr
am depictst he fl
ow ofactiv
iti
es whi
ch are ongoi
ng non-
atomic
oper
ati
onsinast
atemachine.Acti
vi
tiesr
esul
tinacti
onswhichar
eat omi
coperat
ions.
Act
ivi
tydi
agr
amscompr
iseof
:
Acti
vit
ystat
esandact
ionst
ates
Transi
ti
ons
Object
s
Act
ivi
tydi
agr
amsar
eusedf
ormodel
ing:
workf
lowsasvi
ewedbyactor
s,int
eract
ingwi
ththesyst
em.
det
ail
sofoper
ati
onsorcomputati
onsusingf
lowchar
ts.
Exampl
e
Thefol
lowi
ngf
igur
eshowsanact
ivi
tydi
agr
am ofapor
ti
onoft
heAut
omat
edTr
adi
ng
HouseSyst
em.
Page49of49
Page50of50
Obj
ectOr
ient
edDesi
gn
Aft
ert heanalysi
sphase,t heconcept ualmodeli sdev elopedf urt
heri nt
oanobj ect
-
ori
entedmodelusi ngobject-or
ienteddesi gn(OOD).InOOD, thetechnology-
independent
conceptsintheanalysismodelar emappedont oimplement ingclasses,constr
aintsare
i
dentifi
ed,andint
erfacesaredesi gned,resulti
nginamodelf orthesol uti
ondomai n.Ina
nutshel
l,adetail
eddescr i
ptionisconst ructedspecif
ying how thesy stem i
st obebui l
t
onconcr et
etechnologi
es
Thest
agesf
orobj
ect
–or
ient
eddesi
gncanbei
dent
if
iedas:
Defi
niti
onoft hecont extoft hesyst
em
Designingsystem architecture
I
dent i
fi
cati
onoft heobj ectsinthesyst
em
Constructi
onofdesi gnmodel s
Specifi
cati
onofobj ectinterfaces
Obj
ect
-Or
ient
edSy
stem Desi
gn
Sy
stem Desi
gn
Object-
ori
ent
edsystem desi
gninv
olvesdef
ini
ngt
hecont
extofasy
stem f
oll
owedby
designi
ngthear
chi
tectur
eofthesyst
em.
Obj
ect
-Or
ient
edDecomposi
ti
on
Decomposi t
ionmeansdi vi
dingal argecomplexsy stem i
ntoahi erar
chyofsmaller
component swithlessercomplexit
ies,onthepri
nciplesofdivi
de–and–conquer
.Each
majorcomponentoft hesystem i
scal l
edasubsystem.Object-
ori
enteddecomposi
ti
on
i
dentif
iesindiv
idualautonomousobj ectsi
nasy stem andt hecommuni cat
ionamong
theseobject
s.
Theadv
ant
agesofdecomposi
ti
onar
e:
Page51of51
Theindividualcomponentsareofl
essercomplexi
ty,
andsomoreunder
standable
andmanageabl e.
Itenablesdivi
sionofworkfor
cehavi
ngspecial
i
zedskill
s.
Itallows subsy st
ems to be repl
aced ormodi fi
ed wit
houtaf
fect
ing other
subsy st
ems.
I
dent
if
yingConcur
rency
Concurr
encyall
owsmor
ethanoneobject
storecei
veevent
satthesamet
imeandmor e
than one act
ivi
tyt
o be execut
ed si
mult
aneously
.Concurr
ency i
sident
if
ied and
repr
esentedi
nthedy
namicmodel.
Toenabl econcur r
ency,eachconcur rentel ementi sassi
gnedasepar at
et hr
eadof
contr
ol.Iftheconcur rencyisatobjectlevel,thentwoconcurr
entobject
sareassigned
twodifferentthreadsofcont rol
.Iftwooper ationsofasingl
eobjectareconcurr
entin
natur
e,thent hatobjectisspl
itamongdi ff
erentt hr
eads.
Concurr
encyisassociatedwi
ththeprobl
emsofdataint
egri
ty,deadl
ock,andstar
vat
ion.
Soacl earst rat
egyneedst obemadewhenev erconcur
rencyi srequi
red.Besi
des,
concurr
encyr equi
restobeident
if
iedatthedesi
gnstageitsel
f,andcannotbeleftfor
i
mpl ementat
ionstage.
I
dent
if
yingPat
ter
ns
Whil
edesi gni
ng appl
i
cations,somecommonl yaccept
ed sol
utionsareadopted f
or
somecat egor
iesofproblems.Thesear et
hepat t
ernsofdesign.A pat
ter
ncanbe
defi
nedasadocument edsetofbuil
dingbl
ocksthatcanbeusedi ncert
ainty
pesof
appl
icat
iondevel
opmentpr obl
ems.
Somecommonl
yuseddesi
gnpat
ter
nsar
e:
Façadepat t
ern
Model vi
ewsepar at
ionpatter
n
Observerpatter
n
Model vi
ewcont rol
l
erpattern
Publi
shsubscr i
bepatter
n
Proxypatter
n
Cont
rol
li
ngEv
ent
s
Dur
ingsyst
em desi
gn,theevent
sthatmayoccuri
ntheobj
ect
soft
hesy
stem needt
o
bei
denti
fi
edandappropri
atel
ydeal
twit
h.
Anev enti
saspeci
fi
cat
ionofasi
gni
fi
cantoccur
rencet
hathasal
ocat
ioni
nti
meand
space.
Page52of52
Ther
ear
efourt
ypesofev
ent
sthatcanbemodel
l
ed,
namel
y:
Si
gnalEvent:Anamedobj ectthrownbyoneobj ectandcaughtbyanotherobj
ect
.
Cal
lEvent:Asynchronousev entrepresent
ingdi
spatchofanoperat
ion.
Ti
meEv ent:Aneventr epresenti
ngpassageoft i
me.
ChangeEvent:Anev entrepresentingchangeinstat
e.
Handl
ingBoundar
yCondi
ti
ons
Thesyst
em desi
gnphaseneedstoaddresstheini
ti
ali
zat
ionandthet
erminat
ionofthe
syst
em as a whol
e as wellas each subsy
stem.The differ
entaspect
st hatare
document
edareasfol
lows:
Boundar
ycondi
ti
onsar
emodel
l
edusi
ngboundar
yusecases.
Obj
ectDesi
gn
Aft
erthehi erar
chyofsubsy st
emshasbeendev eloped,theobjectsinthesyst
em ar e
i
dentif
iedandt heirdet ai
lsaredesi gned.Here,thedesi gnerdetai
lsoutthestrategy
chosen during the system design.The emphasi s shi
ftsfrom appli
cati
on domai n
conceptstowardcomput erconcepts.Theobjectsidentif
iedduri
nganalysi
sareet ched
outforimplement at
ionwi t
hanai mt omi ni
mizeexecut i
ont i
me,memor yconsumpt ion,
andov er
allcost
.
Obj
ectdesi
gni
ncl
udest
hef
oll
owi
ngphases:
Objectidenti
ficati
on
Objectrepresentati
on,i
.e.
,constructi
onofdesignmodel
s
Cl
assificat
ionofoper at
ions
Al
gor i
thm desi gn
Designofr el
at i
onshi
ps
I
mpl ement ati
onofcontrolforexternali
nter
act
ions
Packagecl assesandassoci at
ionsintomodules
Obj
ectI
dent
if
icat
ion
Thef
ir
stst
epofobj
ectdesi
gni
sobj
ecti
dent
if
icat
ion.Theobj
ect
sident
if
iedi
nthe
Page53of53
obj
ect–or
ient
edanalysisphasesaregr
oupedi
ntocl
assesandr
efi
nedsot
hatt
heyar
e
sui
tabl
eforactual
implementati
on.
Thef
unct
ionsoft
hisst
agear
e:
I
dent i
fyi
ngandr efi
ningt heclassesi
neachsubsystem orpackage
Defi
ningt hel
inksandassoci at
ionsbet
weentheclasses
Designing the hi erarchical associ
ati
ons among t he classes, i
.e.
,the
generali
zati
on/special
izati
onandi nher
it
ances
Designingaggregati
ons
Obj
ectRepr
esent
ati
on
Oncetheclassesarei
dentif
ied,theyneedtober epresent
edusingobj
ectmodel
l
ing
t
echni
ques.Thisst
ageessenti
all
yinvol
vesconst
ruct
ingUMLdi agr
ams.
Ther
ear
etwot
ypesofdesi
gnmodel
sthatneedt
obepr
oduced:
Stat
icModels:Todescr
ibet
hestat
icstr
uctureofasystem usi
ngclassdi
agrams
andobjectdi
agr
ams.
DynamicModels:Todescri
bethedynamicst r
uctur
eofasy stem andshowthe
i
nteract
ion bet
ween cl
asses usi
ng interact
ion diagr
ams and st at
e–char
t
di
agrams.
Cl
assi
fi
cat
ionofOper
ati
ons
I
nt hi
sstep,t
heoperat
iont
obeper f
ormedonobject
sar edef
inedbycombi
ningthe
threemodelsdevel
opedint
heOOAphase,namely
,objectmodel,dy
nami
cmodel,and
functi
onalmodel
.Anoperat
ionspeci
fi
eswhati
stobedoneandnothow itshoul
dbe
done.
Thef
oll
owi
ngt
asksar
eper
for
medr
egar
dingoper
ati
ons:
Thestatetr
ansiti
ondiagram ofeachobjectinthesy st
em isdevel
oped.
Operati
onsaredef i
nedfortheeventsreceiv
edbyt heobj
ects.
Casesi nwhichoneev enttri
ggersotherev entsi
nsameordi ff
erentobj
ect
sar
e
i
dentif
ied.
Thesub–oper at
ionswithi
ntheactionsareidentif
ied.
Themai nacti
onsar eexpandedtodataf l
owdi agrams.
Al
gor
it
hm Desi
gn
Theoperati
onsintheobj
ect
saredef
inedusi
ngal
gori
thms.Analgori
thm i
sastepwi
se
procedur
ethatsol
vesthepr
obl
em l
aiddowninanoperat
ion.Al
gor
it
hmsf ocusonhow
i
tistobedone.
Page54of54
Theremaybemor ethanonealgorit
hm corr
espondi
ngtoagi venoperat
ion.Oncet
he
al
ternati
vealgor
it
hmsar eident
if
ied,theopti
malalgori
thm isselect
edforthegiv
en
problem domai
n.Themetri
csforchoosingt
heopti
mal al
gori
thm ar
e:
Comput ati
onalCompl exit
y :Compl exi
ty determines the ef
fici
ency of an
al
gorithm i
nter
msofcomput ationt i
meandmemor yrequi
rement
s.
Fl
exibili
ty :Flexibi
l
ity determi nes whether the chosen algorit
hm can be
i
mplement edsuitabl
y,withoutlossofappr opri
atenessinvari
ousenvironment
s.
Understandabi
li
ty:Thi sdet ermi neswhet herthechosenal gor
it
hm i seasyto
understandandimplement .
Desi
gnofRel
ati
onshi
ps
Thestr
ategyt
oimpl
ementtherel
ati
onshipsneedstobechalkedoutdur
ingt
heobject
desi
gnphase.Themainrel
ati
onshi
pst hatareaddressedcompri
seofassoci
ati
ons,
aggr
egati
ons,
andi
nher
it
ances.
Thedesi
gnershoul
ddot
hef
oll
owi
ngr
egar
dingassoci
ati
ons:
I
dent i
fywhetheranassociati
onisunidirect
ionalorbi
dir
ecti
onal.
Analyzethepathofassociati
onsandupdat ethem i
fnecessary.
I
mpl ementt he associ
ati
onsasa di sti
nctobject,i
n case ofmany –t
o-many
rel
ationshi
ps;orasal i
nkt ootherobjectincaseofone–t o-oneorone–t
o-many
rel
ationshi
ps.
Regar
dingi
nher
it
ances,
thedesi
gnershoul
ddot
hef
oll
owi
ng:
Adj
ustthecl
assesandt hei
rassoci
ati
ons.
I
denti
fyabst
ractcl
asses.
Makeprovi
si
onssot hatbehavi
orsareshar
edwhenneeded.
I
mpl
ement
ati
onofCont
rol
Theobjectdesignermayi ncorpor
aterefi
nementsinthest r
ategyofthest
ate–char
t
model.I
nsy stem design,abasicstr
ategyforreal
izi
ngthedy namicmodeli
smade.
Dur
ingobjectdesi
gn,thisst
rat
egyisaptl
yembell
ishedforappropr
iat
eimpl
ementat
ion.
Theappr
oachesf
ori
mpl
ement
ati
onoft
hedy
nami
cmodel
are:
Repr esentSt at
e as a Locat
ion wi
thi
n a Program :Thisist he t
raditi
onal
procedur e-dri
venapproachwherebyt
helocati
onofcontroldef
inest
hepr ogram
state.A f i
nitestatemachinecanbei mplementedasapr ogram.A transi
tion
forms an i nputstat
ement ,t
he main contr
olpathf orms t
he sequence of
i
nstructions, t
hebranchesformthecondi
ti
ons,andthebackwardpat
hsf ormt he
l
oopsori terati
ons.
Page55of55
State Machine Engine :Thisappr oach directlyr epr
esentsa state machine
throughast at
emachi neengineclass.Thiscl assexecut esthestatemachi ne
throughasetoftransiti
onsandacti
onspr ovidedbyt heappli
cati
on.
Co ntr
olasConcur r
entTasks:I nthisappr oach,anobj ecti
simplementedasa
taskint heprogrammi nglanguageort heoper ati
ngsy stem.Here,anev entis
i
mpl emented asani nter
-t
askcall.Itpreser vesi nherentconcur
rencyofr eal
objects.
Packagi
ngCl
asses
I
nanyl ar
gepr oj
ect,meti
culouspar t
it
ioningofani mplement
ati
oni ntomodul
esor
packagesisimpor t
ant
.Dur i
ngobj ectdesi gn,cl
assesandobjectsar egr
oupedint
o
packagestoenabl
emul t
ipl
egr oupstowor kcooperati
vel
yonaproject
.
Thedi
ff
erentaspect
sofpackagi
ngar
e:
Hidi
ngI nt ernalI nformationf r
om OutsideVi ew:I tall
owsacl asstobev iewedas
a“blackbox”andper mitsclassimplement ationtobechangedwi thoutrequi r
ing
anyclient soft hecl asstomodi f
ycode.
CoherenceofEl ement s:Anel ement,suchasacl ass,anoperat
ion,oramodul e,
i
scoher enti fitisor gani
zedonaconsi stentpl anandal li
tspart
sar eint
rinsicall
y
rel
atedsot hattheyser veacommongoal .
Construct ion of Phy si
calModul es :The f ol
lowing guidel
ines help whi l
e
construct ingphy sicalmodul es:
o Cl assesi namodul eshouldrepresentsi milarthi
ngsorcomponent sint he
samecomposi teobject.
o Cl osel yconnect edclassesshouldbei nthesamemodul e.
o Un connect edorweakl yconnectedcl assesshoul dbeplacedi nsepar ate
modul es.
o Mo dul esshoul dhav egoodcohesi on,i .
e.,highcooperationamongi ts
component s.
o Amo duleshoul dhav elowcouplingwi thot hermodules,i
.e.,i
nter
actionor
inter dependencebet weenmodul esshoul dbemi nimum.
Desi
gnOpt
imi
zat
ion
Theanal
ysismodelcaptur
esthelogi
calinf
ormati
onaboutthesyst
em, whi
lethedesign
modeladds detai
lsto supporteffi
cientinf
ormat
ion access.Before a desi
gn is
i
mplemented,i
tshoul
dbeopt i
mizedsoast omaket heimplement
ati
onmor eef f
ici
ent
.
Theaim ofopti
mizati
onistomi nimizethecostinter
msoft i
me,space,andot her
metr
ics.
However,design opt
imizat
ion shoul
d notbe excess,as ease ofimplement
ati
on,
maint
ainabi
l
ity,andextensi
bil
i
tyarealsoi mport
antconcerns.I
tisof
tenseenthata
per
fect
lyoptimizeddesignismor eeffi
cientbutlessreadabl
eandreusabl
e.Sothe
Page56of56
desi
gnermustst
ri
keabal
ancebet
weent
het
wo.
Thev
ari
oust
hingst
hatmaybedonef
ordesi
gnopt
imi
zat
ionar
e:
Addredundantassoci
ations
Omitnon-usabl
eassociati
ons
Opt
imizati
onofalgori
thms
Sav
eder i
vedattr
ibut
est oavoi
dre-
comput
ati
onofcompl
exexpr
essi
ons
Addi
ti
onofRedundantAssoci
ati
ons
Duri
ng design opt
imization,i
ti schecked ifderi
vi
ng new associ
ati
onscan r
educe
accesscosts.Thought heseredundantassoci
ati
onsmaynotaddanyi nfor
mat
ion,t
hey
mayi ncr
easetheeffi
ciencyoftheoveral
lmodel.
Omi
ssi
onofNon-
Usabl
eAssoci
ati
ons
Presenceoft oomanyassociat
ionsmayrenderasy
stem i
ndecipher
abl
eandhence
reducetheov eral
leff
ici
encyofthesyst
em.So,dur
ingopti
mizati
on,al
lnon-
usabl
e
associat
ionsareremoved.
Opt
imi
zat
ionofAl
gor
it
hms
Inobject-
ori
ent
edsy st
ems,optimi
zati
onofdatastr
uct
ureandal
gori
thmsar edoneina
coll
aborati
ve manner.Once the cl
ass desi
gn i
sin pl
ace,t
he operat
ions and t
he
algor
ithmsneedtobeoptimized.
Opt
imi
zat
ionofal
gor
it
hmsi
sobt
ainedby
:
Rearr
angementoftheor
derofcomput
ational
tasks
Rever
salofexecut
ionor
derofl
oopsfr
om thatlai
ddowni
nthef
unct
ional
model
Remov al
ofdeadpathswit
hint
heal
gori
thm
Sav
ingandSt
ori
ngofDer
ivedAt
tri
but
es
Deriv
edat t
ri
butesarethoseat tr
ibuteswhosev al
uesar ecomput
edasaf unct
ionof
otheratt
ri
butes(baseattri
butes).Re-comput
ationofthev al
uesofder
ivedattr
ibutes
everyti
met heyareneededi sat i
me–consumi ngprocedur
e.Toavoi
dthis,thevalues
canbecomput edandstoredintheircomputedforms.
Howev
er,
thismayposeupdat
eanomali
es,
i.
e.,
achangeintheval
uesofbaseatt
ri
but
es
wi
thnocorr
espondi
ngchangeint
heval
uesofthederi
vedatt
ri
butes.Toavoi
dthi
s,t
he
f
oll
owi
ngstepsaret
aken:
Wi
theachupdat
eoft
hebaseat
tri
but
eval
ue,t
heder
ivedat
tr
ibut
eisal
sor
e-
Page57of57
computed.
Allthederi
vedattr
ibut
esarere-
comput
edandupdat
edper
iodi
cal
l
yinagr
oup
rat
herthanaft
ereachupdat
e.
Desi
gnDocument
ati
on
Documentat
ionisanessenti
alpar
tofanysof t
waredev el
opmentprocessthatr
ecor
ds
thepr
ocedureofmakingthesof
tware.Thedesigndeci
sionsneedtobedocumentedfor
anynon–t
riv
ialsof
twaresyst
em f
ortransmi
tti
ngthedesigntoother
s.
UsageAr
eas
Thoughasecondar
ypr
oduct
,agooddocument
ati
oni
sindi
spensabl
e,par
ti
cul
arl
yint
he
fol
l
owingar
eas:
I
ndesi gningsoftwarethati
sbeingdevel
opedbyanumberofdev
eloper
s
I
niter
at i
v esoft
war edevel
opmentstr
ategies
I
ndev elopingsubsequentversi
onsofasof t
war
epr
oject
Forevaluatingasof t
ware
Forfi
ndi ngconditi
onsandareasoftesti
ng
Formai ntenanceofthesoftwar
e.
Cont
ent
s
Abenef
ici
aldocument
ati
onshoul
dessent
ial
l
yincl
udet
hef
oll
owi
ngcont
ent
s:
High–l
evelsystem ar
chit
ect
ure:Processdiagramsandmodul ediagrams
Keyabstr
actionsandmechanisms: Classdiagramsandobjectdiagr
ams.
Scenar
ios thatill
ustr
atethe behavioroft he main aspects :Behavi
our
al
di
agrams
Feat
ures
Thef
eat
uresofagooddocument
ati
onar
e:
Conciseandatt hesamet i
me,unambiguous,consi
stent
,andcompl
ete
Traceabletothesy st
em’sr
equirementspeci
fi
cati
ons
Well-
struct
ured
Di
agr ammat i
cinsteadofdescr
ipti
ve
Page58of58
OOADI
mpl
ement
ati
onSt
rat
egi
es
I
mplementing anobject
-ori
ented desi
gngener
all
yinvol
vesusing astandard obj
ect
or
ient
edpr ogramminglanguage(OOPL)ormappi ngobj
ectdesignst
odat abases.In
mostcases,iti
nvol
vesboth.
I
mpl
ement
ati
onusi
ngPr
ogr
ammi
ngLanguages
Usuall
y,t hetaskoftransfor
mi ng an objectdesign i
nto codei
sa str
aightf
orward
process.Anyobject
-or
ientedprogrammi nglanguageli
keC++,Java,Smal
lt
alk,C#and
Python,incl
udesprovi
sionforrepresenti
ngclasses.Inthi
schapter
,weexempl i
fythe
conceptusingC++.
Thef
oll
owi
ngf
igur
eshowst
her
epr
esent
ati
onoft
hecl
assCi
rcl
eusi
ngC++.
I
mpl
ement
ingAssoci
ati
ons
Mostpr ogr
amminglanguagesdonotpr ovi
deconstruct
stoimplementassoci
ati
ons
di
rect
ly.Sothet
askofimplement
ingassoci
ati
onsneedsconsi
der
ablet
hought.
Page59of59
Associ
ati
onsmaybeei therunidir
ect
ionalorbi
dir
ectional
.Besi
des,eachassoci
ati
on
maybeeitherone–t
o–one,one–to–many,ormany–to–many .
Uni
dir
ect
ionalAssoci
ati
ons
For i
mplementi
ng unidi
rect
ional associ
ati
ons, car
e should be t
aken so that
uni
dir
ect
ional
i
tyismaintai
ned.Thei mplementat
ionsfordi
ffer
entmult
ipl
i
cit
yar
eas
fol
l
ows:
Opti
onalAssoci ati
ons :Here,a li
nk may ormay notexi
stbetween the
part
icipat
ingobject
s.Forexample,i
ntheassoci
ati
onbet
weenCustomerand
CurrentAccountinthef
igur
ebelow,acust
omermayormaynothaveacurrent
account.
Forimpl
ementat
ion,an obj
ectofCurr
entAccounti
sincl
uded as an at
tr
ibut
ein
Cust
omerthatmaybeNULL.Impl
ement
ati
onusi
ngC++:
cl
assCust omer
{
pri
vate:
//att
ributes
Curr
ent _Accountc;
//anobj
ectofCur
rent
_Accountasat
tr
ibut
e
publ
i
c:
Customer(
)
{
c=NULL;
}//assi
gncasNULL
Current
_Accountget
Cur
rAc(
)
{
ret
urnc;
}
voi
dsetCurr
Ac(Cur
rent
_Accountmy
acc)
{
c=my acc;
}
v
oidr
emov
eAcc(
)
{
Page60of60
c=NULL;
}
}
;
One–to–oneAssociati
ons:Here,oneinst
anceofacl assisrel
atedt
oexact
ly
oneinstanceoftheassociat
edclass.Forexample,Depar
tmentandManager
haveone–to–oneassoci
ati
onasshowni nt
hefigur
ebelow.
Thi
sisimpl
ementedbyincludi
nginDepar
tment
,anobj
ectofManagert
hatshoul
dnot
beNULL.I
mplementat
ionusingC++:
cl
assDepar t
ment
{
pri
vate:
//att
ribut
es
Managermgr ;
//anobj
ectofManagerasat
tri
but
e
publi
c:
Department(
/*par
ameter
s*/,
Managerm)/
/mi
snotNULL
{
//assi
gnparameterst
ovari
ables
mgr=m;
}
Managerget
Mgr
()
{
ret
urnmgr;
}
}
;
One–to–manyAssoci
ati
ons:Her e,oneinst
anceofacl assisrel
atedtomore
than one i
nst
ances of t
he associat
ed class.Forexampl e,consi
der t
he
associ
ati
onbet
weenEmployeeandDependentinthefol
l
owi ngf
igur
e.
Thi
si simplemented by i
ncl
uding a li
st of Dependent
sin cl
ass Empl
oyee.
I
mplement
ati
onusingC++STLli
stcont
ainer
:
cl
assEmpl
oyee
Page61of61
{
pri
vate:
char*deptName;
l
ist<Dependent
>dep;
//al
i
stofDependent
sasat
tr
ibut
e
publ
ic:
voi
daddDependent(Dependentd)
{
dep.
push_back(
d);
}//addsanemployeet
ot hedepar
tment
voi
dr emov eDeoendent(Dependentd)
{
i
ntindex=f ind(d,dep) ;
//fi
nd( )f
uncti
onreturnstheindexofdinl
i
stdep
dep.erase(
index)
;
}
}
;
Bi
-di
rect
ional
Associ
ati
ons
To i
mplementbi
-di
rect
ionalassoci
ati
on,l
i
nks i
n bot
h di
rect
ions r
equi
ret
o be
mai
ntai
ned.
Opti
onalorone–t o–one Associ
ati
ons :Consi
derthe r
elati
onshi
p between
Proj
ectandPr oj
ectManagerhavingone–t
o–onebidir
ect
ionalassoci
ati
onas
showninthef
igurebel
ow.
I
mpl
ement
ati
onusi
ngC++:
ClassPr oject
{
pr i
vat e:
/ /attributes
Pr oject _
Managerpmgr;
publ ic:
v oidset Manager(Proj
ect
_Managerpm)
;
Pr oject _
ManagerchangeManager
();
};
cl
assPr
oject
_Manager
{
Page62of62
pri
vate:
//att
ribut
es
Proj
ectpj;
public:
voidsetProj
ect(
Proj
ectp);
ProjectremoveProj
ect
();
}
;
One–to–manyAssociati
ons:Consi
dert
herel
ati
onshi
pbet
weenDepart
mentand
Employeehav
ingone–to–manyassoci
ati
onasshownint
hefi
gur
ebelow.
I
mpl
ement
ati
onusi
ngC++STLl
i
stcont
ainer
:
cl
assDepartment
{
pri
vate:
char*deptName;
l
ist<Employee>emp;
//al
i
stofEmpl
oyeesasat
tr
ibut
e
publ
ic:
voi
daddEmployee(Employ
eee)
{
emp.push_
back(e);
}//addsanempl oy
eet
othedepar
tment
voi
dr emov eEmpl oyee(Employeee)
{
i
ntindex=f ind(e, emp) ;
//f
indf unctionreturnsthei
ndexofeinl
i
stemp
emp.erase(index);
}
}
;
cl
assEmpl oyee
{
priv
ate:
//att
ri
butes
Departmentd;
publ
ic:
voi
daddDept
();
Page63of63
voi
dremov
eDept
();
}
;
I
mpl
ement
ingAssoci
ati
onsasCl
asses
Ifanassoci
ati
onhassomeat t
ri
butesassociat
ed,itshoul
dbei mpl
ement
edusi
nga
separ
atecl
ass.Forexample,considertheone–to–oneassoci
ati
onbet
weenEmpl
oyee
andProj
ectasshowninthefigurebelow.
I
mpl
ement
ati
onofWor
ksOnusi
ngC++:
cl
assWor ksOn
{
pri
vat
e:
Employeee;
Proj
ectp;
Hoursh;
char*date;
publ
ic:
//cl
assmet
hods
}
;
I
mpl
ement
ingConst
rai
nts
Constrai
ntsinclassesrestri
cttherangeandt ypeofv al
uesthattheat
tri
but
esmayt ake.
Inordertoimplementconst rai
nts,avali
ddefaultval
ueisassignedtotheat
tri
butewhen
anobjectisinstant
iatedfrom theclass.Whenev ert
hev al
ueischangedatrunti
me,itis
checkedwhet hert hev al
uei sv al
idornot .Ani nvali
dv al
uemaybehandl edbyan
excepti
onhandlingr out
ineorothermet hods.
Exampl
e
Consi
deranEmploy
eecl
asswher
eageisanatt
ri
butet
hatmayhav
eval
uesi
nther
ange
of18to60.Thef
oll
owi
ngC++codei
ncor
porat
esit
:
cl
assEmpl
oyee
Page64of64
{
pri
vate:char*name;
i
ntage;
//otheratt
ribut
es
publi
c:
Employee() //def
aultconst
ruct
or
{
str
cpy(name,"
")
;
age=18; /
/defaul
tvalue
}
classAgeErr
or{}; /
/Excepti
onclass
voidchangeAge(inta) / /methodthatchangesage
{
i
f(a<18| |
a>60)/ /checkforinv
ali
dconditi
on
throwAgeError
(); / /throwexcepti
on
age=a;
}
}
;
I
mpl
ement
ingSt
ateChar
ts
Ther
earetwoal
ter
nat
ivei
mpl
ement
ati
onst
rat
egi
est
oimpl
ementst
atesi
nst
atechar
t
di
agrams.
Enumer
ati
onswi
thi
nCl
ass
Inthi
sapproach,t
hestat
esarerepresent
edbydi f
fer
entvaluesofadatamember(orset
ofdatamember s)
.Thevaluesareexpli
cit
lydef
inedbyanenumer at
ionwithi
nthecl
ass.
Thet r
ansit
ionsarerepr
esentedbymemberf unct
ionsthatchanget heval
ueoft he
concerneddatamember.
Ar
rangementofCl
assesi
naGener
ali
zat
ionHi
erar
chy
I
nthisappr
oach,thestat
esarear
rangedinageneral
izat
ionhierarchyinamannert
hat
t
heycanber ef
erredbyacommonpoi nterv
ariabl
e.Thef ollowingf i
gur
eshowsa
t
ransf
ormati
onfrom st
atechar
tdi
agram t
oagenerali
zati
onhierarchy.
Page65of65
Obj
ectMappi
ngt
oDat
abaseSy
stem
Per
sist
encyofObj
ect
s
Animportantaspectofdevel
opingobject-
ori
entedsyst
emsispersi
stencyofdat a.
Thr
oughper si
stency
,obj
ect
shav elongerli
fespanthanthepr
ogram t
hatcreatedit.
Per
sist
entdataissavedonsecondarystor
agemedium fr
om wher
eitcanbereloaded
whenrequi
red.
Ov
erv
iewofRDBMS
Adat
abasei
sanor
der
edcol
l
ect
ionofr
elat
eddat
a.
I
nrel
ati
onaldatabasemanagementsyst
ems( RDBMS)
,dataisst
oredasrel
ati
onsor
t
abl
es,whereeachcol umnorf i
eldr
epresent
sanattri
but
eandeachr ow ortupl
e
r
epr
esentsarecordofani
nst
ance.
Eachr
owi
suni
quel
yident
if
iedbyachosensetofmi
nimal
att
ri
but
escal
l
edpr
imar
ykey
.
Af
orei
gnkeyi
sanat
tri
but
ethati
sthepr
imar
ykeyofar
elat
edt
abl
e.
Repr
esent
ingCl
assesasTabl
esi
nRDBMS
Tomapacl asstoadatabasetabl
e,eachat
tri
buteisrepresent
edasafi
eldint
hetabl
e.
Eit
heranex i
sti
ngatt
ri
bute(s)i
sassignedasapr i
mar ykeyoraseparateIDfi
eldis
addedasapr imar
ykey.Theclassmaybepar t
it
ionedhor i
zont
all
yorv
erti
cal
l
yasper
requi
rement
.
Page66of66
Forexampl
e,t
heCi
rcl
ecl
asscanbeconv
ert
edt
otabl
easshowni
nthef
igur
ebel
ow.
Schemaf orCi
rcl
eTable:CIRCLE(
CID,
X_COORD,
Y_COORD,
RADI
US,
COLOR)
Creati
ngaTableCir
cleusingSQLcommand:
CREATETABLECI RCLE
(
CID VARCHAR2( 4)PRI MARYKEY,
X_ COORDINTEGERNOTNULL,
Y_ COORDINTEGERNOTNULL,
Z_ COORDINTEGERNOTNULL,
COLOR
);
Mappi
ngAssoci
ati
onst
oDat
abaseTabl
es
One–t
o–OneAssoci
ati
ons
Toimplement1:1associ
ati
ons,t
hepri
marykeyofanyonetabl
eisassignedasthe
for
eign key oft
he othertabl
e.Forexample,consi
dert
he associ
ati
on bet
ween
Depart
mentandManager:
SQLcommandst
ocr
eat
ethet
abl
es:
CREATETABLEDEPARTMENT
(
DEPT_I
DINTEGERPRIMARYKEY,
DNAMEVARCHAR2(30)NOTNULL,
Page67of67
LOCATI
ONVARCHAR2(20)
,
EMPIDI
NTEGERREFERENCESMANAGER
)
;
CREATETABLEMANAGER
(
EMPIDINTEGERPRI
MARYKEY,
ENAMEVARCHAR2(50)NOTNULL,
ADDRESSVARCHAR2(70)
,
);
One–t
o–ManyAssoci
ati
ons
To impl
ement1:N associ
ati
ons,thepri
marykeyoft hetabl
einthe1-sideoft he
associ
ati
onisassi
gnedastheforei
gnkeyofthet
abl
eattheN-si
deoftheassoci
ati
on.
Forexample,
consi
dert
heassociati
onbet
weenDepar
tmentandEmpl
oyee:
SQLcommandst
ocr
eat
ethet
abl
es:
CREATETABLEDEPARTMENT
(
DEPT_I
DINTEGERPRIMARYKEY,
DNAMEVARCHAR2(30)NOTNULL,
LOCATI
ONVARCHAR2( 20)
,
);
CREATETABLEEMPLOYEE
(
EMPIDINTEGERPRI
MARYKEY,
ENAMEVARCHAR2(50)NOTNULL,
ADDRESSVARCHAR2(70)
,
D_I
DINTEGERREFERENCESDEPARTMENT
);
Many
–to–ManyAssoci
ati
ons
To implementM:N associ
ati
ons,a new rel
ati
on i
s created t
hatrepr
esentsthe
associ
ati
on.Forexampl
e,consi
dert
hef ol
l
owingassoci
ationbetweenEmployeeand
Page68of68
Pr
oject
:
Schemaf
orWor
ks_
OnTabl
e:WORKS_
ON(
EMPI
D,PI
D,HOURS,
START_
DATE)
SQLcommandt
ocr
eat
eWor
ks_
Onassoci
ati
on:
CREATETABLEWORKS_
ON
(
EMPIDINTEGER,
PIDINTEGER,
HOURSI NTEGER,
START_DATEDATE,
PRIMARYKEY( EMPID,
PID),
FOREIGNKEY( EMPI
D)REFERENCESEMPLOYEE,
FOREIGNKEY( PI
D)REFERENCESPROJECT
)
;
Mappi
ngI
nher
it
ancet
oTabl
es
Tomapinheri
tance,t
hepr
imarykeyoft
hebasetabl
e(s)i
sassi
gnedast
hepr
imar
ykey
aswel
lastheforei
gnkeyi
nthederi
vedt
abl
e(s)
.
Exampl
e
Page69of69
OOADTest
ingandQual
it
yAssur
ance
Onceapr
ogram codei
swritt
en,
itmustbet
est
edtodetectandsubsequent
lyhandl
eal
l
er
ror
sini
t.Anumberofschemesareusedf
ort
est
ingpurposes.
Anotheri
mportantaspectisthef
it
nessofpurposeofa pr
ogr
am thatascer
tai
ns
whethert
heprogram serv
esthepurposewhi
chitai
msfor
.Thefit
nessdefi
nesthe
sof
twarequal
i
ty.
Test
ingObj
ect
-Or
ient
edSy
stems
Test
ing i
s a conti
nuous act
ivi
ty dur
ing sof
twar
e development
.In obj
ect-
ori
ented
syst
ems,testi
ngencompassesthr
eelevel
s,namel
y,uni
ttesti
ng,
subsy
stem t
est
ing,and
syst
em t
esting.
Page70of70
Uni
tTest
ing
Inunitt
esti
ng,theindi
vi
dualclassesaretest
ed.I
tisseenwhethertheclassatt
ri
but
es
areimplementedasperdesignandwhet herthemethodsandtheinter
facesareerr
or-
fr
ee.Unittest
ingistheresponsibi
li
tyoft
heappli
cati
onengineerwhoimpl ementst
he
str
uctur
e.
Subsy
stem Test
ing
Thisinv
olvestest
ingaparti
cularmodul eorasubsy st
em andistheresponsi
bil
i
tyofthe
subsyst
em lead.I
tinvol
vestesti
ngtheassoci at
ionswithi
nthesubsyst
em aswellasthe
i
nteract
ion ofthe subsyst
em wi tht he outsi
de.Subsy st
em test
s can be used as
regr
essiontest
sforeachnewl yrel
easedv er
sionofthesubsyst
em.
Sy
stem Test
ing
System test
inginvol
vestest
ingthesyst
em asawholeandist
heresponsi
bil
it
yofthe
quali
ty-
assuranceteam.Thet eam of
tenusessy
stem t
est
sasregressi
ontestswhen
assemblingnewr el
eases.
Obj
ect
-Or
ient
edTest
ingTechni
ques
Gr
eyBoxTest
ing
Thedi ff
erentt
ypesoftestcasest hatcanbedesi
gnedf
ortesti
ngobject
-ori
ent
ed
programsar ecal
ledgr
eyboxt estcases.Someoft
heimpor
tanttypesofgreybox
test
ingare:
Statemodelbasedt est
ing:Thi sencompassesstatecoverage,st
atetransi
ti
on
coverage, andst atetr
ansiti
onpat hcover
age.
Us ecasebasedt esti
ng: Eachscenari
oineachusecaseistested.
Classdi agr am based t esting :Each cl
ass,deri
ved cl
ass,associat
ions,and
aggregationsar et est
ed.
Sequence di agram based t est
ing :The methods i
nt he messages i nthe
sequencedi agramsar etested.
Techni
quesf
orSubsy
stem Test
ing
Thet
womai
nappr
oachesofsubsy
stem t
est
ingar
e:
Thr
eadbasedtesting:Allclassesthatareneededtor eal
i
zeasi ngl
eusecasein
asubsyst
em ar
eintegr
atedandt est
ed.
Usebasedtest
ing:Thei nterfacesandservi
cesoft hemodul esateachlev
elof
hi
erar
chyaretested.Test i
ngst art
sf r
om thei ndi
vidualclassestothesmall
modulescompri
singofcl asses,gradual
lytolargermodul es,andfi
nal
lyal
lthe
Page71of71
maj
orsubsy
stems.
Cat
egor
iesofSy
stem Test
ing
Alphat esti
ng:Thisiscarri
edoutbythet est
ingteam wit
hintheorgani
zat
iont
hat
developssof t
ware.
Betat est i
ng:Thi
si scarr
iedoutbyselectgroupofco-operat
ingcustomer
s.
Accept ancet est
ing:Thi siscarr
iedoutbyt hecustomerbef or
eaccepti
ngthe
deli
ver ables.
Sof
twar
eQual
it
yAssur
ance
Sof
twar
eQual
it
y
Schul
mey erandMcManushav edef i
nedsoft
warequali
tyas“t
hefit
nessforuseofthe
tot
alsoft
war eproduct”
.Agoodquali
tysof
twaredoesexact
lywhati
tissupposedt
odo
andisinter
pret
edi nter
msofsati
sfacti
onofther
equir
ementspeci
fi
cati
onlai
ddownby
theuser.
Qual
it
yAssur
ance
Soft
war equalit
yassur
ancei samet hodologythatdeterminestheextentt
owhicha
soft
warepr oducti
sfi
tforuse.Theacti
vit
iesthatar
eincludedfordet
ermini
ngsof
twar
e
qual
ityare:
Auditi
ng
Developmentofstandardsandgui
del
i
nes
Producti
onofreports
Reviewofquali
tysystem
Qual
it
yFact
ors
Obj
ect
-Or
ient
edMet
ri
cs
Page72of72
Metr
icscanbebroadlycl
assi
fi
edi
ntot
hreecat
egor
ies:pr
ojectmet
ri
cs,
productmet
ri
cs,
andprocessmet
rics.
Pr
ojectMet
ri
cs
Proj
ectMet r
ics enabl
e a soft
ware pr
ojectmanagerto assess t
he st
atus and
perf
ormanceofanongoi ngproj
ect
.Thefollowi
ngmetr
icsar
eappropri
atef
orobject
-
ori
entedsof
twareproj
ect
s:
Numberofscenari
oscr i
pts
Numberofkeyclasses
Numberofsupportclasses
Numberofsubsystems
Pr
oductMet
ri
cs
Productmetri
csmeasuret
hecharact
eri
sti
csofthesoftwar
eproductt
hathasbeen
devel
oped.Thepr
oductmet
ri
cssui
tabl
eforobj
ect
-or
ient
edsyst
emsare:
Pr
ocessMet
ri
cs
Processmet r
icshelpinmeasuri
nghow aprocessisperfor
ming.Theyarecol
lect
ed
overallprojectsoverl
ongperi
odsofti
me.Theyar eusedasi ndi
cat
orsforl
ong-t
erm
soft
war eprocessimprovement
s.Somepr
ocessmetricsar
e:
NumberofKLOC( Kil
oLinesofCode)
Defectremovalef
fici
ency
Averagenumberoff ai
luresdet
ect
eddur
ingt
est
ing
Numberofl at
entdefectsperKLOC
Page73of73