Вы находитесь на странице: 1из 14

SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process

!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),


CHP 6 : OO Design Process
OBJECTIVES :
At the end of this chapter, stdents sho!d "e a"!e to
Define and nderstand the o"#ect$oriented design process
E%p!ain the o"#ect$oriented design r!es
&
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Introdction
'ain focs of the ana!(sis phase of S) de*e!op+ent
,-hat needs to "e done.
O"#ects disco*ered dring ana!(sis ser*e as the
fra+e-or/ for design
C!ass0s attri"tes, +ethods, and associations identified
dring ana!(sis +st "e designed for i+p!e+entation as
a data t(pe e%pressed in the i+p!e+entation !angage
Dring the design phase, -e e!e*ate the +ode! into
!ogica! entities, so+e of -hich +ight re!ate +ore to the
co+pter do+ain 1sch as ser interface, or the access
!a(er2 than the rea! -or!d or the ph(sica! do+ain 1sch
as peop!e or e+p!o(ees23 Start thin/ing ho- to acta!!(
i+p!e+ent the pro"!e+ in a progra+3
The goa! to design the c!asses that -e need to
i+p!e+ent the s(ste+3
4
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Design is a"ot prodcing a so!tion that +eets the
re5ire+ents that ha*e "een specified dring ana!(sis3
Ana!(sis Verss Design
OO design process in the nified approach are as
"e!o-, 6igre & :
7
Ana!(sis :
o -oc+s on
+nderstanding t#e
!roble)
o Ideali.ed
design
o /e#a0ior
o Syste)
str+ct+re
o -+nctional
re1+ire)ents
o % s)all
Design:
o -oc+s on
+nderstanding t#e
sol+tion
o O!erations &
attrib+tes
o !er'or)ance
o close to real
code
o object
li'ecycles
o non-'+nctional
8efine 9': c!ass
diagra+s
App!( design
a%io+s
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
6igre & : OO Design :
OO Design A%io+s
An a%io+ ; is a fnda+enta! trth that a!-a(s is
o"ser*ed to "e *a!id and for -hich there is no
contere%a+p!e or e%ception3
A theore+ ; is a proposition that +a( not "e se!f$
e*ident "t can "e pro*en fro+ accepted a%io+s3
Therefore, is e5i*a!ent to a !a- or princip!e3
<
Contine testing
Design
c!asses,
+ethods,
attri"tes, =
associations
Design
*ie- >access
!a(ers =
protot(pe
9ser
satisfaction =
sa"i!it( tests
"ased on se$
cases
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
A theore+ is *a!id if its referent a%io+s = dedcti*e
steps are *a!id3
A coro!!ar( ; is a proposition that fo!!o-s fro+ an
a%io+ or another proposition that has "een pro*en
Sh0s design a%io+s to OOD :
A%io+ & : 2#e inde!endence a3io)3 'aintain the
independence of co+ponents
A%io+ 4 : 2#e in'or)ation a3io)3 'ini+i?e the
infor+ation content of the design3
A%io+ & states that, dring the design process, as -e
go fro+ re5ire+ent and se$case to a s(ste+
co+ponent, each co+ponent +st satisf( that
re5ire+ent, -ithot affecting other re5ire+ents
A%io+ 4 concerned -ith si+p!icit(3 8e!( on a
genera! r!e /no-n as Occa)4s ra.or$
@
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Occa)4s ra?or r!e of si+p!icit( in OO ter+s :
2#e best designs +s+ally in0ol0e t#e least co)!le3
code b+t not necessarily t#e 'e5est n+)ber o'
classes or )et#ods$ Mini)i.ing co)!le3ity s#o+ld
be t#e goal* beca+se t#at !rod+ces t#e )ost easily
)aintained and en#anced a!!lication$ In an object-
oriented syste)* t#e best 5ay to )ini)i.e co)!le3ity
is to +se in#eritance and t#e syste)4s b+ilt-in classes
and to add as little as !ossible to 5#at already is
t#ere$
Coro!!aries
'a( "e ca!!ed Design rules, and a!! are deri*ed fro+
the t-o "asic a%io+s :
The origin of co!!aries as sho-n in figre 43 Coro!!aries
&,4 and 7 are fro+ "oth a%io+s, -hereas coro!!ar( < is
fro+ a%io+ & and coro!!aries @ = 6 are fro+ a%io+ 43
6
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
6igre 4 : Origin of coro!!aries3
Corollary 1 : Uncoupled design with less
information content3
Hig#ly co#esi0e objects can i)!ro0e co+!ling
beca+se only a )ini)al a)o+nt o' essential
in'or)ation need be !assed bet5een objects
Main goal )a3i)i.e objects co#esi0eness
a)ong objects & s5 co)!onents to i)!ro0e
co+!ling
A
Coro!!ar( <
A%io+ &
A%io+ 4
Coro!!ar( 6 Coro!!ar( @
Coro!!ar( 7
Coro!!ar( 4
Coro!!ar( &
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Strong co+!ling a)ong objects co)!licates a
syste)* since t#e class is #arder to +nderstand or
#ig#ly interrelated 5it# ot#er classes$
egree or strengt# o' co+!ling bet5een t5o
co)!onents is )eas+red by t#e a)o+nt &
co)!le3ity o' in'or)ation trans)itted bet5een
t#e)
OO design #as 6 ty!es o' co+!ling : Interaction
co+!ling and In#eritance co+!ling
Interaction co+!ling t#e a)o+nt & co)!le3ity
o' )essages bet5een co)!onents$
Desira"!e to ha*e a !itt!e interaction3
'ini+i?e the n+"er of +essages sent =
recei*ed "( an o"#ect
T(pes of cop!ing a+ong o"#ects or
co+ponents , refer figre 7 3
B
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
6igre 7 : T(pes of Cop!ing
Degree of
cop!ing
Ca+e Description
Ver( High Content
Cop!ing
Connection in*o!*es direct
reference to attri"tes or
+ethods of another o"#ect
High Co++on
Cop!ing
Connection in*o!*es t-o
o"#ects accessing a Dg!o"a! data
space0, for "oth to read = -rite
'edi+ Contro!
Cop!ing
Connection in*o!*es e%p!icit
contro! of the processing !ogic
of one o"#ect "( another
:o- Sta+p
cop!ing
Connection in*o!*es passing an
aggregate data strctre to
another o"#ect, -hich ses on!(
a portion of the co+ponents of
the data strctre
Ver( !o- Data
cop!ing
Connection in*o!*es either
si+p!e data ite+s or aggregate
strctres a!! of -hose e!e+ents
are sed "( the rece*ing o"#ect3
1 this is the goa! of an
architectra! design2
E
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
In#eritance co+!ling co+!ling bet5een s+!er-
and s+bclasses
A s"c!ass is cop!ed to its sperc!ass in
ter+s of attri"tes = +ethods
High inheritance cop!ing is desira"!e
Each specia!i?ation c!ass sho!d not inherit
!ots of nre!ated = nneeded +ethods =
attri"tes
"eed to consider interaction 5it#in a single
object or s5 co)!onent Co#esion
Cohesion ref!ects the0sing!e$prposeness0
of an o"#ect 1 see coro!!aries 4 = 7 2
'ethod cohesion a +ethod sho!d carr(
on!( one fnction3
A +ethod carries +!tip!e fnctions is
ndesira"!e
&F
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Corollary 2 : Single purpose3
7ac# class )+st #a0e a !+r!ose & clearly de'ined
7ac# )et#od )+st !ro0ide only one ser0ice
Corollary 3 : Large number of simple classes3
8ee!ing t#e classes si)!le allo5s re+sability
% class t#at easily can be +nderstood and re+sed
9or in#erited: contrib+tes to t#e o0erall syste)
Co)!le3 & !oorly designed class +s+ally cannot
be re+sed
;+ideline 2#e s)aller are yo+r classes* t#e
better are yo+r c#ances o' re+sing t#e) in ot#er
!rojects$ <arge & co)!le3 classes are too
s!eciali.ed to be re+sed
2#e e)!#asis OO !laces on enca!s+lation*
)od+lari.ation* and !oly)or!#is) s+ggests re+se
rat#er t#an b+ilding ane5
Pri)ary bene'it o' s5 re+sability Hig#er
!r!d+cti0ity
Corollary 4 : Strong mapping3
&&
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
2#ere )+st be a strong association bet5een t#e
analysis4s object and design4s object
OO% and OO are based on t#e sa)e )odel
%s t#e )odel !rogresses 'ro) analysis to
i)!le)entation* )ore detailed is added
Corollary : Standardi!ation3
Pro)ote standardi.ation by designing
interc#angeable co)!onents and re+sing e3isting
classes or co)!onents
2#e conce!t o' design !atterns )ig#t !ro0ide a
5ay to ca!t+re t#e design (no5ledge* doc+)ent
it* and store it in a re!ository t#at can be s#ared
and re+sed in di''erent a!!lications
Corollary " : Design with inheritance3
Co))on be#a0ior 9)et#ods: )+st be )o0ed to
s+!erclasses$
2#e s+!erclass-s+bclass str+ct+re )+st )a(e
logical sense
&4
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Design Patterns
Pro*ides a sche+e for refining the s"s(ste+s or
co+ponents of a s- s(ste+ or the re!ationships a+ong
the+
Are de*ices that a!!o- s(ste+s to share /no-!edge
a"ot their design, "( descri"ing co++on!( recrring
strctres of co++nicating co+ponents that so!*e a
genera! design pro"!e+ -ithin a partic!ar conte%t
The +ain idea to pro*ide doc+entation to he!p
categori?e = co++nicate a"ot so!tions to recrring
pro"!e+s
The pattern has a na+e to faci!itate discssion and the
infor+ation it represents
#eferences :
/a#ra)i* %$9=>>>:$ Object Oriented Syste)s e0elo!)ent* +sing
t#e +ni'ied )odeling lang+age* Mc;ra5-Hill
&7
SIM4307 Object-oriented analysis & design CHP 6 :OO esign Process
!re!ared by "or#ayati Mo#d$%li&'s(t)*+!),
Object Oriented %nalysis and esign +sing ?M<* by @ational
So't5are Cor!oration 96006:
&<

Вам также может понравиться