Design Patterns Explained
-
Upload
sportsmanrahul -
Category
Documents
-
view
226 -
download
0
Transcript of Design Patterns Explained
-
8/13/2019 Design Patterns Explained
1/1069
I l@ve RuBoard
Table of Contents
Design Patterns Explained: A New Perspective on
Object-Oriented DesignBy Alan Shalloway, James R. Trott
Publsher ! Addson
"esley
Pub #ate ! July $%, &$$'
ISB( ! $)&$')
*'+%)+
Pa-es ! /0
1...I would e23e4t that readers wth a bas4 understandn- of ob5e4t)orented 3ro-rammn-
and des-n would fnd ths boo6 useful, before a33roa4hn- des-n 3atterns 4om3letely.
Design Patterns Explained4om3lements the e2stn- des-n 3atterns te2ts and may
3erform a very useful role, fttn- between ntrodu4tory te2ts su4h as 789 #stlled and the
more advan4ed 3atterns boo6s.1 -James Noble
Design Patterns Explained: A New Perspective on Object-Oriented Designdraws to-ether
the 3rn43les of ob5e4t)orented 3ro-rammn- wth the 3ower of des-n 3atterns to 4reate
an envronment for robust and relable software develo3ment. Pa46ed wth 3ra4t4al and
a33l4able e2am3les, ths boo6 tea4hes you to solve 4ommon 3ro-rammn- 3roblems wth
3atterns))and e23lans the advanta-es of 3atterns for modern software des-n.
http://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.html -
8/13/2019 Design Patterns Explained
2/1069
Be-nnn- wth a 4om3lete overvew of the fundamentals of 3atterns, Design Patterns
Explained stresses the m3ortan4e of analyss and des-n. The authors 4learly demonstrate
how 3atterns 4an fa4ltate the overall develo3ment 3ro4ess. Throu-hout the boo6, 6ey
ob5e4t)orented des-n 3rn43les are e23laned, alon- wth the 4on4e3ts and benefts
behnd s3e4f4 3atterns. "th llustratve e2am3les n C:: and Java, the boo6 demystfes
the 1whys,1 1why nots,1 and 1hows1 of 3atterns and e23lans 3attern m3lementaton.
;ey to34s 4overed n4lude!
(ew 3ers3e4tves on ob5e4ts, en4a3sulaton, and nhertan4e
The dea of des-n 3atterns, ther or-ns, and how they a33ly n the ds43lne of
software des-n
Pattern)based, ob5e4t)orented software develo3ment usn- the 7nfed 8odeln-
9an-ua-e ow to m3lement 4rt4al 3atterns))Strate-y, ?bserver, Brd-e, #e4orator, and
many more
Commonaltyarablty Analyss and des-n 3atterns, and how they ad n
understandn- abstra4t 4lasses
rom analyss to m3lementaton, #es-n Patterns 23laned allows you to unleash the true
3otental of 3atterns and 3aves the 3ath for m3rovn- your overall des-ns. Ths boo6
3rovdes new4omers wth a -enunely a44urate and hel3ful ntrodu4ton to ob5e4t)orented
des-n 3atterns.
I l@ve RuBoard
I l@ve RuBoard
http://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_main.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.html -
8/13/2019 Design Patterns Explained
3/1069
Table of Contents
Design Patterns Explained: A New Perspective on
Object-Oriented DesignBy Alan Shalloway, James R. Trott
Publsher ! Addson
"esley
Pub #ate ! July $%, &$$'
ISB( ! $)&$')
*'+%)+Pa-es ! /0
Co3yr-ht
Prefa4e
rom ?b5e4t ?rentaton to Patterns to True ?b5e4t ?rentaton
rom Artf4al Intell-en4e to Patterns to True ?b5e4t ?rentaton
A (ote About Conventons 7sed n Ths Boo6
eedba46
A46nowled-ments
Part I! An Introdu4ton to ?b5e4t)?rented Software #evelo3ment
Cha3ter '. The ?b5e4t)?rented Parad-m
?vervew
Before The ?b5e4t)?rented Parad-m! un4tonal #e4om3oston
The Problem of ReDurements
#ealn- wth Chan-es! 7sn- un4tonal #e4om3oston
#ealn- wth Chan-n- ReDurements
The ?b5e4t)?rented Parad-m
http://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_pref01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://www.informit.com/safari/author_bio.asp@ISBN=0201715945http://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_pref01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec6.html -
8/13/2019 Design Patterns Explained
4/1069
?b5e4t)?rented Pro-rammn- n A4ton
S3e4al ?b5e4t 8ethods
Summary
Cha3ter &. The 789EThe 7nfed 8odeln- 9an-ua-e
?vervew
"hat Is the 789F
"hy 7se the 789F
The Class #a-ram
Intera4ton #a-rams
Summary
Part II! The 9mtatons of Tradtonal ?b5e4t)?rented #es-n
Cha3ter . A Problem That Cres ?ut for le2ble Code
?vervew
2tra4tn- Informaton from a CA#CA8 System
7nderstand the o4abulary
#es4rbe the Problem
The ssental Challen-es and A33roa4hes
Summary
Cha3ter . A Standard ?b5e4t)?rented Soluton
?vervew
Solvn- wth S3e4al Cases
Summary
Su33lement! C:: Code 2am3les
Part III! #es-n Patterns
Cha3ter +. An Introdu4ton to #es-n Patterns
?vervew
#es-n Patterns Arose from Ar4hte4ture and Anthro3olo-y
8ovn- from Ar4hte4tural to Software #es-n Patterns
"hy Study #es-n PatternsF
?ther Advanta-es to Studyn- #es-n Patterns
Summary
Cha3ter /. The a4ade Pattern
?vervew
Introdu4n- the a4ade Pattern
9earnn- the a4ade Pattern
eld (otes! The a4ade Pattern
Relatn- the a4ade Pattern to the CA#CA8 Problem
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch04lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch05lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec5.html -
8/13/2019 Design Patterns Explained
5/1069
Summary
Cha3ter *. The Ada3ter Pattern
?vervew
Introdu4n- the Ada3ter Pattern
9earnn- the Ada3ter Pattern
eld (otes! The Ada3ter Pattern
Relatn- the Ada3ter Pattern to the CA#CA8 Problem
Summary
Su33lement! C:: Code 2am3le
Cha3ter 0. 23andn- ?ur >orGons
?vervew
?b5e4ts! the Tradtonal ew and the (ew ew
n4a3sulaton! the Tradtonal ew and the (ew ew
nd "hat Is aryn- and n4a3sulate It
Commonaltyarablty and Abstra4t Classes
Summary
Cha3ter %. The Brd-e Pattern
?vervew
Introdu4n- the Brd-e Pattern
9earnn- the Brd-e Pattern! An 2am3le
An ?bservaton About 7sn- #es-n Patterns
9earnn- the Brd-e Pattern! #ervn- It
The Brd-e Pattern n Retros3e4t
eld (otes! 7sn- the Brd-e Pattern
Summary
Su33lement! C:: Code 2am3les
Cha3ter '$. The Abstra4t a4tory Pattern
?vervew
Introdu4n- the Abstra4t a4tory Pattern
9earnn- the Abstra4t a4tory Pattern! An 2am3le
9earnn- the Abstra4t a4tory Pattern! Im3lementn- It
eld (otes! The Abstra4t a4tory Pattern
Relatn- the Abstra4t a4tory Pattern to the CA#CA8 Problem
Summary
Su33lement! C:: Code 2am3les
Part I! Puttn- It All To-ether! Thn6n- n Patterns
Cha3ter ''. H>ow #o 23erts #es-nF
?vervew
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part04.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch06lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch07lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch08lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch09lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch10lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part04.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec1.html -
8/13/2019 Design Patterns Explained
6/1069
Buldn- by Addn- #stn4tons
Summary
Cha3ter '&. Solvn- the CA#CA8 Problem wth Patterns
?vervew
Revew of the CA#CA8 Problem
Thn6n- n Patterns
Thn6n- n Patterns! Ste3 '
Thn6n- n Patterns! Ste3 &a
Thn6n- n Patterns! Ste3 &b
Thn6n- n Patterns! Ste3 &4
Thn6n- n Patterns! Ste3 &d andln- (ew ReDurements
Intal ReDurements of the Case Study
>andln- (ew ReDurements
The Strate-y Pattern
eld (otes! 7sn- the Strate-y Pattern
Summary
Cha3ter '+. The #e4orator Pattern
?vervew
A 9ttle 8ore #etal
The #e4orator Pattern
A33lyn- the #e4orator Pattern to the Case Study
Another 2am3le! In3ut?ut3ut
eld (otes! 7sn- the #e4orator Pattern
Summary
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec10.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec11.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec12.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec13.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part05.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch11lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec10.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec11.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec12.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12lev1sec13.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch13lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part05.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch14lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec7.html -
8/13/2019 Design Patterns Explained
7/1069
Su33lement! C:: Code 2am3les
Cha3ter '/. The Sn-leton Pattern and the #ouble)Che46ed 9o46n- Pattern
?vervew
Introdu4n- the Sn-leton Pattern
A33lyn- the Sn-leton Pattern to the Case Study
A arant! The #ouble)Che46ed 9o46n- Pattern
eld (otes! 7sn- the Sn-leton and #ouble)Che46ed 9o46n- Patterns
Summary
Su33lement! C:: Code 2am3les
Cha3ter '*. The ?bserver Pattern
?vervew
Cate-ores of Patterns
8ore ReDurements for the Case Study
The ?bserver Pattern
A33lyn- the ?bserver to the Case Study
eld (otes! 7sn- the ?bserver Pattern
Summary
Su33lement! C:: Code 2am3le
Cha3ter '0. The Tem3late 8ethod Pattern
?vervew
8ore ReDurements for the Case Study
The Tem3late 8ethod Pattern
A33lyn- the Tem3late 8ethod to the Case Study
eld (otes! 7sn- the Tem3late 8ethod Pattern
Summary
Cha3ter '%. The a4tory 8ethod Pattern
?vervew
8ore ReDurements for the Case Study
The a4tory 8ethod Pattern
eld (otes! 7sn- the a4tory 8ethod Pattern
Summary
Cha3ter &$. The Analyss 8atr2
?vervew
In the Real "orld! aratons
Case Study n araton! An Internatonal )Tal System
eld (otes
Summary
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch15lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch16lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch17lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch18lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch19lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch20lev1sec5.html -
8/13/2019 Design Patterns Explained
8/1069
Part I! ndn-s and Be-nnn-s
Cha3ter &'. #es-n Patterns Revewed from the (ew Pers3e4tve of ?b5e4t)?rented #es-n
?vervew
A Summary of ?b5e4t)?rented Prn43les
>ow #es-n Patterns n4a3sulate Im3lementatons
Commonaltyarablty Analyss and #es-n Patterns
#e4om3osn- a Problem #oman nto Res3onsbltes
Relatonsh3s "thn a Pattern
Patterns and Conte2tual #es-n
eld (otes
Summary
Cha3ter &&. Bblo-ra3hy
Design Patterns Explained: The "eb Ste Com3anon
Re4ommended Readn- on #es-n Patterns and ?b5e4t ?rentaton
Re4ommended Readn- for Java Pro-rammers
Re4ommended Readn- for C:: Pro-rammers
Re4ommended Readn- for C?B?9 Pro-rammers
Re4ommended Readn- on etreme Pro-rammn-
Re4ommended Readn- on eneral Pro-rammn-
Personal avortes
I l@ve RuBoard
I l@ve RuBoard
Copyright
8any of the des-natons used by manufa4turers and sellers to dstn-ush ther 3rodu4ts
are 4lamed as trademar6s. "here those des-natons a33ear n ths boo6, and Addson
"esley 9on-man In4., was aware of a trademar6 4lam, the des-natons have been 3rnted
wth ntal 4a3tal letters or n all 4a3tals.
The authors and 3ublsher have ta6en 4are n the 3re3araton of ths boo6, but ma6e no
e23ressed or m3led warranty of any 6nd and assume no res3onsblty for errors or
omssons. (o lablty s assumed for n4dental or 4onseDuental dama-es n 4onne4ton
wth or arsn- out of the use of the nformaton or 3ro-rams 4ontaned heren.
The 3ublsher offers ds4ounts on ths boo6 when ordered n Duantty for s3e4al sales. or
http://var/www/apps/conversion/tmp/scratch_4/0201715945_part06.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_pref01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_main.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part06.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch21lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch22lev1sec8.html -
8/13/2019 Design Patterns Explained
9/1069
more nformaton, 3lease 4onta4t!
Pearson du4aton Cor3orate Sales #vson
&$' ". '$rd Street
Indana3ols, I( /&%$
-
8/13/2019 Design Patterns Explained
10/1069
3hoto4o3yn-, re4ordn-, or otherwse, wthout the 3ror 4onsent of the 3ublsher. Prnted
n the 7nted States of Amer4a. Publshed smultaneously n Canada.
Te2t 3rnted on re4y4led 3a3er
& + / * 0 % '$E8AE$+$$$&
Se4ond 3rntn-, January &$$&
Dedication
!o Leig"# $ryan# Lisa# %ic"ael# and &teven for t"eir love# spport# encorage'ent# and
sacrifice(
EAlan Shalloway
Dedication
!o )ill# Eri*a# Lorien# %i*aela# and +eneva#t"e roses in t"e garden of 'y life( sola gloria
Dei
EJames R. Trott
I l@ve RuBoard
I l@ve RuBoard
Preface
#es-n 3atterns and ob5e4t)orented 3ro-rammn-. They hold su4h 3romse to ma6e your
lfe as a software des-ner and develo3er easer. Ther termnolo-y s banded about every
day n the te4hn4al and even the 3o3ular 3ress. But t 4an be hard to learn them, to
be4ome 3rof4ent wth them, to understand what s really -on- on.
Perha3s you have been usn- an ob5e4t)orented or ob5e4t)based lan-ua-e for years. >ave
you learned that the true 3ower of ob5e4ts s not nhertan4e but s n 1en4a3sulatn-
behavors1F Perha3s you are 4urous about des-n 3atterns and have found the lterature a
http://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_pref01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_toc.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ -
8/13/2019 Design Patterns Explained
11/1069
bt too esoter4 and h-h)falutn. If so, ths boo6 s for you.
It s based on years of tea4hn- ths materal to software develo3ers, both e23eren4ed and
new to ob5e4t orentaton. It s based u3on the belefEand our e23eren4eEthat on4e you
understand the bas4 3rn43les and motvatons that underle these 4on4e3ts, why they are
don- what they do, your learnn- 4urve wll be n4redbly shorter. And n our ds4usson of
des-n 3atterns, you wll understand the true mndset of ob5e4t orentaton, wh4h s a
ne4essty before you 4an be4ome 3rof4ent.
As you read ths boo6, you wll -an a sold understandn- of the ten most essental des-n
3atterns. Nou wll learn that des-n 3atterns do not e2st on ther own, but are su33osed to
wor6 n 4on4ert wth other des-n 3atterns to hel3 you 4reate more robust a33l4atons.
Nou wll -an enou-h of a foundaton that you wll be able to read the des-n 3attern
lterature, f you want to, and 3ossbly ds4over 3atterns on your own.
8ost m3ortantly, you wll be better eDu33ed to 4reate fle2ble and 4om3lete software that
s easer to mantan.
I l@ve RuBoard
I l@ve RuBoard
ro! Object Orientation to Patterns to "r#e Object Orientation
In many ways, ths boo6 s a retelln- of my 3ersonal e23eren4e learnn- des-n 3atterns.
Pror to studyn- des-n 3atterns, I 4onsdered myself to be reasonably e23ert n ob5e4t)
orented analyss and des-n. 8y tra46 re4ord had n4luded several farly m3ressve
des-ns and m3lementatons n many ndustres. I 6new C:: and was be-nnn- to learn
Java. The ob5e4ts n my 4ode were well)formed and t-htly en4a3sulated. I 4ould des-n
e24ellent data abstra4tons for nhertan4e herar4hes. I thou-ht I 6new ob5e4t)orentaton.
(ow, loo6n- ba46, I see that I really dd not understand the full 4a3abltes of ob5e4t)
orented des-n, even thou-h I was don- thn-s the way the e23erts advsed. It wasnLt
untl I be-an to learn des-n 3atterns that my ob5e4t)orented des-n abltes e23anded
and dee3ened. ;nown- des-n 3atterns has made me a better des-ner, even when I donLt
use these 3atterns dre4tly.
I be-an studyn- des-n 3atterns n '%%/. I was a C::ob5e4torented des-n mentor at a
http://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_pref01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_copyrightpg.html -
8/13/2019 Design Patterns Explained
12/1069
lar-e aeros3a4e 4om3any n the northwest. Several 3eo3le as6ed me to lead a des-n
3attern study -rou3. ThatLs where I met my 4o)author, Jm Trott. In the study -rou3,
several nterestn- thn-s ha33ened. rst, I -rew fas4nated wth des-n 3atterns. I loved
ben- able to 4om3are my des-ns wth the des-ns of others who had more e23eren4e
than I had. I ds4overed that I was not ta6n- full advanta-e of des-nn- to nterfa4es and
that I ddnLt always 4on4ern myself wth seen- f I 4ould have an ob5e4t use another ob5e4t
wthout 6nown- the used ob5e4tLs ty3e. I not4ed that be-nners to ob5e4t)orented des-n
Ethose who would normally be deemed as learnn- des-n 3atterns too earlyEwere
beneftn- as mu4h from the study -rou3 as the e23erts were. The 3atterns 3resented
e2am3les of e24ellent ob5e4t)orented des-ns and llustrated bas4 ob5e4t)orented
3rn43les, wh4h hel3ed to mature ther des-ns more Du46ly. By the end of the study
sessons, I was 4onvn4ed that des-n 3atterns were the -reatest thn- to ha33en to
software des-n sn4e the nventon of ob5e4t)orented des-n.
>owever, when I loo6ed at my wor6 at the tme, I saw that I was not n4or3oratn- any
des-n 3atterns nto my 4ode.
I 5ust f-ured I ddnLt 6now enou-h des-n 3atterns yet and needed to learn more. At the
tme, I only 6new about s2 of them. Then I had what 4ould be 4alled an e33hany. I was
wor6n- on a 3ro5e4t as a mentor n ob5e4t)orented des-n and was as6ed to 4reate a
h-h)level des-n for the 3ro5e4t. The leader of the 3ro5e4t was e2tremely shar3, but was
farly new to ob5e4t)orented des-n.
The 3roblem tself wasnLt that dff4ult, but t reDured a -reat deal of attenton to ma6e
sure the 4ode was -on- to be easy to mantan. 9terally, after about two mnutes of
loo6n- at the 3roblem, I had develo3ed a des-n based on my normal a33roa4h of data
abstra4ton. 7nfortunately, t was very 4lear ths was not -on- to be a -ood des-n. #ata
abstra4ton alone had faled me. I had to fnd somethn- better.
Two hours later, after a33lyn- every des-n te4hnDue I 6new, I was no better off. 8y
des-n was essentally the same. "hat was most frustratn- was that I 6new there was a
better des-n. I 5ust 4ouldnLt see t. Iron4ally, I also 6new of four des-n 3atterns that
1lved1 n my 3roblem but I 4ouldnLt see how to use them. >ere I wasEa su33osed e23ert
n ob5e4t)orented des-nEbaffled by a sm3le 3roblemO
-
8/13/2019 Design Patterns Explained
13/1069
eeln- very frustrated, I too6 a brea6 and started wal6n- down the hall to 4lear my head,
telln- myself I would not thn6 of the 3roblem for at least '$ mnutes. "ell, $ se4onds
later, I was thn6n- about t a-anO But I had -otten an ns-ht that 4han-ed my vew of
des-n 3atterns! rather than usn- 3atterns as ndvdual tems, I should use the des-n
3atterns to-ether.
Patterns are spposed to be sewn toget"er to solve a proble'(
I had heard ths before, but hadnLt really understood t. Be4ause 3atterns n software have
been ntrodu4ed as design3atterns, I had always labored under the assum3ton that they
had mostly to do wth des-n. 8y thou-hts were that n the des-n world, the 3atterns
4ame as 3retty mu4h well)formed relatonsh3s between 4lasses. Then, I read Chrsto3her
Ale2anderLs amaGn- boo6, !"e !i'eless ,ay of $ilding. I learned that 3atterns e2sted at
all levelsEanalyss, des-n, and m3lementaton. Ale2ander ds4usses usn- 3atterns to
hel3 n the understandn- of the 3roblem doman
-
8/13/2019 Design Patterns Explained
14/1069
e23erts I had been tal6n- to were sayn- that you really needed to have a -ood -roundn-
n ob5e4t)orented des-n before embar6n- on a study of des-n 3atterns. (evertheless, I
saw, wth my own eyes, that students who learned ob5e4t)orented des-n 4on4urrently
wth des-n 3atterns learned ob5e4t)orented des-n faster than those 5ust studyn- ob5e4t)
orented des-n. They even seemed to learn des-n 3atterns at almost the same rate as
e23eren4ed ob5e4t)orented 3ra4ttoners.
I be-an to use des-n 3atterns as a bass for my tea4hn-. I be-an to 4all my 4lasses
Pattern Oriented Design: Design Patterns fro' Analysis to 'ple'entation(
I wanted my students to understand these 3atterns and be-an to ds4over that usn- an
e23loratory a33roa4h was the best way to foster ths understandn-. or nstan4e, I found
that t was better to 3resent the Brd-e 3attern by 3resentn- a 3roblem and then have my
students try to des-n a soluton to the 3roblem usn- a few -udn- 3rn43les and
strate-es that I had found were 3resent n most of the 3atterns. In ther e23loraton, the
students ds4overed the solutonE4alled the Brd-e 3atternEand remembered t.
In any event, I found that these -udn- 3rn43les and strate-es 4ould be used to 1derve1
several of the des-n 3atterns. By 1derve a des-n 3attern,1 I mean that f I loo6ed at a
3roblem that I 6new 4ould be solved by a des-n 3attern, I 4ould use the -udn- 3rn43les
and strate-es to 4ome u3 wth the soluton that s e23ressed n the 3attern. I made t
4lear to my students that we werenLt really 4omn- u3 wth des-n 3atterns ths way.
Instead, I was 5ust llustratn- one 3ossble thou-ht 3ro4ess that the 3eo3le who 4ame u3
wth the or-nal solutons, those that were eventually 4lassfed as des-n 3atterns, m-ht
have used.
A slight digression$
The -udn- 3rn43les and strate-es seem very 4lear to me now. Certanly, they
are stated n the 1an- of ourLs1 des-n 3atterns boo6. But t too6 me a lon-
tme to understand them be4ause of lmtatons n my own understandn- of the
ob5e4t)orented 3arad-m. It was only after nte-ratn- n my own mnd the wor6
of the an- of our wth Ale2anderLs wor6, Jm Co3lenLs wor6 on 4ommonalty
and varablty analyss, and 8artn owlerLs wor6 n methodolo-es and analyss
3atterns that these 3rn43les be4ame 4lear enou-h to me to that I was able to
-
8/13/2019 Design Patterns Explained
15/1069
tal6 about them to others. It hel3ed that I was ma6n- my lvelhood e23lann-
thn-s to others so I 4ouldnLt -et away wth ma6n- assum3tons as easly as I
4ould when I was 5ust don- thn-s for myself.
8y abltes to e23lan these few, but 3owerful, 3rn43les and strate-es m3roved. As they
dd, I found that t be4ame more useful to e23lan an n4reasn- number of the an- of
our 3atterns. In fa4t, I use these 3rn43les and strate-es to e23lan '& of the ' 3atterns
I ds4uss n my des-n 3atterns 4ourse.
I found that I was usn- these 3rn43les n my own des-ns both wth and wthout
3atterns. Ths ddnLt sur3rse me. If usn- these strate-es resulted n a des-n eDuvalent
to a des-n 3attern when I 6new the 3attern was 3resent, that meant they were -vn- me
a way to derve e24ellent des-ns
-
8/13/2019 Design Patterns Explained
16/1069
e23eren4es, 4onne4ted wth the 3rn43les of des-n 3atterns, wll 3rove to be a 3owerful
ally n your learnn-.
Alan &"alloway
Dece'ber# .///
I l@ve RuBoard
I l@ve RuBoard
ro! Artificial %ntelligence to Patterns to "r#e Object Orientation
8y 5ourney nto des-n 3atterns had a dfferent startn- 3ont than AlanLs but we have
rea4hed the same 4on4lusons!
Pattern)based analyses ma6e you a more effe4tve and eff4ent analyst be4ause
they let you deal wth your models more abstra4tly and be4ause they re3resent the
4olle4ted e23eren4es of many other analysts.
Patterns hel3 3eo3le to learn 3rn43les of ob5e4t orentaton. The 3atterns hel3 to
e23lan why we do what we do wth ob5e4ts.
I started my 4areer n artf4al ntell-en4e
-
8/13/2019 Design Patterns Explained
17/1069
Then, n '%%, I ds4overed that resear4hers n uro3e had 4odfed these 3atterns of
e23ert behavor and 3ut them nto a 3a46a-e that they 4alled ;nowled-e Analyss and
#es-n Su33ort, or ;A#S. #r. ;aren ardner, a most -fted analyst, modeler, mentor, and
human ben-, be-an to a33ly ;A#S to her wor6 n the 7nted States. She e2tended the
uro3eanLs wor6 to a33ly ;A#S to ob5e4t)orented systems. She o3ened my eyes to an
entre world of 3attern)based analyss and des-n that was formn- n the software world,
n lar-e 3art due to Chrsto3her Ale2anderLs wor6. >er boo6, Cognitive Patterns
-
8/13/2019 Design Patterns Explained
18/1069
)a'es 0( !rott
Dece'ber# .///
I l@ve RuBoard
I l@ve RuBoard
A Note Abo#t Conventions &sed in "his 'oo(
In the wrtn- of ths boo6, we had to ma6e several 4ho4es about style and 4onventon.
Some of our 4ho4es have sur3rsed our readers. So, t s worth a few 4omments about why
we have 4hosen to do what we have done.
Approach Rationale
rst 3erson
vo4e
Ths boo6 s a 4ollaboratve effort between two authors. "e
debated and refned our deas to fnd the best ways to e23lan
these 4on4e3ts. Alan tred them out n hs 4ourses and we
refned some more. "e 4hose to use the frst 3erson sn-ular n
the body of ths boo6 be4ause t allows us to tell the story n
what we ho3e s a more en-a-n- and natural style.
S4annn- te2t "e have tred to ma6e ths boo6 easy to s4an so that you 4an
-et the man 3onts even f you do not read the body, or so
that you 4an Du46ly fnd the nformaton you need. "e ma6e
s-nf4ant use of tables and bulleted lsts. "e 3rovde te2t n
the outsde mar-n that summarGes 3ara-ra3hs. "th the
ds4usson of ea4h 3attern, we 3rovde a summary table of the
6ey features of the 3attern. ?ur ho3e s that these wll ma6e
the boo6 that mu4h more a44essble.
Code
fra-ments
Ths boo6 s about analyss and des-n more than
m3lementaton. ?ur ntent s to hel3 you thn6 about 4raftn-
-ood des-ns based on the ns-hts and best 3ra4t4es of the
ob5e4t)orented 4ommunty, as e23ressed n des-n 3atterns.
?ne of the 4hallen-es for all of us 3ro-rammers s to avod
-on- to the m3lementaton too early, don- before thn6n-.
;nown- ths, we have 3ur3osefully tred to stay away from too
mu4h ds4usson on m3lementaton. ?ur 4ode e2am3les may
seem a bt l-htwe-ht and fra-mentary. S3e4f4ally, we never
3rovde error 4he46n- n the 4ode. Ths s be4ause we are
tryn- to use the 4ode to llustrate 4on4e3ts.
Strate-es
and 3rn43les
?urs s an ntrodu4tory boo6. It wll hel3 you be able to -et u3
to s3eed Du46ly wth des-n 3atterns. Nou wll understand the
http://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec1.html -
8/13/2019 Design Patterns Explained
19/1069
3rn43les and strate-es that motvate des-n 3atterns. After
readn- ths boo6, you 4an -o on to a more s4holarly or
referen4e boo6. The last 4ha3ter wll 3ont you to many of the
referen4es that we have found useful.
Show breadth
and -ve a
taste
"e are tryn- -ve you a taste for des-n 3atterns, to e23ose you to the
breadth of the 3attern world but not -o nto de3th n any of them
-
8/13/2019 Design Patterns Explained
20/1069
use to send us your 4omments and Duestons. Nou wll also fnd our latest resear4h.
I l@ve RuBoard
I l@ve RuBoard
Ac(nowledg!ents
Almost every 3refa4e ends wth a lst of a46nowled-ments of those who hel3ed n the
develo3ment of the boo6. "e never fully a33re4ated how true ths was untl don- a boo6
of our own. Su4h an effort s truly a wor6 of a 4ommunty. The lst of 3eo3le to whom we
are n debt s lon-. The follown- 3eo3le are es3e4ally s-nf4ant to us!
#ebbe 9afferty from Addson)"esley, who never -rew tred of en4oura-n- us and
6ee3n- us on tra46.
S4ott Ban, our 4ollea-ue who 3atently revewed ths wor6 and -ave us ns-hts.
And es3e4ally 9e-h and Jll, our 3atent wves, who 3ut u3 wth us and
en4oura-ed us n our dream of ths boo6.
S3e4al than6s from Alan!
Several of my students early on had an m3a4t they 3robably never 6new. 8any
tmes durn- my 4ourses I hestated to 3ro5e4t new deas, feeln- I should st46
wth the tred and true. >owever, ther enthusasm n my new 4on4e3ts when I frst
started my 4ourses en4oura-ed me to 3ro5e4t more and more of my own deas nto
the 4urr4ulum I was 3uttn- to-ether. Than6s to 9an4e Noun-, Peter Shrley, John
Terrell, and ;aren Allen. They serve as a 4onstant remnder to me how
en4oura-ement 4an -o a lon- way.
Than6s to John lssdes for hs thou-htful 4omments and tou-h Duestons.
S3e4al than6s from Jm!
#r. ;aren ardner, a mentor and wse tea4her n 3atterns of human thou-ht.
#r. 8arel (orwood and Arthur 8ur3hy, my ntal 4ollaborators n ;A#S and
http://www.netobjectives.com/dpexplainedhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_fmlev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_http://www.netobjectives.com/dpexplained -
8/13/2019 Design Patterns Explained
21/1069
3attern)based analyss.
Brad anBee6 who -ave me the s3a4e to -row n ths ds43lne.
Ale2 Sdey who 4oa4hed me n the ds43lne and mysteres of te4hn4al wrtn-.
I l@ve RuBoard
I l@ve RuBoard
Part %: An %ntrod#ction to Object-Oriented )oftware Develop!ent
Part Overview
Ths 3art ntrodu4es you to a method for develo3n- ob5e4t)orented software that s based
onpatternsEthe ns-hts and best 3ra4t4es learned by des-ners and users over the years
Eand on the modeln- lan-ua-e
-
8/13/2019 Design Patterns Explained
22/1069
I l@ve RuBoard
Chapter *$ "he Object-Oriented Paradig!
?vervew
Before The ?b5e4t)?rented Parad-m! un4tonal #e4om3oston
The Problem of ReDurements
#ealn- wth Chan-es! 7sn- un4tonal #e4om3oston
#ealn- wth Chan-n- ReDurements
The ?b5e4t)?rented Parad-m
?b5e4t)?rented Pro-rammn- n A4ton
S3e4al ?b5e4t 8ethods
Summary
I l@ve RuBoard
I l@ve RuBoard
Overview
Ths 4ha3ter ntrodu4es you to the ob5e4t)orented 3arad-m by 4om3arn- and 4ontrastn-
t wth somethn- famlar! standard stru4tured 3ro-rammn-.
The ob5e4t)orented 3arad-m -rew out of a need to meet the 4hallen-es of 3ast 3ra4t4es
usn- standard stru4tured 3ro-rammn-. By ben- 4lear about these 4hallen-es, we 4an
better see the advanta-es of ob5e4t)orented 3ro-rammn-, as well as -an a better
understandn- of ths me4hansm.
Ths 4ha3ter wll not ma6e you an e23ert on ob5e4t)orented methods. It wll not even
ntrodu4e you to all of the bas4 ob5e4t)orented 4on4e3ts. It wll, however, 3re3are you for
the rest of ths boo6, wh4h wll e23lan the 3ro3er use of ob5e4t)orented des-n methods
as 3ra4t4ed by the e23erts.
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec9.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part01.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec7.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec8.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec9.html -
8/13/2019 Design Patterns Explained
23/1069
In ths 4ha3ter,
I ds4uss a 4ommon method of analyss, 4alled fun4tonal de4om3oston.
I address the 3roblem of reDurements and the need to deal wth 4han-e
-
8/13/2019 Design Patterns Explained
24/1069
4. Call a33ro3rate fun4ton that wll ds3lay sha3e, -vn- t the sha3eLs lo4aton.
Ths s 4alled fnctional deco'positionbe4ause the analyst brea6s down
-
8/13/2019 Design Patterns Explained
25/1069
I l@ve RuBoard
"he Proble! of +e,#ire!ents
As6 software develo3ers what they 6now to be true about the reDurements they -et from
users. They wll often say!
ReDurements are n4om3lete.
ReDurements are usually wron-.
ReDurements
-
8/13/2019 Design Patterns Explained
26/1069
beatn- ourselves u3 ow 4an I wrte the 4ode so that t
s easer to handle shftn- reDurementsF Rather than wrtn- one lar-e fun4ton, I 4ould
ma6e t more modular.
or e2am3le, n Ste3 4 on 3a-e , where I 2Call appropriate fnction t"at will display
s"ape# giving it t"e s"ape3s location#2I 4ould wrte a module l6e that shown n 2am3le ')
'.
Example 1-1 sin! "o#ularit$ to Contain %ariation
function: display shape
input: type of shape, description of shape
action: switch (type of shape)
case square: put display function for square here
case circle: put display function for circle here
Then, when I re4eve a reDurement to be able to ds3lay a new ty3e of sha3eEa tran-le,
for nstan4eEI only need to 4han-e ths module
-
8/13/2019 Design Patterns Explained
27/1069
I am storn- sha3es, t may or may not be 3ossble to have a 4onsstent des4r3ton of
sha3es that wll wor6 well for all sha3es. "hat f the des4r3ton of the sha3e s sometmes
stored as an array of 3ontsF "ould that stll wor6F
8odularty defntely hel3s to ma6e the 4ode more understandable, and understandablty
ma6es the 4ode easer to mantan. But modularty does not always hel3 4ode deal wth all
of the varaton t m-ht en4ounter.
"th the a33roa4h that I have used so far, I fnd that I have two s-nf4ant 3roblems,
wh4h -o by the terms low co"esionand tig"t copling(In hs boo6 Code Co'plete, Steve
84Connell -ves an e24ellent des4r3ton of both 4oheson and 4ou3ln-. >e says,
Co"esionrefers to how 14losely the o3eratons n a routne are related.1'
'84Connell, S., Code Co'plete: A Practical 4andboo* of &oftware Constrction , Redmond! 84rosoft Press, '%%, 3. 0'.
-
8/13/2019 Design Patterns Explained
28/1069
In fa4t, bu-s of ths ty3e lead me to a rather startln- observaton!
,e really do not spend 'c" ti'e fixing bgs(
I thn6 f2n- bu-s ta6es a short 3erod of tme n the mantenan4e and debu--n- 3ro4ess.
The overwhelmn- amount of tme s3ent n mantenan4e and debu--n- s on findingbu-s
and ta6n- the tme to avod unwanted sde effe4ts. The a4tual f2 s relatvely shortO
Sn4e unwanted sde effe4ts are often the hardest bu-s to fnd, havn- a fun4ton that
tou4hes many dfferent 3e4es of data ma6es t more l6ely that a 4han-e n reDurements
wll result n a 3roblem.
"he devil is in the side effects$
A fo4us on fun4tons s l6ely to 4ause sde effe4ts that are dff4ult to fnd.
8ost of the tme s3ent n mantenan4e and debu--n- s not s3ent on
f2n- bu-s, but n findingthem and seen- how to avod unwanted sde
effe4ts from the f2.
"th fun4tonal de4om3oston, 4han-n- reDurements 4auses my software develo3ment
and mantenan4e efforts to thrash. I am fo4used 3rmarly on the fun4tons. Chan-es to
one set of fun4tons or data m3a4t other sets of fun4tons and other sets of data, wh4h n
turn m3a4t other fun4tons that must be 4han-ed. 96e a snowball that 346s u3 snow as t
rolls downhll, a fo4us on fun4tons leads to a 4as4ade of 4han-es from wh4h t s dff4ult
to es4a3e.
I l@ve RuBoard
I l@ve RuBoard
Dealing with Changing +e,#ire!ents
To f-ure out a way around the 3roblem of 4han-n- reDurements and to see f there s an
alternatve to fun4tonal de4om3oston, letLs loo6 at how 3eo3le do thn-s. 9etLs say that
you were an nstru4tor at a 4onferen4e. Peo3le n your 4lass had another 4lass to attend
follown- yours, but ddnLt 6now where t was lo4ated. ?ne of your res3onsbltes s to
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch01lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ -
8/13/2019 Design Patterns Explained
29/1069
ma6e sure everyone 6nows how to -et to ther ne2t 4lass.
If you were to follow a stru4tured 3ro-rammn- a33roa4h, you m-ht do the follown-!
'. et lst of 3eo3le n the 4lass.
&. or ea4h 3erson on ths lst!
a. nd the ne2t 4lass they are ta6n-.
b. nd the lo4aton of that 4lass.
4. nd the way to -et from your 4lassroom to the 3ersonLs ne2t 4lass.
d. Tell the 3erson how to -et to ther ne2t 4lass.
To do ths would reDure the follown- 3ro4edures!
'. A way of -ettn- the lst of 3eo3le n the 4lass
&. A way of -ettn- the s4hedule for ea4h 3erson n the 4lass
. A 3ro-ram that -ves someone dre4tons from your 4lassroom to any other
4lassroom
. A 4ontrol 3ro-ram that wor6s for ea4h 3erson n the 4lass and does the reDured
ste3s for ea4h 3erson
I doubt that you would a4tually follow ths a33roa4h. Instead, you would 3robably 3ost
dre4tons to -o from ths 4lassroom to the other 4lassrooms and then tell everyone n the
4lass, 1I have 3osted the lo4atons of the 4lasses follown- ths n the ba46 of the room, as
well as the lo4atons of the other 4lassrooms. Please use them to -o to your ne2t
4lassroom.1 Nou would e23e4t that everyone would 6now what ther ne2t 4lass was, that
they 4ould fnd the 4lassroom they were to -o to from the lst, and 4ould then follow the
dre4tons for -on- to the 4lassrooms themselves.
"hat s the dfferen4e between these a33roa4hesF
In the frst oneE-vn- e23l4t dre4tons to everyoneEyou have to 3ay 4lose
attenton to a lot of detals. (o one other than you s res3onsble for anythn-. Nou
-
8/13/2019 Design Patterns Explained
30/1069
wll -o 4raGyO
In the se4ond 4ase, you -ve -eneral nstru4tons and then e23e4t that ea4h 3erson
wll f-ure out how to do the tas6 hmself or herself.
The b--est dfferen4e s ths shi&t o& responsibilit$'In the frst 4ase, you are res3onsble
for everythn- n the se4ond 4ase, students are res3onsble for ther own behavor. In both
4ases, the same thn-s must be m3lemented, but the or-anGaton s very dfferent.
,"at is t"e i'pact of t"is5
To see the effe4t of ths reor-anGaton of res3onsbltes, letLs see what ha33ens when
some new reDurements are s3e4fed.
Su33ose I am now told to -ve s3e4al nstru4tons to -raduate students who are assstn-
at the 4onferen4e. Perha3s they need to 4olle4t 4ourse evaluatons and ta6e them to the
4onferen4e off4e before they 4an -o to the ne2t 4lass. In the frst 4ase, I would have to
modfy the 4ontrol 3ro-ram to dstn-ush the -raduate students from the under-raduates,
and then -ve s3e4al nstru4tons to the -raduate students. ItLs 3ossble that I would have
to modfy ths 3ro-ram 4onsderably.
>owever, n the se4ond 4aseEwhere 3eo3le are res3onsble for themselvesEI would 5ust
have to wrte an addtonal routne for -raduate students to follow. The 4ontrol 3ro-ram
would stll 5ust say, 1o to your ne2t 4lass.1 a4h 3erson would sm3ly follow the
nstru4tons a33ro3rate for hmself or herself.
Ths s a s-nf4ant dfferen4e for the 4ontrol 3ro-ram. In one 4ase, t would have to be
modfed every tme there was a new 4ate-ory of students wth s3e4al nstru4tons that
they m-ht be e23e4ted to follow. In the other one, new 4ate-ores of students have to be
res3onsble for themselves.
There are three dfferent thn-s -on- on that ma6e ths ha33en. They are!
The 3eo3le are res3onsble for themselves, nstead of the 4ontrol 3ro-ram ben-
res3onsble for them.
-
8/13/2019 Design Patterns Explained
31/1069
re-ular students= as f they were e2a4tly the same.
The 4ontrol 3ro-ram does not need to 6now about any s3e4al ste3s that students
m-ht need to ta6e when movn- from 4lass to 4lass.
To fully understand the m3l4atons of ths, tLs m3ortant to establsh some termnolo-y. In
6%L Distilled, 8artn owler des4rbes three dfferent 3ers3e4tves n the software
develo3ment 3ro4ess.These are des4rbed n Table ')'.
owler, 8., S4ott, ;., 6%L Distilled: A $rief +ide to t"e &tandard Object %odeling Langage# .nd Edition# Readn-, 8ass.! Addson)
"esley, '%%%, 33. +'+&.
Table 1-1' Perspectives in the (o&tware Development Process
Perspective Description
Con4e3tual Ths 3ers3e4tve 1re3resents the 4on4e3ts n the doman
under studyQ . a 4on4e3tual model should be drawn wth
lttle or no re-ard for the software that m-ht m3lement t Q1
S3e4f4aton 1(ow we are loo6n- at software, but we are loo6n- at the
nterfa4es of the software, not the m3lementaton.1
Im3lementaton At ths 3ont we are at the 4ode tself. 1Ths s 3robably the
most often)used 3ers3e4tve, but n many ways the
s3e4f4aton 3ers3e4tve s often a better one to ta6e.1
9oo6 a-an at the 3revous e2am3le of 1o to your ne2t 4lass.1 (ot4e that youEas the
nstru4torEare 4ommun4atn- wth the 3eo3le at the conceptallevel(In other words, you
are telln- 3eo3le what you want, not how to do t. >owever, the way they -o to ther ne2t
4lass s very s3e4f4. They are follown- s3e4f4 nstru4tons and n don- so are wor6n- at
the i'ple'entation level(
Commun4atn- at one level
-
8/13/2019 Design Patterns Explained
32/1069
"he Object-Oriented Paradig!
The ob5e4t)orented 3arad-m s 4entered on the 4on4e3t of the ob5e4t. verythn- s
fo4used on ob5e4ts. I wrte 4ode or-anGed around ob5e4ts, not fun4tons.
"hat s an ob5e4tF ?b5e4ts have tradtonally been defned as data wth 'et"ods
-
8/13/2019 Design Patterns Explained
33/1069
The best way to thn6 about what an ob5e4t s, s to thn6 of t as somethn- wth
res3onsbltes. A -ood des-n rule s that ob5e4ts should be res3onsble for themselves
and should have those res3onsbltes 4learly defned. Ths s why I say one of the
res3onsbltes of a student ob5e4t s 6nown- how to -o from one 4lassroom to the ne2t.
I 4an also loo6 at ob5e4ts usn- the framewor6 of owlerLs 3ers3e4tves!
At the conceptal level#an ob5e4t s a set of res3onsbltes.
I am rou-hly 3ara3hrasn- Bertrand 8eyerLs wor6 of #es-n by Contra4t as outlned n Object-Oriented &oftware
Constrction, 733er Saddle Rver, (.J.! Prent4e >all, '%%*, 3. '.
At the specification level#an ob5e4t s a set of methods that 4an be nvo6ed by
other ob5e4ts or by tself.
At the i'ple'entation level#an ob5e4t s 4ode and data.
7nfortunately, ob5e4t)orented des-n s often tau-ht and tal6ed about only at the
m3lementaton levelEn terms of 4ode and dataErather than at the 4on4e3tual or
s3e4f4aton level. But there s -reat 3ower n thn6n- about ob5e4ts n these latter ways
as wellO
Sn4e ob5e4ts have res3onsbltes and ob5e4ts are res3onsble for themselves, there has to
be a way to tell ob5e4ts what to do. Remember that ob5e4ts have data to tell the ob5e4t
about tself and methods to m3lement fun4tonalty. 8any methods of an ob5e4t wll be
dentfed as 4allable by other ob5e4ts. The 4olle4ton of these methods s 4alled the ob5e4tLs
pblic interface(
or e2am3le, n the 4lassroom e2am3le, I 4ould wrte the Studentob5e4t wth the method
gotoNextClassroom(). I would not need to 3ass any 3arameters n be4ause ea4h
student would be res3onsble for tself. That s, t would 6now!
"hat t needs to be able to move
>ow to -et any addtonal nformaton t needs to 3erform ths tas6
Intally, there was only one 6nd of studentEa re-ular student who -oes from 4lass to
4lass. (ote that there would be many of these 1re-ular students1 n my 4lassroom
-
8/13/2019 Design Patterns Explained
34/1069
system=. But what f I want to have more *indsof studentsF It seems neff4ent for ea4h
student ty3e to have ts own set of methods to tell t what t 4an do, es3e4ally for tas6s
that are 4ommon to all students.
A more eff4ent a33roa4h would be to have a set of methods asso4ated wth all students
that ea4h one 4ould use or talor to ther own needs. I want to defne a 1-eneral student1
to 4ontan the defntons of these 4ommon methods. Then, I 4an have all manner of
s3e4alGed students, ea4h of whom has to 6ee3 tra46 of hs or her own 3rvate nformaton.
In ob5e4t)orented terms, ths -eneral student s 4alled a class(A 4lass s a defnton of the
behavor of an ob5e4t. It 4ontans a 4om3lete des4r3ton of!
The data elements the ob5e4t 4ontans
The methods the ob5e4t 4an do
The way these data elements and methods 4an be a44essed
Sn4e the data elements an ob5e4t 4ontans 4an vary, ea4h ob5e4t of the same ty3e may
have dfferent data but wll have the same fun4tonalty
-
8/13/2019 Design Patterns Explained
35/1069
b. #etermnes how to -et there
4. oes there
/. #one.
Ths wor6s fne untl I need to add another student ty3e, su4h as the -raduate student.
I have a dlemma. It a33ears that I must allow any ty3e of student nto the 4olle4ton
-
8/13/2019 Design Patterns Explained
36/1069
sperclass ofGraduateStudentand of RegularStudent.
Abstra4t 4lasses a4t as 3la4eholders for other 4lasses. I use them to defne the methods
ther derved 4lasses must m3lement. Abstra4t 4lasses 4an also 4ontan 4ommon methods
that 4an be used by all dervatons. "hether a derved 4lass uses the default behavor or
re3la4es t wth ts own varaton s u3 to the dervaton
-
8/13/2019 Design Patterns Explained
37/1069
PblicE Anythn- 4an see t.
ProtectedE ?nly ob5e4ts of ths 4lass and derved 4lasses 4an see t.
PrivateE ?nly ob5e4ts from ths 4lass 4an see t.
Ths leads to the 4on4e3t of encapslation(n4a3sulaton has often been des4rbed sm3ly
as hdn- data. ?b5e4ts -enerally do not e23ose ther nternal data members to the outsde
world
-
8/13/2019 Design Patterns Explained
38/1069
?b5e4t An entty that has res3onsbltes. I m3lement
these by wrtn- a 4lass
-
8/13/2019 Design Patterns Explained
39/1069
Object-Oriented Progra!!ing in Action
9etLs re)e2amne the sha3es e2am3le ds4ussed at the be-nnn- of the 4ha3ter. >ow would
I m3lement t n an ob5e4t)orented mannerF Remember that t has to do the follown-!
'. 9o4ate the lst of sha3es n the database.
&. ?3en u3 the lst of sha3es.
. Sort the lst a44ordn- to some rules.
. #s3lay the ndvdual sha3es on the montor.
To solve ths n an ob5e4t)orented manner, I need to defne the ob5e4ts and the
res3onsbltes they would have.
The ob5e4ts I would need are!
Class Responsibilities ."etho#s/
ShapeDataBasegetCollectionE-et a s3e4fed 4olle4ton of sha3es
Shape
-
8/13/2019 Design Patterns Explained
40/1069
The man 3ro-ram would now loo6 l6e ths!
'. 8an 3ro-ram 4reates an nstan4e of the database ob5e4t.
&. 8an 3ro-ram as6s the database ob5e4t to fnd the set of sha3es I am nterested n
and to nstantate a 4olle4ton ob5e4t 4ontann- all of the sha3es
-
8/13/2019 Design Patterns Explained
41/1069
7sn- thn-s s easer be4ause the user does not need to worry about
m3lementaton ssues.
Im3lementatons 4an be 4han-ed wthout worryn- about the 4aller.
-
8/13/2019 Design Patterns Explained
42/1069
These s3e4al methods do, n fa4t, e2st and are 4alled constrctorsand destrctors(
A 4onstru4tor s a s3e4al method that s automat4ally 4alled when the ob5e4t s 4reated.
Its 3ur3ose s to handle startn- u3 the ob5e4t. Ths s 3art of an ob5e4tLs mandate to be
res3onsble for tself. The 4onstru4tor s the natural 3la4e to do ntalGatons, set default
nformaton, set u3 relatonsh3s wth other ob5e4ts, or do anythn- else that s needed to
ma6e a well)defned ob5e4t. All ob5e4t)orented lan-ua-es loo6 for a 4onstru4tor method
and e2e4ute t when the ob5e4t s 4reated.
By usn- 4onstru4tors 3ro3erly t s easer to elmnate
-
8/13/2019 Design Patterns Explained
43/1069
)#!!ary
In ths 4ha3ter, I have shown how ob5e4t orentaton hel3s us mnmGe 4onseDuen4es of
shftn- reDurements on a system and how t 4ontrasts wth fun4tonal de4om3oston.
I 4overed a number of the essental 4on4e3ts n ob5e4t)orented 3ro-rammn- and have
ntrodu4ed and des4rbed the 3rmary termnolo-y. These are essental to understandn-
the 4on4e3ts n the rest of ths boo6.
-
8/13/2019 Design Patterns Explained
44/1069
Attrbute #ata asso4ated wth an ob5e4t
-
8/13/2019 Design Patterns Explained
45/1069
"hat Is the 789F
"hy 7se the 789F
The Class #a-ram
Intera4ton #a-rams
Summary
I l@ve RuBoard
I l@ve RuBoard
Overview
Ths 4ha3ter -ves a bref overvew of the 7nfed 8odeln- 9an-ua-e
-
8/13/2019 Design Patterns Explained
46/1069
The 789 has several dfferent da-ramsEsome for analyss, others for des-n, and stll
others for m3lementaton
-
8/13/2019 Design Patterns Explained
47/1069
In the de3loyment
3hase Deplo$ment Dia!rams8wh4h show how dfferent
modules wll be de3loyed. I wll not tal6 about these
da-rams here.
I l@ve RuBoard
I l@ve RuBoard
1hy &se the &.02
The 789 s used 3rmarly for 4ommun4atonEwth myself, my team members, and wth
my 4ustomers. Poor reDurements
-
8/13/2019 Design Patterns Explained
48/1069
) ?ne 4lass 1uses1 another 4lass
There are varatons on these themes. or e2am3le, to say somethn- 4ontans somethn-
else 4an mean that
The 4ontaned tem s a 3art of the 4ontann- tem
-
8/13/2019 Design Patterns Explained
49/1069
-
8/13/2019 Design Patterns Explained
50/1069
i!ure )-)' The Class Dia!ram showin! the is-arelationships'
-ure &)&re3resents several thn-s. rst, the arrowhead under the Shape4lass means
that those 4lasses 3ontn- to Shapederve from Shape. urthermore, sn4e Shapes
italici7edthat means t s an abstra4t 4lass. An abstra4t 4lass s a 4lass that s used to
defne an nterfa4e for the 4lasses that derve from t.
There are a4tually two dfferent 6nds of "as-arelatonsh3s. ?ne ob5e4t 4an have another
ob5e4t where the 4ontaned ob5e4t s a 3art of the 4ontann- ob5e4tEor not. In -ure &),
I showAirports1havn-1Aircraft.Aircraftare not 3art ofAirports, but I 4an stll
say theAirporthas them. Ths ty3e of relatonsh3 s 4alled aggregation(
i!ure )-3' The Class Dia!ram showin! the "as-arelationship'
In ths da-ram, I also show that anAircrafts ether a Jetor a Helicopter. I 4an see
thatAircrafts an abstra4t 4lass be4ause ts name s shown n tal4s. That means that
anAirportwll have ether Jetor Helicopterbut wll treat them the same
-
8/13/2019 Design Patterns Explained
51/1069
Aircraft=. The o3en
-
8/13/2019 Design Patterns Explained
52/1069
In -ure &)+, there s a new symbol! the (ote. The bo2 4ontann- the messa-e
1o3en damonds mean a--re-aton1 s a note. They are meant to loo6 l6e 3e4es
of 3a3er wth the r-ht 4orner folded ba46. Nou often see them wth a lne
4onne4tn- them to a 3art4ular 4lass nd4atn- they relate 5ust to that 4lass.
i!ure )-;' The Class Dia!ram with a Note'
Class #a-rams show the relatonsh3s between 4lasses. "th 4om3oston and
a--re-aton, however, the relatonsh3 s more s3e4f4ally about ob5e4ts of that ty3e of
4lass. or e2am3le, t s trueAirports haveAircraft, but more s3e4f4ally, s3e4f4
ar3orts have s3e4f4 ar4raft. The Dueston may arseE1how many ar4raft does an ar3ort
haveF1 Ths s 4alled the cardinalityof the relatonsh3. I show ths n -ures &)/and &)*.
i!ure )-
-
8/13/2019 Design Patterns Explained
53/1069
-ure &)/tells us that when I have anAirport, t has from $ to any number
-
8/13/2019 Design Patterns Explained
54/1069
Class #a-rams show stat4 relatonsh3s between 4lasses. In other words, they do not
show us any a4tvty. Althou-h very useful, sometmes I need to show how the ob5e4ts
nstantated from these 4lasses a4tually wor6 to-ether.
The 789 da-rams that show how ob5e4ts ntera4t wth ea4h other are 4alled nteraction
Diagra's(The most 4ommon ty3e of Intera4ton #a-ram s the SeDuen4e #a-ram, su4h
as shown n -ure &)0.
i!ure )->' (e9uence Dia!ram &or the shapes pro!ram'
-
8/13/2019 Design Patterns Explained
55/1069
-
8/13/2019 Design Patterns Explained
56/1069
I l@ve RuBoard
I l@ve RuBoard
)#!!ary
The 3ur3ose of the 789 s to both flesh out your des-ns and to 4ommun4ate them. #o
not worry so mu4h about 4reatn- da-rams the 1r-ht1 way. Thn6 about the best way to
4ommun4ate the 4on4e3ts n your des-n. In other words,
If you thn6 somethn- needs to be sad, use a (ote to say t.
If you arenLt sure about an 4on or a symbol and you have to loo6 t u3 to fnd out
ts meann-, n4lude a note to e23lan t sn4e others may be un4lear about ts
meann-, too.
o for 4larty.
?f 4ourse, ths means you should not use the 789 n nonstandard waysEthat does not
4ommun4ate 3ro3erly ether. Just 4onsder what you are tryn- to 4ommun4ate as your
draw your da-rams.
I l@ve RuBoard
I l@ve RuBoard
Part %%: "he 0i!itations of "raditional Object-Oriented Design
Part Overview
In ths 3art, I solve a real)world 3roblem usn- standard ob5e4t)orented methods. Ths was
a 3roblem I wor6ed on when I was 5ust be-nnn- to learn des-n 3atterns.
Chapter Discusses These Topics
A des4r3ton of the CA#CA8 3roblem! e2tra4t nformaton
from a lar-e 4om3uter)aded des-n4om3uter)aded
manufa4turn-
-
8/13/2019 Design Patterns Explained
57/1069
Be4ause the CA#CA8 system 4ontnues to evolve, the
3roblem 4res out for fle2ble 4ode.
8y frst soluton to the CA#CA8 3roblem, usn- standard
ob5e4t)orented methods.
At the tme I a4tually wor6ed on ths 3roblem, I hadnLt yet
learned the essen4e of the 3rn43les behnd many des-n
3atterns. Ths resulted n an ntal soluton that over)reled on
nhertan4e. It was easy to des-n and the ntal soluton
wor6ed, but I ended u3 wth too many s3e4al 4ases.
8y soluton had s-nf4ant 3roblemsEdff4ult mantenan4e
and nfle2bltyE5ust the thn-s I ho3ed to avod wth ob5e4t)
orented des-n.
9ater, n Part I, I wll revst the 3roblem n Cha3ter '&,
1Solvn- the CA#CA8 Problem wth Patterns.1 I wll solve the
3roblem a-an usn- des-n 3atterns to or4hestrate the
a33l4atonLs ar4hte4ture and ts m3lementaton detals. By
don- ths, I 4reate a soluton that s mu4h easer to mantan
and s mu4h more fle2ble.
Ths 3art s m3ortant to read be4ause t llustrates a ty34al 3roblem that results n
tradtonal ob5e4t)orented des-nEtaller)than)ne4essary nhertan4e herar4hes that have
t-ht 4ou3ln- and low 4oheson.
I l@ve RuBoard
I l@ve RuBoard
Chapter 3$ A Proble! "hat Cries O#t for lexible Code
?vervew
2tra4tn- Informaton from a CA#CA8 System
http://var/www/apps/conversion/tmp/scratch_4/0201715945_part04.html#part04http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12.html#ch12http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch02lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part04.html#part04http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch12.html#ch12http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.html -
8/13/2019 Design Patterns Explained
58/1069
7nderstand the o4abulary
#es4rbe the Problem
The ssental Challen-es and A33roa4hes
Summary
I l@ve RuBoard
I l@ve RuBoard
Overview
Ths 4ha3ter -ves an overvew of a 3roblem we want to solve! e2tra4tn- nformaton from
a lar-e CA#CA8 database to feed a 4om3le2 and e23ensve analyss 3ro-ram. Be4ause
the CA#CA8 system 4ontnues to evolve, the 3roblem 4res out for fle2ble 4ode.
In ths 4ha3ter, I -ve an overvew of the CA#CA8 3roblem, the vo4abulary of the doman,
and m3ortant features of the 3roblem.
I l@ve RuBoard
I l@ve RuBoard
Extracting %nfor!ation fro! a CAD4CA. )yste!
I am now -on- to revew a 3ast des-n of mne that -ot me on the road to the ns-hts
4ontaned n ths boo6.
I was su33ortn- a des-n 4enter n wh4h en-neers used a CA#CA8 system to ma6e
drawn-s of sheet metal 3arts. An e2am3le of one of these 3arts s shown n -ure )'.
i!ure 3-1' Example o& a piece o& sheet metal'
http://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec6.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec2.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec1.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_part02.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec3.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec4.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec5.htmlhttp://var/www/apps/conversion/tmp/scratch_4/0201715945_ch03lev1sec6.html -
8/13/2019 Design Patterns Explained
59/1069
8y 3roblem was to wrte a 4om3uter tool to e2tra4t nformaton from the CA#CA8 system
so that an e23ert system 4ould use t n a 3art4ular way. The e23ert system needed ths
nformaton n order to 4onrol the manufa4turn- of the 3art. Sn4e the e23ert system was
4om3le2 to modfy and would have a lon-er lfe than the 4urrent verson of the CA#CA8
system, I wanted to wrte the nformaton)e2tra4tn- tool so that t 4ould easly be ada3ted
to new revsons of the CA#CA8 system.
1hat are expert syste!s2
An expert syste's a s3e4al 4om3uter system that uses the rules of a human
e23ert
-
8/13/2019 Design Patterns Explained
60/1069
dmensons and -eometry n the sheet metal.
As shown n -ure )', a 3e4e of sheet metal s 4ut to a 3art4ular sGe and has sha3es
4ut out nsde t. 23erts 4all these 4utouts by the -eneral name 1feature.1 A 3e4e of sheet
metal 4an be fully s3e4fed by ts e2ternal dmensons and the features 4ontaned n t.
The ty3es of sha3esEfeaturesEthat may be found n a 3e4e of sheet metal are des4rbed
n Table )'. These are the sha3es the system wll have to address.
Table 3-1' (hapes oun# in a Piece o& (heet "etal
(hape Description