%! /GlSave save def /TeXDict 200 dict def TeXDict begin /Resolution 300 def /Inch {Resolution mul}def /Mtrx 6 array def /@letter{letter initmatrix 72 Resolution div dup neg scale 310 -3005 translate Mtrx currentmatrix pop}def /@copies{ /#copies exch def}def /@restore /restore load def /restore{vmstatus pop dup @VMused lt{pop @VMused}if exch pop exch @restore /@VMused exch def}def /@pri{ ( )print( )cvs print}def /@FontMatrix[1 0 0 -1 0 0]def /@FontBBox[0 0 1 1]def /dmystr(ZZf@@)def /newname{dmystr cvn} def /df{/fontname exch def dmystr 2 fontname cvx(@@@)cvs putinterval newname 7 dict def newname load begin /FontType 3 def /FontMatrix @FontMatrix def /FontBBox @FontBBox def /BitMaps 128 array def /BuildChar{CharBuilder}def /Encoding 128 array def 0 1 127{Encoding exch /.undef put}for end newname newname load definefont setfont fontname{/foo setfont}2 array copy cvx def fontname load 0 dmystr 5 string copy cvn cvx put}def /ch-image{ch-data 0 get} def /ch-width{ch-data 1 get}def /ch-height{ch-data 2 get}def /ch-xoff{ch-data 3 get}def /ch-yoff{ch-data 4 get}def /ch-tfmw{ch-data 5 get}def /CharBuilder{ save 3 1 roll exch /BitMaps get exch get /ch-data exch def ch-data null ne{ ch-tfmw 0 ch-xoff neg ch-yoff neg ch-width ch-xoff sub ch-height ch-yoff sub setcachedevice ch-width ch-height true[1 0 0 1 ch-xoff ch-yoff]{ch-image} imagemask}if restore}def /dc{/ch-code exch def dup 0 get length 2 lt{pop[<00> 1 1 0 0 8.00]}if /ch-data exch def currentfont /BitMaps get ch-code ch-data put currentfont /Encoding get ch-code dup( )cvs cvn put}def /bop{erasepage initgraphics Mtrx setmatrix /SaveImage save def 0 0 moveto}def /eop{showpage SaveImage restore}def /@start{@letter vmstatus pop /@VMused exch def pop}def /@end{(VM used: )print @VMused @pri(. Unused: )print vmstatus @VMused sub @pri pop pop(\n)print flush end GlSave restore}def /p{show}def /v{/dy exch neg def /dx exch def /x1 currentpoint /y1 exch def def newpath x1 y1 moveto dx 0 rlineto 0 dy rlineto dx neg 0 rlineto closepath fill x1 y1 moveto}def /li{ lineto}def /rl{rlineto}def /rc{rcurveto}def /np{/SaveX currentpoint /SaveY exch def def newpath}def /st{stroke SaveX SaveY moveto}def /fi{fill SaveX SaveY moveto}def /ellipse{/endangle exch def /startangle exch def /yrad exch def /xrad exch def /y exch def /x exch def /savematrix matrix currentmatrix def x y translate xrad yrad scale 0 0 1 startangle endangle arc savematrix setmatrix}def /a{moveto}def /delta 0 def /b{exch p dup /delta exch def 0 rmoveto}def /c{p delta 4 sub dup /delta exch def 0 rmoveto}def /d{p delta 3 sub dup /delta exch def 0 rmoveto}def /e{p delta 2 sub dup /delta exch def 0 rmoveto}def /f{p delta 1 sub dup /delta exch def 0 rmoveto}def /g{p delta 0 rmoveto}def /h{p delta 1 add dup /delta exch def 0 rmoveto}def /i{p delta 2 add dup /delta exch def 0 rmoveto}def /j{p delta 3 add dup /delta exch def 0 rmoveto}def /k{p delta 4 add dup /delta exch def 0 rmoveto}def /l{p -4 0 rmoveto}def /m{p -3 0 rmoveto}def /n{p -2 0 rmoveto}def /o{p -1 0 rmoveto}def /q{p 1 0 rmoveto}def /r{p 2 0 rmoveto}def /s{p 3 0 rmoveto}def /t{p 4 0 rmoveto}def /w{0 rmoveto}def /x{0 exch rmoveto}def /y{3 -1 roll p moveto}def /bos{/section save def}def /eos{section restore}def /@MacSetUp{userdict /md known{userdict /md get type /dicttype eq{md begin /letter{}def /note{}def /legal{}def /od{txpose 1 0 mtx defaultmatrix dtransform exch atan/pa exch def newpath clippath mark{transform{itransform moveto}}{transform{itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll transform{ itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll curveto}}{{ closepath}}pathforall newpath counttomark array astore /gc xdf pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}if}def /txpose{pxs pys scale ppr aload pop por{noflips{pop exch neg exch translate pop 1 -1 scale}if xflip yflip and{pop exch neg exch translate 180 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg translate}if xflip yflip not and{pop exch neg exch translate pop 180 rotate ppr 3 get ppr 1 get neg sub neg 0 translate}if yflip xflip not and{ppr 1 get neg ppr 0 get neg translate} if}{noflips{translate pop pop 270 rotate 1 -1 scale}if xflip yflip and{ translate pop pop 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg translate}if xflip yflip not and{translate pop pop 90 rotate ppr 3 get ppr 1 get neg sub neg 0 translate}if yflip xflip not and{ translate pop pop 270 rotate ppr 2 get ppr 0 get neg sub neg 0 exch translate} if}ifelse scaleby96{ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy translate .96 dup scale neg exch neg exch translate}if}def /cp{pop pop showpage pm restore}def end}if}if}def /psf$TeXscale{65536 div}def /DocumentInitState[matrix currentmatrix currentlinewidth currentlinecap currentlinejoin currentdash currentgray currentmiterlimit]cvx def /startTexFig {/psf$SavedState save def userdict maxlength dict begin currentpoint transform DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix itransform moveto /psf$ury exch psf$TeXscale def /psf$urx exch psf$TeXscale def /psf$lly exch psf$TeXscale def /psf$llx exch psf$TeXscale def /psf$y exch psf$TeXscale def /psf$x exch psf$TeXscale def currentpoint /psf$cy exch def /psf$cx exch def /psf$sx psf$x psf$urx psf$llx sub div def /psf$sy psf$y psf$ury psf$lly sub div def psf$sx psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub translate /DefFigCTM matrix currentmatrix def /initmatrix{DefFigCTM setmatrix}def /defaultmatrix{DefFigCTM exch copy}def /initgraphics{DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap setlinewidth setmatrix DefFigCTM setmatrix}def /showpage{initgraphics}def @MacSetUp}def /doclip{ currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll exch lineto exch lineto exch lineto closepath clip newpath moveto}def /endTexFig{end psf$SavedState restore}def end statusdict /waittimeout 300 put TeXDict begin @start bos /fa df[<001FE000007FF80001FFFE0007E01F800F8007C01E00 01E01C0000E038000070380000707000003870000038E000001CE000001CE000001CE000001CE0 00001CE000001CE000001CE000001CE000001CE000001CE000001CE000001CE000001CE000001C E000001CE000001CE000001CE000001CE000001CE000001CE000001CE000001CE000001CE00000 1CE000001CE000001CE000001CE000001CE000001CE000001CE000001C>30 42 -2 42 35]83 dc[<0000FF8000000007FFF00000001FFFFC0000007F007F000000F8000F800003E00003E00007 C00001F0000700000070000E00000038001E0000003C001C0000001C00380000000E0038000000 0E00700000000700700000000700700000000700E00000000380E00000000380E00000000380E0 0000000380E00000000380E00000000380E00000000380E00000000380E00000000380E0000000 0380E00000000380E00000000380E00000000380E00000000380E00000000380E00000000380E0 0000000380E00000000380E00000000380E00000000380E00000000380E00000000380E0000000 0380E00000000380E00000000380E00000000380E00000000380E00000000380E00000000380E0 0000000380E00000000380E00000000380E00000000380E00000000380E00000000380E0000000 0380E00000000380E00000000380E00000000380E00000000380E00000000380E00000000380> 41 58 -2 58 46]91 dc /fb df[<0000FFF0000000FFE000000FFFFF00000FFFFC00007FFFFF C0007FFFFF0000FFFFFFF001FFFFFFC003FFFFFFFC07FFFFFFE007FFF01FFF1FFFF01FF00FFFC0 01FFFFFF8007F81FFF80003FFFFE0001F83FFF00000FFFFC0000FC3FFE000007FFF000007C7FFE 00000FFFE000007E7FFC00001FFFC000003EFFFC00003FFF8000003EFFFC00007FFFC0000000FF FC0000FFFFE0000000FFF80001FFFFF0000000FFF80003FFF9F8000000FFF80007FFF0FC000000 FFF8000FFFE07C0000007FF8001FFFC07E0000007FF8003FFF803F0000007FF8007FFF001F8000 003FF8007FFF000FC000001FF800FFFE0007C000000FFC01FFFC0007E0000007FC01FFF80003F0 000003FC03FFF00001F8000001FE07FFF00000F8000000FE07FFE00000FC0000007F0FFFC00000 7E0000001F0FFF8000003E0000000F9FFF8000003F00000007FFFF0000001F80000003FFFF0000 000F80000001FFFE0000000FC0000000FFFC00000007E00000007FFC00000003E0000000FFF800 000003F0000000FFF800000001F8000000FFF800000000F8000001FFF000000000FC000001FFF8 00000001FF000001FFFC0000007FFFFF0001FFFE0000007FFFFF0003FFFF0000007FFFFF0003FF CF8000007FFFFF0003FFC7C000007FFFFF0003FFC3E000000000000003FF81F000000000000007 FF80F800000000000007FF807C00000000000007FF807C00000000000007FF803E000000000000 07FF001F00000000000007FF001F00000000000007FF000F80000000000007FF000F8000000000 0007FF0007C0000000000007FF0007C0000000000007FF0007C0000000000003FF0007C0000000 000003FF0007C0000000000003FF0007C0000000000001FF0007C0000000000001FF800FC00000 00000000FF800F800000000000007FC00F800000000000007FC01F000000000000003FE01F0000 00000000001FF87E0000000000000007FFFC0000000000000003FFF80000000000000000FFF000 000000000000001FC00000000000>80 74 -5 1 92]38 dc[<0C00001E00001F00000F800007C0 0003E00001F00000F00000F800007800003C00003C00001E00001E00000F00000F00000F00000F 0000078000078007E7801FFF803FFF807FFF807FFF80FFFF80FFFF80FFFF80FFFF00FFFF00FFFE 007FFE007FFC003FFC001FF00007C000>17 36 -8 20 33]44 dc[31 10 -1 -18 40]45 dc[<07E00FF03FFC3FFC7FFEFFFFFFFFFFFFFFFFFFFFFFFF7FFE3FFC3FFC0FF007E00000000000 000000000000000000000000000000000000000000000007E00FF03FFC3FFC7FFEFFFFFFFFFFFF FFFFFFFFFFFF7FFE3FFC3FFC0FF007E0>16 46 -8 0 33]58 dc[81 72 -4 0 90]65 dc[72 71 -4 0 84]66 dc[<0000 00003FFE0000000000000FFFFFE000000000007FFFFFFC0000000003FFFFFFFF000000000FFFFF FFFFC00000003FFFF8007FF0000000FFFF80000FF8000001FFFC000001FC000007FFF0000000FE 00000FFFC00000003F00001FFF800000001F80003FFF000000000FC0007FFE0000000007E000FF FC0000000003E001FFF80000000001F003FFF00000000001F803FFF00000000000F807FFE00000 000000F807FFE000000000007C0FFFC000000000007C0FFFC000000000007C1FFFC00000000000 3E1FFF8000000000003E3FFF8000000000003E3FFF8000000000003E3FFF8000000000003E7FFF 8000000000003E7FFF000000000000007FFF000000000000007FFF00000000000000FFFF000000 00000000FFFF00000000000000FFFF00000000000000FFFF00000000000000FFFF000000000000 00FFFF00000000000000FFFF00000000000000FFFF00000000000000FFFF00000000000000FFFF 00000000000000FFFF00000000000000FFFF00000000000000FFFF000000000000007FFF000000 000000007FFF000000000000007FFF0000000000003E7FFF8000000000003E3FFF800000000000 3E3FFF8000000000003E3FFF8000000000007E1FFF8000000000007E1FFFC000000000007E0FFF C000000000007E0FFFC00000000000FE07FFE00000000000FE07FFE00000000001FE03FFF00000 000001FE03FFF00000000003FE01FFF80000000007FE00FFFC0000000007FE007FFE000000000F FE003FFF000000001FFE001FFF800000003FFE000FFFC00000007FFE0007FFF0000001FFFE0001 FFFC000003FFFE0000FFFF80000FF7FE00003FFFF800FFC3FE00000FFFFFFFFF81FE000003FFFF FFFE00FE0000007FFFFFF8003E0000000FFFFFC0001E000000003FFE00000E>71 73 -7 1 86] 67 dc[79 71 -4 0 91]68 dc[70 70 -4 0 78]69 dc [65 70 -4 0 75]70 dc[<000000003FFE000000000000000FFFFFE0000E0000 00007FFFFFF8003E00000003FFFFFFFE00FE0000000FFFFFFFFF83FE0000003FFFFC00FFC7FE00 0000FFFF80001FFFFE000001FFFC000007FFFE000007FFF0000003FFFE00000FFFE0000001FFFE 00001FFF80000000FFFE00003FFF00000000FFFE00007FFE00000000FFFE0000FFFC00000000FF FE0001FFF800000000FFFE0003FFF800000000FFFE0003FFF000000000FFFE0007FFE000000000 FFFE0007FFE000000000FFFE000FFFC000000000FFFE000FFFC000000000FFFE001FFFC0000000 00FFFE001FFF8000000000FFFE003FFF8000000000FFFE003FFF8000000000FFFE003FFF800000 0000FFFE007FFF8000007FFFFFFFFE7FFF8000007FFFFFFFFE7FFF0000007FFFFFFFFE7FFF0000 007FFFFFFFFEFFFF0000007FFFFFFFFEFFFF0000000000000000FFFF0000000000000000FFFF00 00000000000000FFFF0000000000000000FFFF0000000000000000FFFF0000000000000000FFFF 0000000000000000FFFF0000000000000000FFFF0000000000000000FFFF0000000000000000FF FF0000000000000000FFFF00000000000000007FFF00000000000000007FFF0000000000000000 7FFF0000000000003E007FFF8000000000003E003FFF8000000000003E003FFF8000000000003E 003FFF8000000000007E001FFF8000000000007E001FFFC000000000007E000FFFC00000000000 7E000FFFC00000000000FE0007FFE00000000000FE0007FFE00000000001FE0003FFF000000000 01FE0003FFF00000000003FE0001FFF80000000007FE0000FFFC0000000007FE00007FFE000000 000FFE00003FFF000000001FFE00001FFF800000003FFE00000FFFC00000007FFE000007FFF000 0001FFFE000001FFFC000003FFFE000000FFFF80000FF7FE0000003FFFF800FFC3FE0000000FFF FFFFFF81FE00000003FFFFFFFE00FE000000007FFFFFF8003E000000000FFFFFC0001E00000000 003FFE00000E00>79 73 -7 1 93]71 dc[39 71 -3 0 45]73 dc[61 71 -4 0 71]76 dc[104 71 -4 0 113]77 dc[69 71 -4 0 81]80 dc[<0000000000000000FFF000FFFFFFFFF000001FFFFC00FFFFFFFF F000007FFFFE00FFFFFFFFF00001FFFFFF00FFFFFFFFF00003FFFC1F80FFFFFFFFF00007FFF007 C0001FFF8000000FFFE007E0001FFF8000001FFFE003E0001FFF8000003FFFC003F0001FFF8000 003FFFC001F0001FFF8000007FFFC001F0001FFF8000007FFFC001F0001FFF8000007FFF8001F0 001FFF8000007FFF8000E0001FFF8000007FFF800000001FFF8000007FFF800000001FFF800000 7FFF800000001FFF8000007FFF800000001FFF8000007FFF800000001FFF8000007FFF00000000 1FFF8000007FFF000000001FFF8000007FFF000000001FFF8000007FFF000000001FFF8000007F FF000000001FFF8000007FFF000000001FFF8000007FFF000000001FFF8000007FFE000000001F FF800000FFFE000000001FFF800000FFFE000000001FFF800001FFFC000000001FFF800001FFF8 000000001FFF800003FFF0000000001FFF800007FFE0000000001FFF80001FFFC0000000001FFF 80007FFF80000000001FFFFFFFFFFE00000000001FFFFFFFFFF800000000001FFFFFFFFFFE0000 0000001FFFFFFFFFFFC0000000001FFF80001FFFF0000000001FFF800003FFF8000000001FFF80 0000FFFE000000001FFF8000003FFF000000001FFF8000001FFF800000001FFF8000000FFFC000 00001FFF8000000FFFE00000001FFF8000000FFFE00000001FFF80000007FFF00000001FFF8000 0007FFF00000001FFF80000007FFF80000001FFF80000007FFF80000001FFF80000007FFF80000 001FFF80000007FFF80000001FFF80000007FFF80000001FFF80000007FFF80000001FFF800000 07FFF80000001FFF80000007FFF80000001FFF80000007FFF00000001FFF80000007FFF0000000 1FFF8000000FFFE00000001FFF8000000FFFE00000001FFF8000000FFFC00000001FFF8000001F FF800000001FFF8000003FFF800000001FFF8000007FFF000000001FFF800001FFFC000000001F FF80001FFFF8000000FFFFFFFFFFFFFFE0000000FFFFFFFFFFFFFF80000000FFFFFFFFFFFFFE00 000000FFFFFFFFFFFFF000000000FFFFFFFFFFFC0000000000>84 72 -4 1 89]82 dc[51 73 -7 1 66]83 dc[<0003FFFFFFFFFFF800000003FFFFFFFFFFF800000003FFFFFFFFFF F800000003FFFFFFFFFFF800000003FFFFFFFFFFF8000000000003FFF80000000000000003FFF8 0000000000000003FFF80000000000000003FFF80000000000000003FFF80000000000000003FF F80000000000000003FFF80000000000000003FFF80000000000000003FFF80000000000000003 FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF800000000000000 03FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF8000000000000 0003FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF80000000000 000003FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF800000000 00000003FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF8000000 0000000003FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF80000 000000000003FFF80000000000000003FFF80000000000000003FFF80000000000000003FFF800 00000000000003FFF80000000000000003FFF80000000000000003FFF800000000F8000003FFF8 000007C0F8000003FFF8000007C0F8000003FFF8000007C0F8000003FFF8000007C0F8000003FF F8000007C0FC000003FFF800000FC07C000003FFF800000F807C000003FFF800000F807C000003 FFF800000F807C000003FFF800000F807E000003FFF800000F807E000003FFF800001F807E0000 03FFF800001F807F000003FFF800003F807F000003FFF800003F807F800003FFF800007F807FC0 0003FFF80000FF807FE00003FFF80001FF807FF80003FFF80007FF803FFF0003FFF8003FFF003F FFFFFFFFFFFFFFFF003FFFFFFFFFFFFFFFFF003FFFFFFFFFFFFFFFFF003FFFFFFFFFFFFFFFFF00 3FFFFFFFFFFFFFFFFF00>74 70 -4 0 83]84 dc[<0000000001F000000000000000000003F800 000000000000000003F800000000000000000007FC00000000000000000007FC00000000000000 00000FFE0000000000000000000FFE0000000000000000001FFF0000000000000000001FFF0000 000000000000001FFF0000000000000000003FFF8000000000000000003FFF8000000000000000 007FFFC000000000000000007FFFC00000000000000000FFFFE00000000000000000FFFFE00000 000000000001FFFFF00000000000000001FFFFF00000000000000001FFFDF00000000000000003 FFFDF80000000000000003FFF8F80000000000000007FFF8FC0000000000000007FFF87C000000 000000000FFFF07E000000000000000FFFF03E000000000000000FFFE03E000000000000001FFF E03F000000000000001FFFC01F000000000000003FFFC01F800000000000003FFFC00F80000000 0000007FFF800FC00000000000007FFF8007C0000000000000FFFF0007E0000000000000FFFF00 03E0000000000000FFFE0003E0000000000001FFFE0003F0000000000001FFFC0001F000000000 0003FFFC0001F8000000000003FFFC0000F8000000000007FFF80000FC000000000007FFF80000 7C00000000000FFFF000007E00000000000FFFF000007E00000000000FFFE000003E0000000000 1FFFE000003F00000000001FFFC000001F00000000003FFFC000001F80000000003FFFC000000F 80000000007FFF8000000FC0000000007FFF80000007C0000000007FFF00000007C000000000FF FF00000007E000000000FFFE00000003E000000001FFFE00000003F000000001FFFE00000001F0 00000003FFFC00000001F800000003FFFC00000000F800000007FFF800000000FC00000007FFF8 000000007C00000007FFF0000000007C0000000FFFF0000000007E0000000FFFE0000000003E00 00001FFFE0000000003F0000001FFFE0000000001F0000003FFFC0000000001F8000003FFFC000 0000000F8000007FFF80000000003FE000FFFFFFFFE000001FFFFFE0FFFFFFFFE000001FFFFFE0 FFFFFFFFE000001FFFFFE0FFFFFFFFE000001FFFFFE0FFFFFFFFE000001FFFFFE0>83 72 -3 1 90]86 dc[<0003FF80007FF8007FFFF001FFFC01FFFFFC03FFFC07FFFFFF07FFFC0FFFC03F8FFF F83FFF0007CFFF003FFC0003EFFC007FF80001EFFC007FF80000FFFC00FFF000007FFC00FFF000 003FFC00FFF000003FFC00FFF000003FFC00FFF000003FFC00FFF000003FFC007FF800003FFC00 7FF800003FFC003FFC00003FFC001FFE00003FFC000FFF00003FFC0007FFC0003FFC0003FFF000 3FFC0000FFFE003FFC00003FFFE03FFC000007FFFFFFFC000000FFFFFFFC00000007FFFFFC0000 0000003FFC00000000003FFC00000000003FFC00000000003FFC0000F800003FFC0003FE00003F FC0007FF00003FFC0007FF00003FFC000FFF80007FF8000FFF80007FF8000FFF80007FF0000FFF 8000FFF0000FFF8001FFE00007FF0003FFC00007FE001FFF000003FFFFFFFE000001FFFFFFF800 00007FFFFFC000000007FFFC000000>54 46 -3 0 58]97 dc[<01F0001FF800000001F800FFFF 80000001FC03FFFFF0000001FE0FFFFFFC000001FF1FE01FFE000001FFBF0007FF800001FFFE00 01FFC00001FFFC0000FFE00001FFF800007FF00001FFF000003FF80001FFE000003FF80001FFE0 00001FFC0001FFE000001FFC0001FFE000001FFE0001FFE000001FFE0001FFE000000FFF0001FF E000000FFF0001FFE000000FFF0001FFE000000FFF8001FFE000000FFF8001FFE000000FFF8001 FFE000000FFF8001FFE000000FFF8001FFE000000FFF8001FFE000000FFF8001FFE000000FFF80 01FFE000000FFF8001FFE000000FFF8001FFE000000FFF0001FFE000000FFF0001FFE000000FFF 0001FFE000000FFF0001FFE000001FFE0001FFE000001FFE0001FFE000001FFC0001FFE000001F FC0001FFE000003FF80001FFF000007FF00001FFF800007FE00001FFFE0001FFC00001FFFF8003 FF800001FFDFF00FFF000001FFCFFFFFFC000001FFC3FFFFF0000001FFC07FFFC0000001FFC00F FC00000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0 000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FF C0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001 FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC00000000000 03FFC00000000000FFFFC00000000000FFFFC00000000000FFFFC00000000000FFFFC000000000 00FFFFC00000000000007FC00000000000>57 72 -4 0 66]98 dc[<00001FFE00000000FFFFE0 000007FFFFF800001FFFFFFE00007FFE00FF0000FFF0001F8001FFE0000FC003FFC00007E007FF 800003F00FFF000001F00FFE000000F81FFE000000F81FFC000000F83FFC000000003FFC000000 007FFC000000007FF8000000007FF800000000FFF800000000FFF800000000FFF800000000FFF8 00000000FFF800000000FFF800000000FFF800000000FFF800000000FFF800000000FFF8000000 007FF8000000007FF8000000007FF8000000003FFC00003E003FFC0000FF801FFC0001FFC01FFC 0001FFC00FFE0003FFE00FFE0003FFE007FF0003FFE003FF8003FFE001FFC003FFE000FFE001FF C0007FFC00FFC0001FFFFFFF800007FFFFFE000000FFFFF80000001FFFC000>45 46 -4 0 53] 99 dc[<00001FF803FFFF800001FFFF03FFFF800007FFFFC3FFFF80001FFFFFF3FFFF80007FF8 07FBFFFF8000FFE000FFFFE00001FFC0003FFFC00003FF00001FFFC00007FF00000FFFC0000FFE 000007FFC0001FFC000003FFC0001FFC000003FFC0003FFC000003FFC0003FFC000003FFC0003F F8000003FFC0007FF8000003FFC0007FF8000003FFC0007FF8000003FFC000FFF8000003FFC000 FFF8000003FFC000FFF8000003FFC000FFF8000003FFC000FFF8000003FFC000FFF8000003FFC0 00FFF8000003FFC000FFF8000003FFC000FFF8000003FFC000FFF8000003FFC0007FF8000003FF C0007FF8000003FFC0007FF8000003FFC0003FFC000003FFC0003FFC000003FFC0001FFC000003 FFC0001FFC000003FFC0000FFE000003FFC0000FFE000003FFC00007FF000007FFC00003FF8000 0FFFC00001FFC0001FFFC00000FFF0007FFFC000007FFC03FFFFC000001FFFFFF9FFC0000007FF FFE1FFC0000000FFFF81FFC00000000FFC01FFC0000000000001FFC0000000000001FFC0000000 000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC00000 00000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC000 0000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0000000000001FFC0 000000000001FFC0000000000001FFC0000000000003FFC00000000000FFFFC00000000000FFFF C00000000000FFFFC00000000000FFFFC00000000000FFFFC00000000000007FC000>57 72 -4 0 66]100 dc[<00000FFF80000000FFFFF8000007FFFFFE00001FFFFFFF80003FFE00FFC0007F F0001FE001FFC00003F003FF800001F807FF000000FC07FF0000007E0FFE0000003E1FFE000000 3E3FFC0000001C3FFC000000003FFC000000007FFC000000007FF8000000007FF800000000FFF8 00000000FFF800000000FFF800000000FFF800000000FFFFFFFFFFFCFFFFFFFFFFFEFFFFFFFFFF FEFFFFFFFFFFFEFFF8000007FEFFF8000007FE7FF8000007FE7FF8000007FE7FF8000007FC7FFC 000007FC3FFC000007FC3FFC00000FFC1FFC00000FF81FFE00000FF80FFE00001FF007FF00003F F003FF80003FE001FFC0007FC000FFE001FF80007FFC07FF00001FFFFFFE000007FFFFF8000001 FFFFE00000001FFE0000>47 46 -3 0 54]101 dc[<3FFFFFF800003FFFFFF800003FFFFFF800 003FFFFFF800003FFFFFF80000007FF0000000007FF0000000007FF0000000007FF0000000007F F0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF00000 00007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007F F0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF00000 00007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000007F F0000000007FF0000000007FF0000000007FF0000000007FF0000000007FF0000000FFFFFFFE00 00FFFFFFFE0000FFFFFFFE0000FFFFFFFE0000FFFFFFFE0000007FE0000000007FE0000000007F E0000000007FE0000000007FE0000000007FE0000000007FE0000000007FE0000000007FE00000 00007FE0000000007FE0003800007FE000FE00007FE001FF00007FE003FF80003FE003FF80003F F007FFC0003FF007FFC0001FF807FFC0000FF807FFC0000FFC03FF800007FF03FF800001FFC1FF 000000FFFFFF0000003FFFFC00000007FFF800000000FFC000>42 72 -3 0 36]102 dc[<0000 3FFFC000000007FFFFFE0000003FFFFFFFC00000FFFFFFFFF00003FFF000FFFC000FFF00000FFF 001FFC000003FF803FF0000000FFC03FE00000007FC07FC00000003FE07FC00000003FE0FF8000 00001FF0FF800000001FF0FF800000001FF0FF800000001FF0FF800000001FF07FC00000003FF0 7FC00000007FF03FE0000001FFE01FF800001FFFE00FFFFFFFFFFFC003FFFFFFFFFFC0007FFFFF FFFF8000FFFFFFFFFF8001FFFFFFFFFF0001FFFFFFFFFE0003FFFFFFFFF80003FFFFFFFFE00007 FFFFFFFF000007FFFFFFF0000007F8000000000007F0000000000007E0000000000007C0000000 000007C0000000000007C0000000000007C0000000000003C07FF000000003C7FFFF00000001DF FFFFC0000001FFFFFFF0000000FFE03FF8000001FF800FFC000003FF0007FE000007FE0003FF00 0007FE0003FF00000FFC0001FF80000FFC0001FF80000FFC0001FF80001FFC0001FFC0001FFC00 01FFC0001FFC0001FFC0001FFC0001FFC0001FFC0001FFC0001FFC0001FFC0000FFC0001FF8000 0FFC0001FF80000FFC0001FF81C007FE0003FF07F007FE0003FF07F003FF0007FE0FF801FF800F FC0FF800FFE03FFE0FF8007FFFFFFFC7F8001FFFFFC7FFF00007FFFF03FFF000007FF000FFE000 000000001F80>53 68 -3 21 59]103 dc[59 72 -4 0 66]104 dc[24 73 -4 0 32]105 dc[56 72 -4 0 63]107 dc[25 72 -4 0 32]108 dc[92 46 -4 0 99]109 dc[59 46 -4 0 66]110 dc[<00000FFF0000000000FFFFF000000007 FFFFFE0000001FFFFFFF8000007FFC03FFE00000FFE0007FF00001FFC0003FF80003FF80001FFC 0007FF00000FFE000FFE000007FF001FFE000007FF801FFC000003FF803FFC000003FFC03FFC00 0003FFC07FF8000001FFE07FF8000001FFE07FF8000001FFE07FF8000001FFE0FFF8000001FFF0 FFF8000001FFF0FFF8000001FFF0FFF8000001FFF0FFF8000001FFF0FFF8000001FFF0FFF80000 01FFF0FFF8000001FFF0FFF8000001FFF0FFF8000001FFF07FF8000001FFE07FF8000001FFE07F F8000001FFE03FF8000001FFC03FF8000001FFC03FFC000003FFC01FFC000003FF800FFC000003 FF000FFE000007FF0007FE000007FE0003FF00000FFC0001FF80001FF80000FFE0007FF000003F FC03FFC000001FFFFFFF80000007FFFFFE00000000FFFFF0000000000FFF000000>52 46 -3 0 59]111 dc[57 66 -4 20 66]112 dc[< FFFFFFE00000FFFFFFE00000FFFFFFE00000FFFFFFE00000FFFFFFE0000001FFC000000001FFC0 00000001FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001FFC0000000 01FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001FFC0 00000001FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001FFC0000000 01FFC000000001FFC000000001FFC000000001FFE000000001FFE000000001FFE000F80001FFE0 03FE0001FFF007FF0001FFF007FF0001FFF00FFF8001FFF80FFF8001FFB80FFF8001FFBC0FFF80 03FF9E0FFF80FFFF8F07FF00FFFF8FC3FF00FFFF87FFFE00FFFF83FFFC00FFFF80FFF00000FF80 3F8000>41 46 -4 0 49]114 dc[38 46 -4 0 47]115 dc[<00001FF0000001FFFC000007FFFE0000 0FFFFF80001FFE0F80003FFC07C0003FF803E0007FF803E0007FF001E000FFF001F000FFF001F0 00FFF001F000FFF001F000FFF001F000FFF001F000FFF001F000FFF001F000FFF001F000FFF000 0000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0 000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FF F0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF0000000FFF00000FFFFFFFFC0FF FFFFFFC0FFFFFFFFC0FFFFFFFFC00FFFFFFFC003FFF0000001FFF00000007FF00000003FF00000 003FF00000001FF00000000FF00000000FF000000007F000000007F000000007F000000003F000 000003F000000003F000000001F000000001F000000001F000000001F000000001F000000001F0 0000>36 66 -2 0 46]116 dc[<00003FFE007FFFE00001FFFF807FFFE00007FFFFE07FFFE000 1FFFFFF87FFFE0003FFC00FC7FFFE0007FF0003E7FF800007FE0001F7FF00000FFE0000F7FF000 00FFE00007FFF00001FFE00003FFF00001FFE00001FFF00001FFE00001FFF00001FFE00001FFF0 0001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FF F00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000 FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE000 00FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE0 0000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FFE00000FFF00001FF E00000FFF00001FFE00000FFF00003FFE00001FFF000FFFFE0007FFFF000FFFFE0007FFFF000FF FFE0007FFFF000FFFFE0007FFFF000FFFFE0007FFFF000007FE000003FF000>59 46 -4 0 66] 117 dc[<0000003C0000000000007E000000000000FF000000000000FF000000000001FF800000 000001FF800000000003FFC00000000003FFC00000000007FFE00000000007FFE0000000000FFF F0000000000FFFF0000000001FFFF8000000001FFFF8000000001FFEF8000000003FFEFC000000 003FFC7C000000007FFC7E000000007FF83E00000000FFF83F00000000FFF01F00000001FFF01F 80000001FFE00F80000003FFE00FC0000003FFE007C0000007FFC007E0000007FFC007E0000007 FF8003E000000FFF8003F000000FFF0001F000001FFF0001F800001FFE0000F800003FFE0000FC 00003FFC00007C00007FFC00007E00007FF800003E0000FFF800003F0000FFF800001F0001FFF0 00001F8001FFF000001F8001FFE000001FC0FFFFFF8001FFFFFFFFFF8001FFFFFFFFFF8001FFFF FFFFFF8001FFFFFFFFFF8001FFFF>56 46 -3 0 63]118 dc[<000001E000000F000000000003 F000001F800000000007F800003FC00000000007F800003FC0000000000FF800003FE000000000 0FFC00007FE0000000000FFC00007FE0000000001FFE0000FFF0000000001FFE0000FFF0000000 003FFE0000FFF8000000003FFF0001FFF8000000003FFF0001FFF8000000007FFF8003FFFC0000 00007FFF8003FF7C00000000FFFF8003FF7E00000000FFFFC007FF3E00000000FFF7C007FE3E00 000001FFE7E00FFE3F00000001FFE3E00FFC1F00000003FFE3E00FFC1F80000003FFC3F01FFC0F 80000003FFC1F01FF80F80000007FF81F83FF80FC0000007FF80F83FF007C000000FFF80F83FF0 07E000000FFF00FC7FF003E000000FFF007C7FE003E000001FFE007EFFE003F000001FFE003EFF C001F000003FFE003EFFC001F800003FFC003FFFC000F800003FFC001FFF8000F800007FF8001F FF80007C00007FF8000FFF00007C0000FFF8000FFF00007E0000FFF0000FFF00003E0001FFF000 07FE00003F0001FFE0000FFE00001F0001FFE0000FFC00001F0003FFE0000FFC00001F8003FFC0 001FFC00003FC0FFFFFF07FFFFE007FFFEFFFFFF07FFFFE007FFFEFFFFFF07FFFFE007FFFEFFFF FF07FFFFE007FFFEFFFFFF07FFFFE007FFFE>79 46 -3 0 86]119 dc[58 46 -2 0 63]120 dc[<01FE00000000000007FFC000000000001FFFF0 00000000003FFFF800000000007F43FE00000000007FE07F0000000000FFF03F8000000000FFF0 1F8000000000FFF00FC000000000FFF007E000000000FFF003E000000000FFF003F0000000007F E001F0000000003FC001F8000000001F8000F800000000000000FC000000000000007C00000000 0000007E000000000000003E000000000000003F000000000000003F000000000000003F000000 000000007F800000000000007F80000000000000FFC0000000000000FFC0000000000001FFE000 0000000001FFE0000000000003FFF0000000000003FFF0000000000007FFF8000000000007FFF8 00000000000FFFFC00000000000FFFFC00000000000FFF7C00000000001FFF7E00000000001FFE 3E00000000003FFE3F00000000003FFC1F00000000007FFC1F80000000007FF80F8000000000FF F80FC000000000FFF007C000000001FFF007E000000001FFF003E000000003FFE003F000000003 FFE003F000000003FFC001F000000007FFC001F800000007FF8000F80000000FFF8000FC000000 0FFF00007C0000001FFF00007E0000001FFE00003E0000003FFE00003F0000003FFC00001F0000 007FFC00001F8000007FFC00000F800000FFF800000FC00000FFF800000FC00000FFF000000FE0 007FFFFFC000FFFF807FFFFFC000FFFF807FFFFFC000FFFF807FFFFFC000FFFF807FFFFFC000FF FF80>57 66 -2 20 63]121 dc[<7FFFFFFFFFC0FFFFFFFFFFC0FFFFFFFFFFC0FFFFFFFFFFC07F FE0007FFC03FFF0000FFE01FFF00003FE01FFF80001FE00FFFC0000FE007FFE0000FE003FFE000 07E003FFF00007E001FFF80003E000FFFC0003E0007FFC0003E0007FFE0003E0003FFF0003F000 1FFF8001F0000FFF8001F0000FFFC001F00007FFE001F00003FFF000000001FFF800000001FFF8 00000000FFFC000000007FFE000000003FFF000000001FFF00003E001FFF80003E000FFFC0003E 0007FFE0003E0003FFE0003E0003FFF0003F0001FFF8003F0000FFFC003F00007FFC003F80007F FE001F80003FFF001FC0001FFF801FE0000FFF801FF0000FFFC01FFE0007FFE01FFFFFFFFFF01F FFFFFFFFF01FFFFFFFFFF01FFFFFFFFFE0>44 46 -3 0 53]122 dc /fc df[<0001FF8000000F FFF000003FFFFC0000FF81FF0001FE007F8003FC003FC007F8001FE00FF8001FF00FF0000FF01F F0000FF81FF0000FF83FF0000FFC3FF0000FFC3FE00007FC7FE00007FE7FE00007FE7FE00007FE 7FE00007FE7FE00007FEFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007 FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE000 07FFFFE00007FFFFE00007FFFFE00007FFFFE00007FFFFE00007FF7FE00007FE7FE00007FE7FE0 0007FE7FE00007FE7FE00007FE3FE00007FC3FE00007FC3FF0000FFC1FF0000FF81FF0000FF80F F0000FF00FF8001FF007F8001FE003FC003FC001FE007F8000FF81FF00003FFFFC00000FFFF000 0001FF8000>40 57 -4 1 49]48 dc[<7FFFFFFFC07FFFFFFFC07FFFFFFFC07FFFFFFFC0000FFE 0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000F FE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE000000 0FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000 000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE00 00000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFE 0000000FFE0000000FFE0000000FFE0000FFCFFE0000FFFFFE0000FFFFFE0000FFFFFE0000003F FE00000003FE00000000FE000000003E000000001E0000>34 56 -7 0 49]49 dc[38 56 -5 0 49]50 dc[<0007FF8000003FFFF00001FFFFFE0003FFFFFF0007FC03FFC01F E000FFE01F80007FF03FC0003FF87FE0003FFC7FF0003FFCFFF0001FFEFFF8001FFEFFF8001FFE FFF8001FFFFFF8001FFF7FF0001FFF7FF0001FFF3FE0001FFF1FC0001FFF0200001FFF0000001F FE0000001FFE0000001FFC0000003FFC0000003FF80000003FF00000007FE0000000FF80000003 FE00000FFFF800000FFF8000000FFFC00000001FF000000007FC00000003FE00000001FF000000 01FF80000000FFC0000000FFE003F0007FF007F8007FF00FFC007FF01FFE007FF81FFE007FF81F FE007FF81FFE007FF81FFE007FF81FFC007FF80FF8007FF00FF0007FF00780007FE003C000FFC0 01F000FF8000FE03FF00007FFFFE00001FFFF0000003FF8000>40 57 -4 1 49]51 dc[<0007FF FFFFC00007FFFFFFC00007FFFFFFC00007FFFFFFC0000001FFC000000001FFC000000001FFC000 000001FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001FFC000000001 FFC000FFFFFFFFFFC0FFFFFFFFFFC0FFFFFFFFFFC0FFFFFFFFFFC0F80000FFC0007C0000FFC000 3C0000FFC0001E0000FFC0000F0000FFC0000F8000FFC00007C000FFC00003C000FFC00001E000 FFC00000F000FFC00000F800FFC000007C00FFC000003C00FFC000001E00FFC000000F00FFC000 000F80FFC0000007C0FFC0000003C0FFC0000001E0FFC0000000F0FFC0000000F8FFC00000007C FFC00000003CFFC00000001EFFC00000000FFFC00000000FFFC000000007FFC000000003FFC000 000001FFC000000000FFC000000000FFC0000000007FC0000000003FC0000000001FC000000000 0FC0000000000FC00000000007C000>42 55 -3 0 49]52 dc[<000FFC0000007FFFC00001FFFF F00003FFFFFC0007F00FFE000FC003FF001F0000FF803E0000FFC03C00007FE07F00007FF07FC0 007FF0FFE0003FF8FFE0003FF8FFF0003FF8FFF0003FFCFFF0003FFCFFE0003FFC7FE0003FFC3F C0003FFC1F80003FFC0600003FFC0000003FFC0000003FFC0000003FF80000003FF80000003FF8 0000003FF00700007FF00F00007FE00F80007FC00FC000FF800FF000FF000FFE03FE000FBFFFF8 000F8FFFE0000F81FF00000F800000000F800000000F800000000F800000000F800000000F8000 00000F800000000F800000000FFFF800000FFFFE00000FFFFF80000FFFFFE0000FFFFFF0000FFF FFF8000FFFFFFC000FFFFFFE000FFFFFFF000FFFFFFF800FF8007FC00F800007C004000000C0> 38 57 -5 1 49]53 dc[<0000FFC0000007FFF800001FFFFE00007FFFFF0000FF80FFC001FE00 3FE003FC001FF007FC001FF00FF8001FF80FF8000FFC1FF8000FFC1FF0000FFE3FF0000FFE3FF0 000FFE3FF0000FFF7FF0000FFF7FF0000FFF7FF0000FFF7FF0000FFF7FF0000FFFFFF0000FFFFF F0000FFFFFF0000FFFFFF0000FFEFFF8000FFEFFF8000FFEFFF8000FFCFFF8000FFCFFFC000FF8 FFFC001FF0FFFE001FF0FFF6003FE0FFF3807F80FFF1F7FF00FFF0FFFE007FF07FF0007FF00000 007FF00000007FF00000003FF00000003FF00000003FF80007C01FF8000FE01FF8001FF00FF800 3FF80FFC003FF807FC003FF803FC003FF801FE001FF800FF000FF0007F0007F0003FC001F0001F E001E0000FFC07C00003FFFF8000007FFF0000000FF800>40 57 -4 1 49]54 dc[<0003E00000 000007F0000000000FF8000000001FFC000000001FFC000000001FFC000000001FFC000000001F FC000000001FFC000000001FFC000000001FFC000000001FFC000000000FFC000000000FFC0000 00000FFC000000000FFC000000000FFC0000000007FC0000000007FC0000000007FC0000000003 FE0000000003FE0000000003FE0000000001FE0000000001FE0000000000FE0000000000FF0000 0000007F00000000007F00000000003F00000000003F80000000001F80000000000F8000000000 0FC00000000007E00000000003E00000000003F00000F00001F80000F00000FC0000F000007E00 007800003E00007800001F00007800001F80007C00000FC0007C000007E0007FFFFFFFF0003FFF FFFFF0003FFFFFFFF8003FFFFFFFFC003FFFFFFFFE003FFFFFFFFF003FFFFFFFFF803FFFFFFFFF C01FFFFFFFFFC01FFFFFFFFFC01FFFFFFFFFC01FF0000000001F00000000001E0000000000>42 59 -5 1 49]55 dc[<0003FF8000003FFFF80000FFFFFE0003FFFFFF8007FE007FC00FF00007E0 1FE00003F03FC00001F83F800000FC7F000000FC7F0000007EFE0000007EFE0000007EFE000000 7FFE0000007FFE000000FFFE000000FFFE000001FFFE000003FF7F00000FFF7F00003FFF3F8000 FFFE3F8001FFFE1FC007FFFC0FE01FFFFC07F07FFFF801FDFFFFF000FFFFFFF0003FFFFFE0003F FFFF80007FFFFF0000FFFFFE0001FFFFF80003FFFFFC0007FFFFFF0007FFFE3F800FFFFC1FC00F FFF00FE01FFFC007E01FFF0007F01FFC0007F01FF80003F81FF00003F81FE00003F81FC00003F8 1FC00003F80FC00003F80FC00003F807C00007F007C00007F003E0000FE001F0000FC000F8003F 80007F00FF00003FFFFE00000FFFF8000001FF8000>40 57 -4 1 49]56 dc[<000FF80000007F FF000001FFFFC00003FFFFF00007F01FFC0007C003FE000FE001FF000FF000FF801FF8007FC01F FC003FC01FFC003FE01FFC003FF01FFC001FF00FF8001FF807F0001FF803E0001FFC0000000FFC 0000000FFC0000000FFE0000000FFE0000000FFE000FFE0FFE007FFF0FFF00FFEF8FFF01FE01CF FF03FC006FFF07F8007FFF0FF8003FFF1FF0003FFF3FF0001FFF3FF0001FFF7FF0001FFF7FF000 1FFF7FF0000FFFFFF0000FFFFFF0000FFFFFF0000FFFFFF0000FFEFFF0000FFEFFF0000FFEFFF0 000FFEFFF0000FFEFFF0000FFCFFF0000FFC7FF0000FFC7FF0000FF83FF0000FF83FF0001FF01F F8001FF00FF8001FE00FF8003FC007FC003F8001FE007F0000FF81FE00007FFFFC00001FFFF000 0001FF8000>40 57 -4 1 49]57 dc[<0000001FFF000000000001FFFFF0000000000FFFFFFC00 0000007FFFFFFF00000001FFFE003FC0000003FFE00007F000000FFF000001F800001FFC000000 7C00003FF80000003E00007FF00000001F0000FFE00000000F0001FFC0000000078003FF800000 0003C007FF0000000003C00FFF0000000001E00FFE0000000001E01FFE0000000001E01FFE0000 000000F03FFC0000000000F03FFC0000000000F03FFC0000000000F07FFC0000000000F07FF800 00000000007FF80000000000007FF8000000000000FFF8000000000000FFF8000000000000FFF8 000000000000FFF8000000000000FFF8000000000000FFF8000000000000FFF8000000000000FF F8000000000000FFF8000000000000FFF8000000000000FFF80000000000007FF8000000000000 7FF80000000000007FF80000000001F07FFC0000000001F03FFC0000000001F03FFC0000000001 F03FFC0000000003F01FFE0000000003F01FFE0000000003F00FFE0000000007F00FFF00000000 07F007FF000000000FF003FF800000000FF001FFC00000001FF000FFC00000003FF0007FF00000 003FF0003FF80000007FF0001FFC000001FFF0000FFF000003FFF00003FFE0000FCFF00001FFFE 007F87F000007FFFFFFE03F000000FFFFFFC01F0000001FFFFE000F00000001FFF000030>60 61 -5 1 71]67 dc[<003FE000FFF001FFFC07FFF007FFFE0FFFF01FFC0F0FFFF03FF0039FF8007F E000DFF0007FE0007FF000FFC0007FF000FFC0003FF000FFC0003FF000FFC0003FF000FFC0003F F0007FE0003FF0007FE0003FF0003FE0003FF0001FF0003FF0000FF8003FF00007FE003FF00001 FF803FF000007FF83FF000000FFFFFF0000000FFFFF0000000003FF0000000003FF0000000003F F00001C0003FF00007F0003FF0000FF8003FF0000FF8003FF0001FFC003FE0001FFC007FE0001F FC007FC0001FFC00FF80000FF801FF000007F007FE000003FFFFFC000001FFFFF00000001FFF00 0000>44 38 -3 0 48]97 dc[<0000FFE0000007FFFC00003FFFFF0000FFC03FC001FF0007E003 FE0001F007FC0000F80FF80000781FF000003C1FF000003C3FF000003C3FE00000007FE0000000 7FE00000007FE0000000FFE0000000FFE0000000FFE0000000FFE0000000FFFFFFFFFCFFFFFFFF FCFFFFFFFFFCFFE00003FC7FE00003FC7FE00003FC7FE00003FC7FE00007F83FF00007F83FF000 07F81FF00007F00FF8000FF00FF8000FE007FC001FC001FE003F8000FF80FF00003FFFFE00000F FFF8000001FFC000>38 38 -3 0 45]101 dc[48 60 -4 0 55]104 dc[48 55 -3 17 55]112 dc[35 38 -3 0 41]114 dc[< 0001FF000007FF80001FFFC0003FE0E0007FC07000FFC07800FF807801FF803C01FF803C01FF80 3C01FF803C01FF803C01FF803C01FF803C01FF803C01FF800001FF800001FF800001FF800001FF 800001FF800001FF800001FF800001FF800001FF800001FF800001FF800001FF800001FF800001 FF800001FF800001FF800001FF800001FF8000FFFFFFF0FFFFFFF0FFFFFFF01FFFFFF007FF8000 01FF800000FF8000007F8000003F8000003F8000001F8000001F8000000F8000000F8000000F80 00000F80000007800000078000000780000007800000078000>30 55 -2 0 38]116 dc /fd df [<7FFF1FFFC07FFF1FFFC07FFF1FFFC007F001FC0007F001FC0007F001FC0007F001FC0007F001 FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F0 01FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007 F001FC00FFFFFFFC00FFFFFFFC00FFFFFFFC0007F000000007F000000007F000000007F0000000 07F000F00007F001F80007F003FC0007F003FC0007F003FC0003F803FC0001F801F80000FC00F8 00007F80F000001FFFC0000001FF0000>34 42 -1 0 38]12 dc[<00FF8001FE0007FFF00FFFC0 0FFFFC7FFFE01FE07EFF81F03FC00FFE00707F8007F80038FF800FF00038FF003FF00000FF007F F80000FF00FF9C0000FF00FF0E00007F01FE0700007F03FC0380003F07FC01C0001F07F801C000 078FF000E000039FE000700001DFE000700000FFC0003800007F80001C00007F80001C00007F00 000E00007F0000070000FF0000070000FF80007FFC00FEC0007FFC01FC60007FFC01FC30000000 01FC1800000001FC1C00000001FC0C00000001F80E00000001F80700000001F80700000001F807 00000000F80700000000FC07000000007C06000000003C0E000000001F1C000000000FF8000000 0001F0000000>46 42 -3 0 53]38 dc[<00030007000E001C0038007000F001E003C003C007C0 07800F800F001F001F003F003E003E007E007E007E007C007C00FC00FC00FC00FC00FC00FC00FC 00FC00FC00FC00FC00FC007C007C007E007E007E003E003E003F001F001F000F000F80078007C0 03C003C001E000F000700038001C000E00070003>16 60 -6 15 27]40 dc[<8000C000E00070 0038001C001E000F000780078007C003C003E001E001F001F001F800F800F800FC00FC00FC007C 007C007E007E007E007E007E007E007E007E007E007E007E007E007C007C00FC00FC00FC00F800 F801F801F001F001E003E003C007C0078007800F001E001C0038007000E000C0008000>15 60 -5 15 27]41 dc[<2000300018000C0006000300030001800180018000C000C01CC07FC07FC0FF C0FFC0FF807F007F001C00>10 21 -5 12 19]44 dc[17 6 -1 -11 23]45 dc[<1C003E007F00FF80FF80FF807F003E001C00>9 9 -5 0 19] 46 dc[<003F800001FFF00007E0FC000FC07E001F803F001F803F003F001F803F001F807F001F C07F001FC07F001FC07F001FC0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF00 1FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FE07F001FC07F 001FC07F001FC07F001FC03F001F803F001F801F803F001F803F000FC07E0007E0FC0001FFF000 003F8000>27 39 -3 0 34]48 dc[<7FFFFE7FFFFE7FFFFE00FE0000FE0000FE0000FE0000FE00 00FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE00 00FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE00F8FE00FFFE00 FFFE0007FE00007E00001E00000E00>23 39 -5 0 34]49 dc[27 39 -3 0 34]50 dc[<00FF 800007FFF0001FFFFC003F01FE007C007F007E007F80FF007FC0FF003FC0FF003FE0FF003FE07E 003FE03C003FE000003FE000003FE000003FC000003FC000007F8000007F0000007E000001FC00 00FFF00000FFC0000007F0000001F8000001FC000000FE000000FF000000FF000F007F801F807F 803F807F803F807F803F807F803F80FF001F00FF000F81FE0007FFFC0003FFF000007F8000>27 39 -3 0 34]51 dc[<007FFFF8007FFFF8007FFFF80000FE000000FE000000FE000000FE000000 FE000000FE000000FE000000FE00FFFFFFF8FFFFFFF8FFFFFFF8E0007E0070007E0038007E001C 007E000E007E000E007E0007007E0003807E0001C07E0000E07E0000E07E0000707E0000387E00 001C7E00000E7E00000E7E0000077E000003FE000001FE000000FE000000FE0000007E0000003E 0000001E0000000E00>29 39 -2 0 34]52 dc[<00FF800003FFF0000FFFF8001F01FE003C007F 0078003F8078003F80FC001FC0FE001FC0FE001FE0FE001FE0FE001FE07C001FE018001FE00000 1FE000001FE000001FC000001FC000001F800C003F000E003E000F80FC000FFFF8000E7FC0000E 0000000E0000000E0000000E0000000E0000000E0000000FFE00000FFFC0000FFFE0000FFFF000 0FFFF8000FFFFC000FFFFE000F803F000C000300>27 39 -3 0 34]53 dc[<003FC00000FFF000 03FFFC0007E07E000FC03F001F803F801F801FC03F001FC03F001FE07F001FE07F001FE07F001F E07F001FE0FF001FE0FF001FE0FF001FE0FF001FC0FF801FC0FF801F80FFC03F00FFC03E00FF70 7C00FF3FF800FF0FC000FF0000007F0000007F0000007F0000003F8000003F801F001F803F801F C03F800FC03F8007E03F8003F01F8001FC0F0000FFFE00003FFC000007F000>27 39 -3 0 34] 54 dc[<00380000007C000000FE000000FE000000FE000000FE000000FE000000FE000000FE00 0000FE0000007E0000007E0000007E0000007E0000003E0000003E0000003F0000001F0000001F 0000000F0000000F00000007800000078000000380000001C0000000E000E000E000E0007000E0 00380070001C0070000E0070000E007FFFFF007FFFFF807FFFFFC07FFFFFE03FFFFFF03FFFFFF0 3FFFFFF03E00000038000000>28 41 -4 0 34]55 dc[<007FC00003FFF8000FFFFC001FC03E00 3F000F007C0007807C0003C0F80003C0F80003E0F80003E0F80003E0F80007E0F80007E078001F E07C007FE03C01FFC01E03FFC00F0FFF8007FFFF0001FFFE0001FFFC0003FFF80007FFE0000FFF F8001FFE3C001FFC1E003FF01F003FC00F003F000F803F000F803E000F803E000F801E000F801E 001F000F003F0007C07E0003FFFC0001FFF000003FC000>27 39 -3 0 34]56 dc[<01FE000007 FF80000FFFE0001E03F0001F01F8003F807C003F807E003F803F003F803F001F003F8000003F80 00001FC000001FC000001FC000001FE0007E1FE003FF9FE007C1DFE00F807FE01F807FE03F003F E07F003FE07F001FE0FF001FE0FF001FE0FF001FE0FF001FE0FF001FC0FF001FC0FF001FC0FF00 1F807F001F807F003F003F803F001F807E000FE0FC0007FFF80001FFF000007F8000>27 39 -3 0 34]57 dc[<1C003E007F00FF80FF80FF807F003E001C00000000000000000000000000000000 0000001C003E007F00FF80FF80FF807F003E001C00>9 27 -5 0 19]58 dc[47 41 -2 0 52]65 dc[41 41 -3 0 49]66 dc[< 00003FF800000003FFFF0000000FFFFFC000003FF007E00000FF8000F80001FE00003C0003FC00 001E0007F000000E000FF0000007001FE0000007001FE0000003803FC0000003803FC000000380 7FC0000003807F80000000007F8000000000FF8000000000FF8000000000FF8000000000FF8000 000000FF8000000000FF8000000000FF8000000000FF8000000000FF80000000007F8000000000 7F80000003807FC0000003803FC0000003803FC0000007801FE0000007801FE0000007800FF000 000F8007F000001F8003FC00003F8001FE00007F8000FF8001FF80003FF007DF80000FFFFF8780 0003FFFE038000003FF00180>41 41 -4 0 50]67 dc[45 41 -3 0 53]68 dc[39 41 -3 0 45]69 dc[36 41 -3 0 43]70 dc[<00007FF003000003FFFE0F00001FFFFF1F00003FF007BF0000FF8001 FF0001FE0000FF0003F80000FF0007F00000FF000FF00000FF001FE00000FF001FE00000FF003F C00000FF003FC00000FF007FC00000FF007F8001FFFFF87F8001FFFFF8FF8001FFFFF8FF800000 0000FF8000000000FF8000000000FF8000000000FF8000000000FF8000000000FF8000000000FF 80000000007F80000000007F80000007007FC0000007003FC0000007003FC000000F001FE00000 0F001FE000000F000FF000001F0007F000003F0003F800003F0001FE0000FF0000FF8001FF0000 3FF00FFF00001FFFFF0F000003FFFC070000007FE00300>45 41 -4 0 54]71 dc[22 41 -2 0 26]73 dc[34 41 -3 0 41]76 dc[58 41 -3 0 65]77 dc[<0000FFE00000000FFFFE0000003FC07F8000 00FF001FE00001FC0007F00003F80003F80007F00001FC000FF00001FE001FE00000FF001FE000 00FF003FC000007F803FC000007F807FC000007FC07FC000007FC07F8000003FC0FF8000003FE0 FF8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF8000 003FE0FF8000003FE0FF8000003FE07F8000003FC07F8000003FC07F8000003FC07FC000007FC0 3FC000007F803FC000007F801FE00000FF001FE00000FF000FF00001FE0007F00001FC0003F800 03F80001FC0007F000007F001FC000003FC07F80000007FFFC00000000FFE00000>43 41 -4 0 52]79 dc[39 41 -3 0 47]80 dc[<00000000780000000001FE0000 000003FF0000000003FF8000000007FF8000000007FFC00000000FFFC00000000FFFC00000000F FFE00000000F81E00000001F00600000001E00600000FFFE0060000FFFFE0000003FE07F800000 FFC03FE00001FCC037F00003F8C063F80007F060C1FC000FF03F81FE001FE01F00FF001FE00000 FF003FC000007F803FC000007F807FC000007FC07F8000003FC07F8000003FC0FF8000003FE0FF 8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF8000003FE0FF800000 3FE0FF8000003FE0FF8000003FE07F8000003FC07F8000003FC07FC000007FC07FC000007FC03F C000007F803FC000007F801FE00000FF001FE00000FF000FF00001FE0007F00001FC0003F80003 F80001FC0007F000007F001FC000003FC07F80000007FFFC00000000FFE00000>43 53 -4 12 52]81 dc[48 41 -3 0 52]82 dc[29 41 -4 0 38]83 dc[<007FFFFFE000007FFFFFE000007FFFFFE00000003FC0000000003FC0000000 003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0 000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000 003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0000000003FC0 0000E0003FC000E0E0003FC000E0E0003FC000E0E0003FC000E0E0003FC000E0F0003FC001E0F0 003FC001E070003FC001C078003FC003C078003FC003C07E003FC007C07F803FC03FC07FFFFFFF FFC07FFFFFFFFFC07FFFFFFFFFC0>43 40 -2 0 48]84 dc[<00001FF800000001FFFF00000007 FFFFC000000FF007E000003FC000F000007F00003800007E00001C0000FE00001C0001FE00000E 0001FC00000E0003FC0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC 0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC000007 0003FC0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC 0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC0000070003FC000007 0003FC0000070003FC0000070003FC00000700FFFFF001FFFCFFFFF001FFFCFFFFF001FFFC>46 41 -3 0 53]85 dc[<000001C0000000000003E0000000000003E0000000000007F00000000000 07F000000000000FF800000000000FF800000000000FF800000000001FFC00000000001FFC0000 0000003FFE00000000003FCE00000000007FCF00000000007F870000000000FF878000000000FF 038000000000FF038000000001FF01C000000001FE01C000000003FE01E000000003FC00E00000 0007FC00F000000007F8007000000007F800700000000FF000380000000FF000380000001FF000 1C0000001FE0001C0000003FE0001E0000003FC0000E0000007FC0000F0000007F800007000000 7F800007000000FF000003800000FF000003800001FF000003C00001FE000001C00003FE000001 E000FFFFF0003FFF80FFFFF0003FFF80FFFFF0003FFF80>49 41 -1 0 52]86 dc[<00000E0000 0700000000001F00000F80000000001F00000F80000000001F80001F80000000003F80001FC000 0000003F80001FC0000000003FC0003FC0000000007FC0003FE0000000007FC0003FE000000000 FFE0007FF000000000FFE0007FF000000000FFF000FFF000000001FE7000FF3800000001FE7000 FF3800000001FE7801FF3800000003FC3801FE1C00000003FC3801FE1C00000007FC1C03FC1E00 000007F81C03FC0E00000007F81E07FC0E0000000FF00E07F8070000000FF00E07F8070000001F F00F0FF0078000001FE0070FF0038000001FE0070FF0038000003FE0039FE003C000003FC0039F E001C000003FC003FFE001C000007F8001FFC000E000007F8001FFC000E00000FF8000FF8000F0 0000FF0000FF8000700000FF0000FF8000700001FF0000FF0000780001FE0000FF0000380001FE 0001FF0000380003FC0001FE00001C0003FC0001FE00001C00FFFFE07FFFF007FFF0FFFFE07FFF F007FFF0FFFFE07FFFF007FFF0>68 41 -1 0 71]87 dc[<01FC03FC0FFF0FFC3F839FFC7F00DF 807E007F80FE003F80FE003F80FE003F80FE003F807F003F803F003F803F803F800FE03F8007FC 3F8000FFFF80000FFF8000003F8000003F8000003F8007003F800F803F801FC03F001FC07E001F C07E000F81F80007FFF00001FF8000>30 27 -2 0 33]97 dc[<0E01FC00000F07FF80000F9E07 E0000FF803F0000FF001F8000FE000FC000FE000FE000FE0007F000FE0007F000FE0007F000FE0 007F800FE0007F800FE0007F800FE0007F800FE0007F800FE0007F800FE0007F800FE0007F000F E0007F000FE0007F000FE000FE000FE000FC000FF000F8000FF801F0000FFE07E0000FE7FF8000 0FE1FE00000FE00000000FE00000000FE00000000FE00000000FE00000000FE00000000FE00000 000FE00000000FE00000000FE00000000FE00000000FE0000000FFE0000000FFE0000000FFE000 0000>33 42 -2 0 38]98 dc[<001FE00000FFFC0003F01E0007E007000FC003801F8001C03F80 01C07F8000007F0000007F000000FF000000FF000000FF000000FF000000FF000000FF000000FF 0000007F0000007F0000007F800E003F801F001F803F800FC03F8007E03F8003F01F0000FFFE00 001FF800>26 27 -2 0 31]99 dc[<003FC3FF8000FFF3FF8003F03BFF8007C00FF8000F8007F8 001F8003F8003F8003F8007F0003F8007F0003F8007F0003F800FF0003F800FF0003F800FF0003 F800FF0003F800FF0003F800FF0003F800FF0003F8007F0003F8007F0003F8007F0003F8003F80 03F8001F8003F8000FC007F80007E00FF80003F03FF80000FFFBF800001FE3F800000003F80000 0003F800000003F800000003F800000003F800000003F800000003F800000003F800000003F800 000003F800000003F800000003F80000003FF80000003FF80000003FF800>33 42 -2 0 38] 100 dc[<001FF00000FFFE0003F81F0007E003800FC001C01F8000E03F8000E07F0000007F0000 007F000000FF000000FF000000FF000000FFFFFFE0FFFFFFE0FF0007E0FF0007E07F0007E07F00 07C07F000FC03F800FC01F800F800F801F8007C01F0003F07E0001FFF800003FE000>27 27 -2 0 32]101 dc[<7FFF807FFF807FFF8007F00007F00007F00007F00007F00007F00007F00007F0 0007F00007F00007F00007F00007F00007F00007F00007F00007F00007F00007F00007F00007F0 00FFFFC0FFFFC0FFFFC007F00007F00007F00007F00007F00007F00007F00007F03E07F07F03F0 7F03F87F01F87F00FE3E003FFC0007F0>24 42 -2 0 21]102 dc[<007FF00003FFFE000FC01F 801F0007C03C0001E07C0001F0F80000F8F80000F8F80000F8F80000F87C0001F83E0007F01FFF FFF007FFFFE00FFFFFC01FFFFF801FFFFF003FFFF8003E0000003C000000380000003800000018 FF80001FFFE0000FC1F8001F80FC001F007C003F007E007F007F007F007F007F007F007F007F00 7F007F007F007F003F007E101F007C381F80FC7C0FC1FE7C03FFE7F800FF81F0>30 40 -2 13 34]103 dc[33 42 -3 0 38]104 dc[15 43 -3 0 20]105 dc[<0FF0003FFC007C3E00FE1F00FE1F80FE0FC0FE0FE07C0FE000 0FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE000 0FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE0000FE000 0FE0000FE001FFE001FFE001FFE000000000000000000000000000000000000000000000070000 0F80001FC0003FE0003FE0003FE0001FC0000F80000700>19 55 4 12 21]106 dc[31 42 -2 0 36]107 dc[15 42 -3 0 20]108 dc[53 27 -3 0 58 ]109 dc[33 27 -3 0 38]110 dc[<003FE000 01FFFC0007F07F000FC01F801F800FC03F800FE03F800FE07F0007F07F0007F0FF0007F8FF0007 F8FF0007F8FF0007F8FF0007F8FF0007F8FF0007F8FF0007F87F0007F07F0007F07F0007F03F00 07E03F800FE01F800FC00FC01F8003F07E0001FFFC00003FE000>29 27 -2 0 34]111 dc[ 33 39 -2 12 38]112 dc[24 27 -2 0 28]114 dc[22 27 -2 0 27] 115 dc[<001F8000FFC001F86003F87003F03807F03807F03807F03807F03807F03807F03807F0 0007F00007F00007F00007F00007F00007F00007F00007F00007F00007F00007F00007F000FFFF F0FFFFF01FFFF007F00003F00003F00001F00000F00000F00000F0000070000070000070000070 00>21 38 -1 0 27]116 dc[<003FC3FF8001FFF3FF8003F03BFF8007E00FF80007E007F8000F E007F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F800 0FE003F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F8000FE003F8 000FE003F8000FE003F8000FE003F800FFE03FF800FFE03FF800FFE03FF800>33 27 -3 0 38] 117 dc[<0001C000000003E000000003E000000007F000000007F00000000FF80000000FF80000 000FF80000001FDC0000001FDC0000003FDE0000003F8E0000007F8F0000007F070000007F0700 0000FE03800000FE03800001FC01C00001FC01C00003FC01E00003F800E00007F800F00007F000 700007F0007000FFFE03FF80FFFE03FF80FFFE03FF80>33 27 -1 0 36]118 dc[<00078003C0 0000078003C000000FC007E000000FC007E000000FC007E000001FE00FF000001FE00FF000003F F01FF800003FF01FB800003FF01FB800007F783F3C00007F383F1C0000FF383F1E0000FE1C7E0E 0000FE1C7E0E0001FE1EFC0F0001FC0EFC070001FC0EFC070003F807F8038003F807F8038007F8 07F803C007F003F001C007F003F001C00FE007E000E0FFFE7FFC0FFEFFFE7FFC0FFEFFFE7FFC0F FE>47 27 -1 0 50]119 dc[33 27 -1 0 36] 120 dc[<0FC00000003FE00000007C78000000FE3C000000FE1E000000FE0E000000FE0F000000 7C070000003807800000000380000000038000000001C000000001C000000003E000000003E000 000007F000000007F00000000FF80000000FF80000000FF80000001FDC0000001FDC0000003FDE 0000003F8E0000007F8F0000007F070000007F07000000FE03800000FE03800001FC01C00001FC 01C00003FC01E00003F800E00007F800F00007F000700007F0007000FFFE03FF80FFFE03FF80FF FE03FF80>33 39 -1 12 36]121 dc[25 27 -2 0 31]122 dc /fe df[<01FC003F800FFF81FFE01F81E7F0783F00 7FC0187E003F000CFE007E000CFC00FF0000FC01F98000FC03F0C000FC07F0C0007C07E060003C 0FC030001E1F8018000E1F001800073F000C0003BE00060000FE000600007C00030000FC000180 00FC00018000FE001FFC00FF001FFC01F380000001F180000001F0C0000001F060000001F06000 0001E030000001E030000000F030000000F030000000706000000038600000001FC00000000F80 0000>38 35 -2 0 44]38 dc[<00180030006000C001C00380070007000E001E001C003C003C00 3C007800780078007800F800F000F000F000F000F000F000F000F000F000F000F000F800780078 00780078003C003C003C001C001E000E0007000700038001C000C0006000300018>13 49 -5 12 22]40 dc[13 49 -3 12 22]41 dc[14 4 -1 -9 19]45 dc[<387CFEFEFE7C38>7 7 -4 0 16]46 dc[<00FE0007FF C00F83E01F01F03E00F83E00F87C007C7C007C7C007CFC007EFC007EFC007EFC007EFC007EFC00 7EFC007EFC007EFC007EFC007EFC007EFC007EFC007EFC007C7C007C7C007C7C007C3E00F83E00 F81F01F00F83E007FFC000FE00>23 32 -2 0 28]48 dc[<7FFFE07FFFE001F80001F80001F800 01F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F800 01F80001F80001F80001F80001F80001F80001F80001F80001F800FFF800FFF80001F800007800 001800>19 32 -4 0 28]49 dc[21 32 -3 0 28 ]50 dc[<01FE000FFFC01E07F07801F87E01FCFF00FCFF00FEFF00FEFF00FE7E00FE3C00FE0000 FC0000FC0001F80001F00007C001FF0001FE00001F800007C00003E00003F01F03F01F03F83F81 F83F81F83F81F83F03F01E03F00F07E007FFC000FE00>23 32 -2 0 28]51 dc[<00FFFE00FFFE 0007E00007E00007E00007E00007E00007E00007E0FFFFFEFFFFFEE007E07007E03807E01807E0 0C07E00E07E00707E00307E00187E001C7E000E7E00077E00037E0001FE0001FE0000FE00007E0 0003E00003E00001E00000E0>23 32 -2 0 28]52 dc[<03F8000FFF001C1F803007C07007E0FC 03F0FC03F0FE03F8FE03F87C03F83803F80003F80003F80003F00003F01803E01807E01E0FC01F FF0019FC001800001800001800001800001BC0001FF8001FFE001FFF001FFF801FFFC01E01E010 0020>21 32 -3 0 28]53 dc[<00FF0003FFC00783E00F00F01E00F83E007C3C007C7C007E7C00 7E7C007EFC007EFC007EFC007EFC007EFE007CFE007CFF00F8FD80F0FCFFE0FC7FC0FC08007C00 007C00007E00F03E01F83E01F81F01F80F01F807C0F003F07000FFE0001F80>23 32 -2 0 28] 54 dc[<01E00003F00003F00003F00003F00003F00003F00003F00001F00001F00001F00000F0 0000F00000F000007800007800003800001800001C00000C00000600C00300C00300C00180E000 C0E000607FFFF07FFFF87FFFF87FFFFC7FFFFE7FFFFE780000600000>23 34 -3 0 28]55 dc[< 01FF000FFFC01F01F03C0038780038F8001CF0001CF0001EF0001EF0003EF000FE7801FE7807FC 3C1FFC1E7FF807FFF003FFE007FFC00FFF801FFFC01FF9E03FE0F03F80783F00783E00783C0078 1C00781C00F00E00F00703E003FFC000FE00>23 32 -2 0 28]56 dc[<03F8000FFE001C0F801E 03C03F01E03F00F03F00F83F00F81E007C00007C00007C00207E07FC7E0FFE7E1E037E3E01FE7C 00FE7C00FEFC007EFC007EFC007EFC007EFC007CFC007CFC007C7C00787C00F83E00F01E01F00F 83E007FF8001FE00>23 32 -2 0 28]57 dc[<387CFEFEFE7C380000000000000000387CFEFEFE 7C38>7 22 -4 0 16]58 dc[37 34 -2 0 42]65 dc[34 34 -2 0 40]66 dc[<0003FE0000001FFFC00000FF00F000 01F800380003F0000C0007C00006000F800003001F800003003F000003803F000001807F000001 807E000001807E00000000FE00000000FE00000000FE00000000FE00000000FE00000000FE0000 0000FE00000000FE000000007E000001807E000001807F000001803F000003803F000003801F80 0007800F8000078007C0000F8003E0001F8001F8003F8000FF01E380001FFF81800003FE0080> 33 34 -3 0 40]67 dc[37 34 -2 0 43]68 dc[32 34 -2 0 37]69 dc[30 34 -2 0 35]70 dc[<0003FF00C0001FFFC3C0007F80E7C001FC003FC003 F0001FC007E0001FC00FC0001FC01F80001FC03F00001FC03F00001FC07F00001FC07F00001FC0 7E000FFFFCFE000FFFFCFE00000000FE00000000FE00000000FE00000000FE00000000FE000000 00FE000000007E000000C07E000000C07F000000C03F000001C03F000001C01F800003C00FC000 03C007C00007C003F0000FC001F8003FC0007F00F1C0001FFFC0C00003FE0040>38 34 -3 0 44 ]71 dc[39 34 -2 0 44]72 dc[19 34 -1 0 21]73 dc[29 34 -2 0 34]76 dc[48 34 -2 0 53]77 dc[39 34 -2 0 44]78 dc[<0007FC0000003FFF800000FC07E00003F0 01F80007E000FC000FC0007E001F80003F003F80003F803F00001F807F00001FC07F00001FC07E 00000FC0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0 FE00000FE0FE00000FE07E00000FC07E00000FC07F00001FC03F00001F803F00001F801F80003F 001F80003F000FC0007E0007E000FC0003F001F80000FC07E000003FFF80000007FC0000>35 34 -3 0 42]79 dc[32 34 -2 0 38]80 dc[39 34 -2 0 42]82 dc[<80FF80C7FFE0FF00F8FC003CF0003C E0001EE0001EC0001FC0001FC0001F00003F00003F00007F0003FF003FFE03FFFE0FFFFC1FFFF8 3FFFF07FFFC07FFF00FFE000FF0000FC0000FC000CF8000CF8000C78001C78001C7C003C3C007C 1F03FC07FF8C01FC04>24 34 -3 0 31]83 dc[<03FFFFF80003FFFFF8000003F800000003F800 000003F800000003F800000003F800000003F800000003F800000003F800000003F800000003F8 00000003F800000003F800000003F800000003F800000003F800000003F800000003F800000003 F800000003F800000003F80000C003F800C0C003F800C0C003F800C0C003F800C0E003F801C0E0 03F801C06003F801807003F803807803F807807E03F80F807FFFFFFF807FFFFFFF80>34 34 -2 0 39]84 dc[<0001FF0000000FFFE000003F80F800007E001C0000FC000E0001F800060003F800 030003F000030007F000018007F000018007F000018007F000018007F000018007F000018007F0 00018007F000018007F000018007F000018007F000018007F000018007F000018007F000018007 F000018007F000018007F000018007F000018007F000018007F000018007F000018007F0000180 07F000018007F0000180FFFF803FFCFFFF803FFC>38 34 -2 0 43]85 dc[<0000E0000E000000 00E0000E00000000F0001E00000001F0001F00000001F0001F00000003F8003F80000003F8003F 80000003FC007F80000007FC007FC0000007FC007FC000000FF600FFE000000FE600FE6000000F E600FE6000001FE301FC3000001FC301FC3000001FC383FC3000003F8183F81800003F8183F818 00007F80C7F81C00007F00C7F00C00007F00C7F00C0000FF006FE0060000FE006FE0060000FE00 7FE0060001FC003FC0030001FC003FC0030003FC003F80038003F8003F80018003F8007F800180 07F0007F0000C007F0007F0000C00FF000FF0000E0FFFF0FFFF01FFEFFFF0FFFF01FFE>55 34 -1 0 58]87 dc[<07E03F1FF87F7E0CF87E02F0FC01F0FC01F0FC01F0FC01F07E01F03F01F01F C1F003FDF0003FF00001F00001F01E01F03F01F03F01E03F03E03F07C01FFF8007FC00>24 22 -2 0 27]97 dc[<180FC0001C3FF8001EE07C001FC03E001F801F001F001F801F000F801F000F C01F000FC01F000FC01F000FC01F000FC01F000FC01F000FC01F000FC01F000F801F000F801F00 1F001F801E001FF07C001F3FF8001F0FE0001F0000001F0000001F0000001F0000001F0000001F 0000001F0000001F0000001F0000001F0000001F000000FF000000FF000000>26 35 -2 0 31] 98 dc[<00FE0007FF800FC0E01F00603E00307E00007E00007C0000FC0000FC0000FC0000FC00 00FC0000FC00007C00007C01E07E03F03E03F01F03F00F83F007FFE000FF80>20 22 -2 0 25] 99 dc[<01FC3FC007FF3FC00F83BE001E00FE003E007E007C003E007C003E00FC003E00FC003E 00FC003E00FC003E00FC003E00FC003E00FC003E00FC003E007C003E007E003E003E003E001F00 7E000F81FE0007FFBE0001FC3E0000003E0000003E0000003E0000003E0000003E0000003E0000 003E0000003E0000003E0000003E0000003E000001FE000001FE00>26 35 -2 0 31]100 dc[< 00FF0003FFC00FC0701F00303E00187E00007C00007C0000FC0000FC0000FC0000FFFFF8FFFFF8 FC00F8FC00F87C00F87C00F03E01F01E01E00F87C007FF8000FE00>21 22 -2 0 26]101 dc[< 7FF8007FF8000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F8000 0F80000F80000F80000F80000F80000F80000F8000FFFC00FFFC000F80000F80000F80000F8000 0F80000F80000F83C00F87E007C7E003C7E001E3E000FFC0003F80>19 35 -1 0 17]102 dc[< 01FF000FFFE03F01F87C007C78003CF0001EF0001EF0001EF0001E70003E3800FC1FFFFC0FFFF8 1FFFF03FFF8038000030000030000013FC001FFF001F0F803E07C03C03C07C03E07C03E07C03E0 7C03E07C03E03C03C03E07CF1F0F8F0FFF7F03FC1E>24 33 -2 11 28]103 dc[26 35 -2 0 31]104 dc[11 36 -2 0 16]105 dc[<1F807FE0 78F8FC7CFC3CFC3E783E003E003E003E003E003E003E003E003E003E003E003E003E003E003E00 3E003E003E003E003E003E003E003E003E03FE03FE00000000000000000000000000000038007C 00FE00FE00FE007C0038>15 46 3 10 17]106 dc[26 35 -2 0 30]107 dc[11 35 -2 0 16]108 dc[43 22 -2 0 48]109 dc[26 22 -2 0 31]110 dc[<00FE0007FFC00F 83E01F01F03E00F87C007C7C007CFC007EFC007EFC007EFC007EFC007EFC007EFC007E7C007C7C 007C7C007C3E00F81E00F00F83E007FFC000FE00>23 22 -2 0 28]111 dc[26 32 -2 10 31]112 dc[<0000FFE00000FFE000001F0000001F0000001F0000001F 0000001F0000001F0000001F0000001F0001FC1F0007FF9F000FC1DF001F007F003E003F007E00 1F007E001F00FC001F00FC001F00FC001F00FC001F00FC001F00FC001F00FC001F007C001F007E 001F007E003F003F003F001F006F000FC1C70007FF870000FE0300>27 32 -2 10 30]113 dc[< FFF000FFF0001F00001F00001F00001F00001F00001F00001F00001F00001F00001F00001F0000 1F00001F00001F83C01E87E01E87E01EC7E01E67E0FE3FC0FE1F00>19 22 -2 0 23]114 dc[< C7F000EFFC00FC0E00F00700E00380E00380C00380C00780000F8001FF000FFF003FFE007FF800 7FE000FC0000F00300E00300E00300600700781F003FFF000FF300>17 22 -2 0 22]115 dc[< 00F80003FE0007C3000F83000F81800F81800F81800F81800F81800F80000F80000F80000F8000 0F80000F80000F80000F80000F80000F80000F8000FFFF00FFFF003F80000F8000078000078000 038000038000018000018000018000018000>17 32 -1 0 22]116 dc[<01FC3FC007FF3FC00F 81BE001F00FE001F007E001F003E001F003E001F003E001F003E001F003E001F003E001F003E00 1F003E001F003E001F003E001F003E001F003E001F003E001F003E001F003E00FF01FE00FF01FE 00>26 22 -2 0 31]117 dc[<000E0000000E0000001F0000001F0000003F8000003F8000007F C000007CC000007CC00000F8600000F8600001F0300001F0300003E0180003E0180007E01C0007 C00C000FC00E000F8006000F800600FFE01FE0FFE01FE0>27 22 -1 0 30]118 dc[<001800C0 00003800E000003C01E000007C01F000007E03F000007E03F00000FE03D80000FB07D80001FB07 9C0001F38F8C0001F18F0C0003E18F060003E0DF060007E0DE070007C0DE030007C07E03000F80 7C01800F807C01800F807801801F007800C0FFE7FF07F8FFE7FF07F8>37 22 -1 0 40]119 dc[ 27 22 -1 0 30]120 dc[<1F0000007F80000069C00000FC600000 FC300000FC3800007818000000180000000C0000000C0000000E0000000E0000001F0000001F00 00003F8000003F8000007FC000007CC000007CC00000F8600000F8600001F0300001F0300003E0 180003E0180007E01C0007C00C000FC00E000F8006000F800600FFE01FE0FFE01FE0>27 32 -1 10 30]121 dc /ff df[<0F00F00F00F00F00F00F00F00F00F00F00F00F00F00F00F00F00F00F 00F00F00F00F00F00F00F00F00F00F00F00F00F00F00F0FFF8F0FFF8F0FFF8F00F00000F00000F 00000F00000F00000F00000F000007000007800003F8F001F8F000F8F00000F0>20 33 0 0 24] 12 dc[<018001C001800180C183E187F99F7DBE1FF807E007E01FF87DBEF99FE187C183018001 8001C00180>16 20 -3 -14 23]42 dc[10 3 -1 -9 15]45 dc[ 4 4 -4 0 13]46 dc[15 31 -4 0 23]49 dc[18 31 -2 0 23]50 dc[4 20 -4 0 13]58 dc[5 26 -3 6 13]59 dc[27 32 -1 0 30 ]65 dc[21 32 -5 0 30]66 dc[<001FC000FFF0 01FFFC03E03E07800E0F00021E00003E00003C00007C0000780000780000780000F00000F00000 F00000F00000F00000F00000F00000F000007800007800007800007C00003C00003E00001E0000 0F000007800C03E03C01FFFC00FFF8001FC0>23 34 -3 1 29]67 dc[24 32 -5 0 33]68 dc[19 32 -5 0 27]69 dc[18 32 -5 0 26]70 dc[<00 1FC000FFF801FFFE03E03E07801E0F001E1E001E3E001E3C001E7C001E78001E78001E7803FEF0 03FEF003FEF00000F00000F00000F00000F00000F000007800007800007800007C00003C00003E 00001E00000F000007800E03E03E01FFFE00FFF8001FE0>23 34 -3 1 30]71 dc[4 32 -4 0 13]73 dc[<0F C07FE0FFF0E078C078003C003C003C003C003C003C003C003C003C003C003C003C003C003C003C 003C003C003C003C003C003C003C003C003C003C003C003C003C>14 33 -2 1 21]74 dc[17 32 -5 0 25]76 dc[ 29 32 -5 0 40]77 dc[21 32 -5 0 32]78 dc [<003F000000FFC00003FFF00007E1F8000F807C001F003E001E001E003C000F003C000F007800 07807800078078000780F80007C0F00003C0F00003C0F00003C0F00003C0F00003C0F00003C0F0 0003C0F00003C0F00003C07800078078000780780007803C000F003C000F001E001E001F003E00 0F807C0007E1F80003FFF00000FFC000003F0000>26 34 -3 1 33]79 dc[20 32 -5 0 29]80 dc[22 32 -5 0 29]82 dc[<03F8001FFE007FFF00FC0F80F007C0C003C00001C00001E00001E000 01E00001E00001E00003E00003C00007C0003F8001FF0007FE000FFC001FE0003F00003C00007C 00007800007800007800007800007800003C00003C00C01F03C00FFFC007FF8001FC00>19 34 -2 1 25]83 dc[<001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E00 00001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E 0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E000000 1E0000001E0000FFFFFFC0FFFFFFC0FFFFFFC0>26 32 -2 0 31]84 dc[<01F80007FE000FFF00 1F0F803C03C03C03C07801E07801E0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0 F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0 F000F0F000F0F000F0F000F0>20 33 -5 1 31]85 dc[<001F0000001F0000003F8000003B8000 003B8000007BC0000071C00000F1E00000F1E00000F0E00001E0F00001E0F00001E0700003C078 0003C0780003C0380007803C0007803C0007801C000F001E000F001E001F000F001E000F001E00 0F003C0007803C0007803C000780780003C0780003C0780003C0F00001E0F00001E0>27 32 -1 0 30]86 dc[<00F8001F0000F8001F0000F8003F0001DC003B8001DC003B8001DC003B8001DC00 738003CE0073C0038E0071C0038E0071C0078E00F1E0078F00E1E0078700E1E0070700E0E00F07 01E0F00F0781E0F00F0381C0F00E0381C0701E0383C0781E03C3C0781E01C380783C01C3803C3C 01C7803C3C01E7803C3C00E7003C7800E7001E7800E7001E7800EE001E78006E000EF0007E000F F0007E000FF0007C000F>40 32 -1 0 43]87 dc[<1F8F3FEF7FFFF83FF00FF00FF00FF80F7E0F 1FFF07FF003F000F000F000F401F701E7FFC3FF807E0>16 20 -2 0 22]97 dc[17 32 -3 0 23]98 dc[<03F00FFE1FFF3E0F3C0178007800F000 F000F000F000F000F000780078003C023E0E1FFE0FFC03F0>16 20 -2 0 20]99 dc[<07C7800F F7801FFF803E1F80780F80780780F00780F00780F00780F00780F00780F00780F00780F8078078 07807C07803E1F801FFF800FF78007C78000078000078000078000078000078000078000078000 0780000780000780000780000780>17 32 -2 0 23]100 dc[<01F80007FE001FFF003E07003C 0100780000700000F00000F00000F00000FFFF80FFFF80FFFF807003807807003C07003E1F001F FE000FFC0003F000>17 20 -1 0 20]101 dc[<0F000F000F000F000F000F000F000F000F000F 000F000F000F000F000F000F000F00FFF0FFF0FFF00F000F000F000F000F000F000F0007000780 03FE01FE007E>15 32 0 0 14]102 dc[<03FC000FFF003FFFC07E07E0F801F0F000F0F000F0F0 00F07803F03FFFE01FFFC03FFF803FFE0038000030000033E0003FF8001FFC003E3E003C1E0078 0F00780F00780F00780F00780F003C1E003E3E001FFFF00FFFF003E0F0>20 30 -1 10 23]103 dc[16 32 -3 0 23]104 dc[< F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F00000000000000000F0F0F0F0>4 32 -3 0 11] 105 dc[<3F00FF80FFC0C3C001E001E001E001E001E001E001E001E001E001E001E001E001E001 E001E001E001E001E001E001E001E001E001E001E001E000000000000000000000000000000000 01E001E001E001E0>11 41 3 9 12]106 dc[17 32 -3 0 22]107 dc[4 32 -3 0 11]108 dc[30 20 -3 0 39]109 dc[16 20 -3 0 23]110 dc[<01F80007FE001FFF803F0FC03C03C07801E07801E0F000F0F000F0F000F0F000F0F000F0F0 00F07801E07801E03C03C03F0FC01FFF8007FE0001F800>20 20 -1 0 23]111 dc[17 29 -3 9 23]112 dc[11 20 -3 0 16]114 dc[<0FC07FF0FFF8F07CC0 3C003C003C007C03F80FF81FF03FC07C00780078007800780C3FFC1FFC07F0>14 20 -1 0 17] 115 dc[<07C00FF01FF01E201E001E001E001E001E001E001E001E001E001E001E001E001E00FF F0FFF0FFF01E001E001E001E001E001E00>12 26 -1 0 16]116 dc[<3F0F7FEFFFFFF03FF01F F00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00F>16 20 -3 0 23] 117 dc[<07803E0007C03E0007C07E000EC077000EC077000EE077001EE0E7801E60E7801E60E7 801C70E3803C71E3C03C71C3C03C31C3C07839C1E0783BC1E0783B81E0781B81E0F01F80F0F01F 80F0F01F00F0>28 20 -1 0 31]119 dc[20 20 0 0 21]120 dc[<7C00007E00007F000007800003800001C00001C00001C00000E00000 E00001F00001F00003B00003B80003B800073800073C000F1C000F1C000E1E001E1E001E0F003C 0F003C0F007C0780780780780780F003C0F003C0>18 29 -1 9 21]121 dc /fg df[<6030E038 E038E038E038E038E038E038E038E038E038F078E0384010>13 14 -5 -15 24]34 dc[7 14 -8 -14 24]39 dc[<007000F001F003C007800F001E001C00 380038007000700070007000E000E000E000E000E000E000E000E0007000700070007000380038 001C001E000F00078003C001E000F00070>12 36 -7 4 24]40 dc[<6000F00078003C001E000F 000780038001C001C000E000E000E000E00070007000700070007000700070007000E000E000E0 00E001C001C0038007800F001E003C007800F0006000>12 36 -4 4 24]41 dc[<01C00001C000 01C00001C000C1C180F1C780F9CF807FFF001FFC0007F00007F0001FFC007FFF00F9CF80F1C780 C1C18001C00001C00001C00001C000>17 20 -3 -4 24]42 dc[<60F87C1E0E071F3F7F7E3E1C> 8 12 -8 6 24]44 dc[<7FFF00FFFF80FFFF807FFF00>17 4 -3 -12 24]45 dc[<3078FCFC78 30>6 6 -9 0 24]46 dc[<600000F00000F00000F800007800007C00003C00003C00003E00001E 00001F00000F00000F00000F800007800007C00003C00003C00003E00001E00001F00000F00000 F800007800007800007C00003C00003E00001E00001E00001F00000F00000F8000078000078000 0300>17 36 -3 4 24]47 dc[<01F00007FC000FFE001F1F001C07003803807803C07001C07001 C0F001E0E000E0E000E0E000E0E000E0E000E0E000E0E000E0E000E0E000E07001C07001C07803 C03803801C07001F1F000FFE0007FC0001F000>19 28 -2 0 24]48 dc[<7FFCFFFE7FFC038003 80038003800380038003800380038003800380038003800380038003804380FB80FF803F800F80 0780038003800180>15 28 -5 0 24]49 dc[<7FFFE0FFFFE07FFFE03C00E01E00E00F800007C0 0001E00000F000007800003C00001E00000F000007800003C00001C00001C00000E00000E06000 E0F000E0F000E0E001C07003C07C0F803FFF000FFE0003F000>19 28 -2 0 24]50 dc[<03F800 1FFE003FFF007C0780F003C0F001C0F000E0F000E00000E00000E00000E00001C00003C0000780 03FF0003FE0003FF00000F000003800003C00001C03001C07801C07803C07807803FFF001FFE00 07F800>19 28 -2 0 24]51 dc[<007FF000FFF8007FF000070000070000070000070000070000 0700FFFFF8FFFFF8FFFFF8F007007807003807003C07001E07000E070007070007870003870001 C70001E70000E700007700007700003F00001F00>21 28 -1 0 24]52 dc[<03F0001FFC003FFF 007C0F807003C0E001C0F000E0F000E06000E00000E00000E00001C01803C03C07803FFF003FFE 003BF8003800003800003800003800003800003800003800003800003FFF803FFF801FFF80>19 28 -2 0 24]53 dc[<01F80007FE000FFF001E07803C03C03801C07000E07000E07000E0F000E0 E000E0F000E0F001C0F803C0FE0780FFFF00E7FE00E1F8007000007000003800003801801C03C0 1E03C00F83C007FF8001FF00007E00>19 28 -2 0 24]54 dc[<03800003800003800003800003 800003800003800003C00001C00001C00001C00001C00000E00000E00000E00000700000700000 3800003800001C00001E00000E00000700E00780E003C0FFFFE0FFFFE0FFFFE0E00000>19 29 -2 0 24]55 dc[<03F8000FFE001FFF003E0F807803C07001C0E000E0E000E0E000E0E000E0F0 01E07001C03C07801F1F000FFE0007FC001FFF003C07803803807001C07001C07001C07001C038 03803E0F801FFF000FFE0003F800>19 28 -2 0 24]56 dc[<3078FCFC78300000000000000000 3078FCFC7830>6 20 -9 0 24]58 dc[<60F0783C1C0E1E3E7E7E3C180000000000000000183C 7E7E3C18>7 26 -8 6 24]59 dc[<000300000780001F80003F00007E0001FC0003F00007E000 1FC0003F00007E0000FC0000FC00007E00003F00001FC00007E00003F00001FC00007E00003F00 001F80000780000300>17 24 -3 -2 24]60 dc[<7FFFC0FFFFE0FFFFE0FFFFE0000000000000 000000000000FFFFE0FFFFE0FFFFE07FFFC0>19 12 -2 -8 24]61 dc[<600000F00000FC0000 7E00003F00001FC00007E00003F00001FC00007E00003F00001F80001F80003F00007E0001FC00 03F00007E0001FC0003F00007E0000FC0000F00000600000>17 24 -3 -2 24]62 dc[<7F07F0 FF8FF87F07F01C01C01C01C00E03800E03800FFF800FFF800FFF80070700070700070700070700 030600038E00038E00038E00038E00018C0001DC0001DC0001DC0000D80000D80000F80000F800 007000>21 28 -1 0 24]65 dc[20 28 -1 0 24]66 dc[<00F80003FE0007FF 800F07C01E01C03C00E03800E07000E07000E0700000E00000E00000E00000E00000E00000E000 00E00000E000007000007000E07000E03800E03C01E01E03E00F07E007FFE003FEE000F8E0>19 28 -2 0 24]67 dc[<7FF800FFFE007FFF001C0F801C03C01C01C01C01E01C00E01C00E01C00F0 1C00701C00701C00701C00701C00701C00701C00701C00701C00F01C00E01C00E01C01E01C03C0 1C03C01C0F807FFF00FFFE007FF800>20 28 -1 0 24]68 dc[21 28 -1 0 24 ]69 dc[19 28 -2 0 24]70 dc[<7FFF00FFFF807FFF0001C00001C00001C000 01C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C000 01C00001C00001C00001C00001C00001C0007FFF00FFFF807FFF00>17 28 -3 0 24]73 dc[<0F C0003FF0007FFC00F03C00F00E00F00E00000E00000E00000E00000E00000E00000E00000E0000 0E00000E00000E00000E00000E00000E00000E00000E00000E00000E00000E00000E0001FFC003 FFC001FFC0>18 28 -3 0 24]74 dc[<7F03F0FF87F87F03F01C01C01C03801C03801C07001C07 001C0E001C0E001E1C001F1C001FB8001FB8001DF0001DF0001CF0001C70001C38001C3C001C1E 001C0E001C07001C07801C03C07F07F0FF87F87F07F0>21 28 -1 0 24]75 dc[21 28 -1 0 24]77 dc[<7F03C0FF87C07F07C01C0DC01C0DC01C0DC01C1DC01C19C01C19C01C 39C01C39C01C39C01C31C01C71C01C71C01C61C01CE1C01CE1C01CE1C01CC1C01CC1C01DC1C01D 81C01D81C01D81C07F07F0FF0FF87E07F0>21 28 -1 0 24]78 dc[<0FF8003FFE007FFF00780F 00700700F00780E00380E00380E00380E00380E00380E00380E00380E00380E00380E00380E003 80E00380E00380E00380E00380E00380F00780700700780F007FFF003FFE000FF800>17 28 -3 0 24]79 dc[<7F00F0FF81F87F01F81C039C1C039C1C039C1C03801C03801C03801C03801C0380 1C07001C0F001FFE001FFE001FFF001C0F801C03801C03C01C01C01C01C01C01C01C03C01C0380 1C0F807FFF00FFFE007FF800>22 28 -1 0 24]82 dc[19 28 -2 0 24]83 dc [<07FF0007FF0007FF000070000070000070000070000070000070000070000070000070000070 00007000007000007000007000007000007000007000007000E07038E07038E07038E07038FFFF F8FFFFF87FFFF8>21 28 -1 0 24]84 dc[<007C0001FF0003FF800783C00F01E00E00E01C0070 1C00701C00701C00701C00701C00701C00701C00701C00701C00701C00701C00701C00701C0070 1C00701C00701C00701C00701C0070FF83FEFF83FEFF83FE>23 28 0 0 24]85 dc[<00700000 F80000F80000D80001DC0001DC0001DC00018C00038E00038E00038E00038E0007070007070007 07000707000F07800E03800E03800E03800E03801C01C01C01C01C01C01C01C0FF07F8FF07F8FF 07F8>21 28 -1 0 24]86 dc[<0E03800F07800F07800D05800D8D801D8DC01D8DC01D8DC01D8D C0198CC019DCC019DCC019DCC039DCE039DCE038F8E038F8E03800E03800E03800E03800E03800 E0700070700070700070FE03F8FE03F8FE03F8>21 28 -1 0 24]87 dc[<7F07F0FF8FF87F07F0 1E03C00E03800E0780070700070F00038E00039E0001DC0001F80000F80000F00000700000F000 00F00001F80001F80003DC00039C00078E00070E000F07000E07007F8FE07F9FE07F8FE0>21 28 -1 0 24]88 dc[<01FC0003FE0001FC0000700000700000700000700000700000700000700000 700000700000F80000F80001DC0001DC0001DC00038E00038E000707000707000F07800E03801E 03C01C01C0FF07F8FF07F8FF07F8>21 28 -1 0 24]89 dc[13 36 -9 4 24]91 dc[13 36 -1 4 24]93 dc[<7FFF00FF FF80FFFF807FFF00>17 4 -3 4 24]95 dc[<387C7CFCF8E0E0E07070383E1E06>7 14 -8 -17 24]96 dc[<07E1F01FFBF03FFFF0781F00F00F00E00700E00700E007007807007F07001FFF0007 FF0000FF00000700000700300E00781E007FFC003FF8001FE000>20 20 -3 0 24]97 dc[<063E 000EFF800FFFC00FC1E00F80E00F00700F00700E00380E00380E00380E00380E00380E00380E00 700F00700F80E00FC1E00FFFC00EFF800E3E000E00000E00000E00000E00000E00007E0000FE00 007E0000>21 28 0 0 24]98 dc[<01FC0007FF001FFF803E03C03801C07001C0700000E00000 E00000E00000E00000E00000E000007000007000003803003E07801FFF8007FF0001FE00>18 20 -3 0 24]99 dc[<03E3F00FFBF81FFFF03C1F80380F80700780700780E00380E00380E00380E0 0380E00380E00380700380700780380F803C1F801FFF800FFB8003E38000038000038000038000 0380000380001F80003F80001F80>21 28 -2 0 24]100 dc[<01FC0007FF001FFF803E03C038 01C07001C0700000E00000FFFFC0FFFFC0FFFFC0E001C0E001C07003807003803807803E0F001F FE0007FC0001F000>18 20 -3 0 24]101 dc[<7FFF007FFF007FFF0001C00001C00001C00001 C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C000FFFFC0FFFFC07F FFC001C00001C00001C00001C0C000E1E000FFE0007FC0001F80>19 28 -1 0 24]102 dc[<01 FC000FFF801FFFC07E03F07800F0E00038E00038E00038E000387000707801F03FFFE01FFFC01F FE001C000038000039E0001FF8001FFC001E1E001C0E003807003807003807003807003807001C 0E001E1E300FFFF807FFF801E1F0>21 31 -1 11 24]103 dc[<7FC3FCFFE7FE7FC3FC0E00E00E 00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00F00E00F80E00FC1C00F FFC00EFF800E3E000E00000E00000E00000E00000E00007E0000FE00007E0000>23 28 0 0 24] 104 dc[17 29 -4 0 24]105 dc[<3F807FE0FFF0F0786038001C001C 001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C00 1C0FFC1FFC0FFC00000000000000000038007C007C007C0038>14 39 -2 10 24]106 dc[21 28 -1 0 24]107 dc[<7FFFC0FFFFE07FFFC000E00000E00000E00000E00000E0 0000E00000E00000E00000E00000E00000E00000E00000E00000E00000E00000E00000E00000E0 0000E00000E00000E00000E0007FE000FFE0007FE000>19 28 -2 0 24]108 dc[<7F1F1F00FF BFBF807F1F1F001C1C1C001C1C1C001C1C1C001C1C1C001C1C1C001C1C1C001C1C1C001C1C1C00 1C1C1C001C1C1C001C1C1C001E1E1C001E1E1C001F1F1C007FFFF800FFFBF8007CE0E000>25 20 1 0 24]109 dc[<7FC3FCFFE7FE7FC3FC0E00E00E00E00E00E00E00E00E00E00E00E00E00E00E 00E00E00E00E00E00E00E00F00E00F80E00FC1C07FFFC0FEFF807E3E00>23 20 0 0 24]110 dc [<01F0000FFE001FFF003E0F803C07807803C07001C0F001E0E000E0E000E0E000E0E000E0E000 E07001C07001C03803803E0F801FFF000FFE0001F000>19 20 -2 0 24]111 dc[<7FC000FFE0 007FC0000E00000E00000E00000E00000E00000E00000E00000E3E000EFF800FFFC00FC1E00F80 E00F00700F00700E00380E00380E00380E00380E00380E00380E00700F00700F80E00FC1E07FFF C0FEFF807E3E00>21 30 0 10 24]112 dc[<7FFE00FFFF007FFE000380000380000380000380 0003800003800003800003800003800003C00003C00003E00003F03003F8787FBFF8FF9FF07F87 E0>21 20 -1 0 24]114 dc[17 20 -3 0 24]115 dc[<003E0000FF8001FFC001C1C00380E00380E00380E00380400380000380000380 00038000038000038000038000038000038000FFFFC0FFFFC07FFFC00380000380000380000380 00018000>19 25 -1 0 24]116 dc[<01FCFC03FFFE07FFFC0F03E00E01E00E00E00E00E00E00 E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E00E07E07E0FE0FE07E07E0>23 20 0 0 24]117 dc[<00700000F80000F80001DC0001DC0001DC00038E00038E00038E00038E00 0707000707000707000E03800E03800E03801E03C07F8FF0FF8FF87F8FF0>21 20 -1 0 24] 118 dc[<0707000F8F800F8F800D8D800DDD800DDD800DDD801CD9C01CD9C01CF9C01CF9C01C71 C01C01C01C01C03800E03800E03800E0FF8FF8FF8FF8FF8FF8>21 20 -1 0 24]119 dc[<7F8F F0FF8FF87F8FF00F0780070700038E00039E0001DC0000F80000F00000700000F80001F80001DC 00039E00078E000707007F8FF07F9FF07F8FF0>21 20 -1 0 24]120 dc[<1E00003F00007F80 007BC00079E00000E00000F00000700000700000700000780000780000780000DC0000CC0000CC 0001CE0001CE00038E000386000387000707000707000703800E03800E03800E01C07F8FF0FF8F F87F8FF0>21 30 -1 10 24]121 dc[20 20 -1 0 24]122 dc[<0007E0001FE0007FE000780000E00000E00000E00000E00000E00000E0 0000E00000E00000E00000E00000E00001E0007FC000FF8000FF80007FC00001E00000E00000E0 0000E00000E00000E00000E00000E00000E00000E00000E00000E000007800007FE0001FE00007 E0>19 36 -2 4 24]123 dc[<7C0000FF0000FFC00003C00000E00000E00000E00000E00000E0 0000E00000E00000E00000E00000E00000E00000F000007FC0003FE0003FE0007FC000F00000E0 0000E00000E00000E00000E00000E00000E00000E00000E00000E00000E00003C000FFC000FF00 007C0000>19 36 -2 4 24]125 dc /fh df[<03F800FE000FFF07FF803F07DF81C07E00FE00E0 7E00FC0060FC01FC0000FC03FE0000FC07E60000FC0FC300007C0F8180003C1F80C0001E3F0060 000E7E006000077C00300001FC00180000F800180000F8000C0001F0000E0001F8007FE001FC00 7FE003E600000003E300000003E180000003E0C0000003E060000003E060000003E060000001E0 60000000E060000000F0C00000003F800000001F000000>35 32 -2 0 41]38 dc[13 45 -3 11 20]41 dc[<2070180C0E060603033B7FFFFFFE7C38>8 16 -4 9 15]44 dc[12 4 -1 -8 17]45 dc[<387CFEFEFE7C38>7 7 -4 0 15] 46 dc[<01FC0007FF001F8FC01E03C03E03E07C01F07C01F07C01F0FC01F8FC01F8FC01F8FC01 F8FC01F8FC01F8FC01F8FC01F8FC01F8FC01F8FC01F8FC01F8FC01F87C01F07C01F07C01F03E03 E01E03C01F07C007FF0001FC00>21 29 -2 0 26]48 dc[17 29 -4 0 26]49 dc[19 29 -3 0 26]50 dc[<03FC001FFF803C0FC07807E0FC03 F0FE03F0FE03F8FE03F87C03F83803F80003F80003F00003E00007C0000F8001FC0001FC00001F 00000F80000FC01E0FC03F07E03F07E03F07E03F07E01E0FC00E0F8007FF0001FC00>21 29 -2 0 26]51 dc[<00FFFE00FFFE0007C00007C00007C00007C00007C00007C0FFFFFEFFFFFEE003C0 7003C03803C01803C00C03C00E03C00703C00383C00183C000C3C00063C00073C0003BC0001FC0 000FC00007C00007C00003C00001C0>23 29 -1 0 26]52 dc[<07F0001FFC00381F00600F8078 0FC0FC07C0FC07E0FC07E0FC07E07807E00007E00007E00007C01007C0380F803C1F0037FE0033 F8003000003000003000003000003F80003FF0003FFC003FFE003FFF003FFF80380380>19 29 -3 0 26]53 dc[<01FE0007FF800F07C01E03E03E01F03C01F07C01F87C01F87C01F8FC01F8FC 01F8FC01F8FC01F8FE01F0FE01F0FD03E0FDFFC0FCFF00FC10007C00007C01E07C03F03E03F01E 03F01F03F00F81E007E0E001FFC0003F00>21 29 -2 0 26]54 dc[<00C00001E00003F00003F0 0003F00003F00003F00003F00001F00001F00001F00001F00000F00000F0000070000078000038 00003800001800000C00C00600C00300C00300E001807FFFC07FFFE07FFFF07FFFF87FFFF86000 00>21 30 -3 0 26]55 dc[<03FC000FFF803E03C07C00E0780070F00070F00078F00078F000F8 F001F87803F8780FF03C3FF01FFFE007FFC007FF800FFE001FFF001FE3803FC3C03F01E03E01E0 3C01E03C01E01C01E01E03C00F078007FF0001FC00>21 29 -2 0 26]56 dc[<07F0001FFC0038 1F003C07807E07C07E03E07E03E07E01F03C01F00001F00041F807F9F81FFDF83E05F87C03F87C 03F8FC01F8FC01F8FC01F8FC01F8FC01F0FC01F0FC01F07C01E07C03E03E03C01F07800FFF0001 FC00>21 29 -2 0 26]57 dc[<387CFEFEFE7C38000000000000387CFEFEFE7C38>7 20 -4 0 15]58 dc[35 31 -2 0 40]65 dc[31 31 -2 0 37]66 dc[<0007FC00003F FF8000FE01C003F0007007E000380FC000181F80000C3F00000C3F0000067F0000067E0000067E 000000FE000000FE000000FE000000FE000000FE000000FE000000FE0000007E0000067E000006 7F0000063F00000E3F00000E1F80001E0FC0001E07E0003E03F000FE00FE03DE003FFF0E0007FC 02>31 31 -3 0 38]67 dc[34 31 -2 0 40]68 dc[30 31 -2 0 34]69 dc [28 31 -2 0 33]70 dc[<0007FC0600003FFF8E0000FE01FE0003F000FE00 07E0007E000FC0007E001F80007E003F00007E003F00007E007F00007E007E00007E007E00007E 00FE003FFFE0FE003FFFE0FE00000000FE00000000FE00000000FE00000000FE000000007E0000 06007E000006007F000006003F00000E003F00000E001F80001E000FC0001E0007E0003E0003F0 00FE0000FE03DE00003FFF0E000007FC0200>35 31 -3 0 41]71 dc[36 31 -2 0 41]72 dc[< FFFFFFFF07E007E007E007E007E007E007E007E007E007E007E007E007E007E007E007E007E007 E007E007E007E007E007E007E007E007E007E0FFFFFFFF>16 31 -2 0 20]73 dc[<0FF0003FFE 00783F00FC1F80FE0F80FE0FC0FE0FC07C0FC0100FC0000FC0000FC0000FC0000FC0000FC0000F C0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000F C0000FC003FFFC03FFFC>22 31 -1 0 27]74 dc[36 31 -2 0 41]75 dc[ 26 31 -2 0 31]76 dc[45 31 -2 0 50]77 dc[36 31 -2 0 41]78 dc[<001FF80000FFFF0001F81F8007E007E0 0FC003F01F8001F83F8001FC3F0000FC7F0000FE7F0000FE7E00007EFE00007FFE00007FFE0000 7FFE00007FFE00007FFE00007FFE00007FFE00007FFE00007F7E00007E7E00007E7F0000FE3F00 00FC1F0000F81F8001F80FC003F007E007E001F81F8000FFFF00001FF800>32 31 -3 0 39]79 dc[30 31 -2 0 36]80 dc[36 31 -2 0 39]82 dc[<81FF00E7FFC0FE01E0 F80070E00078E00038C0003CC0003CC0003C00003C00007C0000FC0007F800FFF807FFF00FFFF0 1FFFE03FFF807FFE007FC000FC0000F80000F00018F00018F000387000387000783800F81E03F8 0FFF3803FC08>22 31 -3 0 29]83 dc[<03FFFFC003FFFFC00007E0000007E0000007E0000007 E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E00000 07E0000007E0000007E0000007E000C007E006C007E006C007E006C007E006E007E00E6007E00C 6007E00C7007E01C7C07E07C7FFFFFFC7FFFFFFC>31 30 -2 0 36]84 dc[<0000700000000070 00000000F800000000F800000001FC00000001FC00000003FE00000003F600000003F600000007 E300000007E30000000FE18000000FC18000001FC1C000001F80C000003F80E000003F00600000 3F006000007E003000007E00300000FC00180000FC00180001FC000C0001F8000C0003F8000E00 03F000060007F000070007E000030007E0000380FFFE003FF8FFFE003FF8>37 31 -1 0 40]86 dc[<0FE07E3FF8FE7E0DE0FC05E0F803E0F803E0F803E07C03E03C03E01F03E007FBE0007FE000 03E00C03E03F03E03F03E03F07C03F0F801FFF0007FC00>23 20 -1 0 25]97 dc[<181F801C7F E01EC1F81F807C1F007C1F003E1F003E1F003F1F003F1F003F1F003F1F003F1F003F1F003E1F00 3E1F007E1F807C1FE0F81F7FF01F1FC01F00001F00001F00001F00001F00001F00001F00001F00 001F00001F0000FF0000FF0000>24 32 -2 0 29]98 dc[<01FC0007FF001F81C03F00C03E0060 7E00007C0000FC0000FC0000FC0000FC0000FC0000FC00007C03007C0FC03E0FC03E0FC01F0FC0 07FF8001FE00>19 20 -2 0 23]99 dc[<03F8FF0FFEFF1F07F83E01F87E00F87C00F87C00F8FC 00F8FC00F8FC00F8FC00F8FC00F8FC00F87C00F87C00F87E00F83E01F81F83F80FFEF801F8F800 00F80000F80000F80000F80000F80000F80000F80000F80000F80000F80007F80007F8>24 32 -2 0 29]100 dc[<00FF8007FFE00F80701E00183E00187C00007C0000FC0000FC0000FC0000FF FFF8FFFFF8FC00F87C00F87C00F03E00F01E01E00F83C007FF8001FE00>21 20 -1 0 24]101 dc[<3FFC003FFC0007C00007C00007C00007C00007C00007C00007C00007C00007C00007C00007 C00007C00007C00007C00007C00007C000FFFC00FFFC0007C00007C00007C00007C00007C00007 C3C007C7E003C7E003E7E001F3E000FFC0001F80>19 32 -1 0 16]102 dc[<01FF000FFFE03F 01F878003C78003CF0001EF0001EF0001E70003E3C007C1FFFFC07FFF80FFFF01FFF801C000018 000018000009FC000FFF000F07801E03C03E03E03E03E03E03E03E03E03E03E01E03DE0F079E07 FFFE01FC3C>23 30 -1 10 26]103 dc[24 32 -3 0 29]104 dc[11 33 -2 0 14]105 dc[24 32 -2 0 28]107 dc[11 32 -2 0 14]108 dc[39 20 -3 0 44]109 dc[24 20 -3 0 29]110 dc[<01FF0007FFC01F83F03E00F83E00 F87C007C7C007CFC007EFC007EFC007EFC007EFC007EFC007E7C007C7C007C3E00F83E00F81F83 F007FFC001FF00>23 20 -1 0 26]111 dc[24 29 -2 9 29]112 dc[ 18 20 -2 0 22]114 dc[16 20 -2 0 21]115 dc[<01F003F807CC0F860F860F860F860F860F800F800F800F800F800F800F800F 800F800F80FFFCFFFC3F800F800780038003800380018001800180>15 29 -1 0 20]116 dc[< 03F8FF07FCFF0F06F81F01F81F01F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F8 1F00F81F00F81F00F81F00F81F00F8FF07F8FF07F8>24 20 -3 0 29]117 dc[<001C0000001C 0000003E0000003E0000007F0000007F000000FF800000F9800001F9C00001F0C00001F0C00003 E0600003E0600007C0300007C030000F8018000F8018001F001C00FFE07F80FFE07F80>25 20 -1 0 28]118 dc[<0030018000007803C000007803C000007803C00000FC07E00000FC07E00001 F60FB00001F60F300001F60F300003E31E180003E31E180007C1BE0C0007C1BC0C0007C1BC0C00 0F80F806000F80F806001F00F803001F00F00300FFE7FE1FE0FFE7FE1FE0>35 20 -1 0 38] 119 dc[25 20 -1 0 28]120 dc[<1E0000007F800000E1C00000C0E00000FC600000FC 300000783000000018000000180000001C0000001C0000003E0000003E0000007F0000007F0000 00FF800000F9800001F9C00001F0C00001F0C00003E0600003E0600007C0300007C030000F8018 000F8018001F001C00FFE07F80FFE07F80>25 29 -1 9 28]121 dc[19 20 -1 0 23]122 dc[25 2 0 -11 26] 123 dc /fi df[<3C07C00000620C600000F31E100000798F18000031860C000001C00E000001 C00E000000C006000000E007000000E007000000E007000000E007000000600380000070038000 007003800000700380000070038000007001C000003801C000003801C000003801C000003801C0 00003800E000001C00E000001C00E000001C00E000001C00E000001C00700000FFFFFF80000E00 7000000E007000000E007000000E00380000070038000007003800000700380000030318600003 879CF00001878CF00000C3867000003F03E0>36 41 2 9 28]11 dc[<3C00000062000000F300 0000798000003180000001C0000001C0000000C0000000E0000000E0038000E0064000E00E2000 700E2000700E2000700E2000700710007007000038070000380700003803800038038000380380 001C0380001C01C0001C01C0001C01C0001C01C0000E00E000FFFFE0000E0000000E0000000E00 00000700000007000000070000000700300003007800038078000180380000E01000003FE0>29 41 2 9 26]12 dc[<3C00000062000000F3000000798000003180000001C0000001C0000000C0 000000E0000000E001C000E0032000E00710007007100070071000700710007003880070038000 38038000380380003801C0003801C0003801C0001C01C0001C00E0001C00E0001C00E0001C00E0 001E007000FFFFF0000E0070000E0070000E0038000E003800070038000700380007001C000300 DC000381FC000181FC0000E0EE00003FCE>31 41 2 9 27]13 dc[16 14 -7 -18 23]34 dc[<00FF00000780E0000E00 180018000400380003007000010070000080F0000040F0000040F0000020F00000207800001078 0030107800781038007C103CF058101D0840100F044010060420200704102007C40C4006780280 060001800700004007000020070180100303C0080381E0080180E00401C0201C00C0203C006040 1E0030800C000F0000>31 34 -5 1 35]38 dc[8 14 -9 -18 14]39 dc[<0800100010002000600060004000C000C000C000C000C000C000C000C000C000 C000C000C000C000E000E000600060007000700030003800380018001C000C000E000600070003 000180018000C00060002000100008000400020001>16 46 -7 12 19]40 dc[<800000600000 3000001800000C000006000003000001000001800000C00000E000006000007000003000003800 001800001C00000C00000C00000E00000600000600000700000700000300000300000300000380 000380000380000180000180000180000180000180000180000180000100000300000300000300 000200000600000400000800001000>17 46 0 12 19]41 dc[<00200000003000000030000000 3000000030000000180000001800000018000000180000000C0000000C0000000C0000000C0000 FFFFFFE0FFFFFFE000060000000600000003000000030000000300000003000000018000000180 0000018000000180000000C0000000C0000000C000>27 28 -6 3 35]43 dc[<80402020100808 04043C3C3C3C1C>6 14 -3 9 14]44 dc[<7FE0FFE07FF0>12 3 -3 -8 16]45 dc[5 5 -5 0 14]46 dc[<80000000C0000000C000000060000000300000003000000018000000 180000000C0000000C000000060000000300000003000000018000000180000000C0000000C000 000060000000300000003000000018000000180000000C0000000C000000060000000300000003 000000018000000180000000C0000000C000000060000000300000003000000018000000180000 000C00000006000000060000000300000003000000018000000180000000C000000040>26 45 -1 11 23]47 dc[<0FC000187000303800701C00700E00700700F00700F00780F00380F003C070 03C07801C07801E07801E07801E03C00F03C00F03C00F03C00F01E00701E00780E00780F00780F 007807003803803803803001C07000E0700030E0000F80>21 31 -4 1 23]48 dc[15 30 -5 0 23]49 dc[<80780080FC0041FE0047FF00 7E0300200180100080100040080040040000030000008000006000001800000C00000700000380 0703C00881E00840E00820F00820F00820F00410700420700220700200700100E00080E0006180 001F00>20 31 -4 1 23]50 dc[<1F800020E000403800401C00401E00800F00F00F0078078078 0780300780000780000780000780000700000600001C0000FE000003000001C00000E003806004 60700420700410380420380420380200380100300080700060E0001F80>21 31 -4 1 23]51 dc [<006000007000007000003800003800003800003800001C00001C00801FC0607C003F8E00080E 00040E00060E0003070001070000870000C700006300003000003000001800001800000C00000E 000006000007000007000003000003800003800001C00001C00001C00000E00000E00000E00000 60>19 39 -2 9 23]52 dc[<0F800010C000307000703800601C00701C00F01E00F00E00F00F00 700F00700F007807807807807807807C07803C07003E07003E06001D84001E78001E00000E0000 0F00000700000380C00181E000C1E00060E0003020001C200007C0>19 31 -5 1 23]54 dc[<03 000007800007800007C00003C00003C00003C00001E00001E00001E00000F00000F00000700000 7000003800003800001C00001C00000C00000E00000600800300400300600100200080380E803E 19C01FF06017F0200BF01008E010>20 31 -7 1 23]55 dc[<1F8000306000403000C00800C00C 00800600800600C00300C00300C00300600700200700300F00183F00047E0003FC0001F80003F8 0007E40007C3000F81800F00800E00C00600600600600600600300600100600080C0006180001F 00>19 31 -5 1 23]56 dc[<3E000043800080C000E06000F07000F03800601C00001C00000E00 000E00000F0003C7000637800C0F801C0F801C07C01C03C01C03C01C03C01E01C01E01E01E01E0 1E01E00F01E00F00E00700E00380E00180C000C0C0007180001F00>19 31 -5 1 23]57 dc[8 20 -5 0 14]58 dc[<800040002000200010 0008000800040004003C003C003C003C001C000000000000000000000000000000000000000000 038007C007C003C001C0>10 29 -3 9 14]59 dc[<7FFFFFE0FFFFFFF000000000000000000000 000000000000000000000000000000000000000000003FFFFFFC1FFFFFF8>30 12 -5 -5 35] 61 dc[29 32 -2 0 34]65 dc[30 31 -3 0 32]66 dc[<00FE00000381C000060020000C001800180004003800020038000100700001007000 008070000080F0000080F0000000F0000000F0000000F000000078000000780000007800000078 0000003C0000003C0000001E0000101E0000100F000018070000180380001801C0001800C0001C 0060003C0038003C001C004C000781860000FE02>31 33 -6 1 33]67 dc[ 31 31 -3 0 34]68 dc[31 31 -3 0 31]69 dc[30 31 -3 0 30]70 dc[<00FC0000038304000E00CC001C002E0018003E0038001E0070001E0070000F 0070000F0070000F00F0000F00F0000780F0000780F000FFF0F000000078000000780000007800 0000780000003C0000003C0000001E0000201E0000200E00003007000030038000300380003001 C0003800E0007800300078001C00980007030C0000FC04>30 33 -6 1 35]71 dc[35 31 -3 0 34]72 dc[20 31 -3 0 18]73 dc[<1F000021C00040E0 00807000F07800F83C00F83C00781E00301E00001E00001E00000F00000F00000F00000F000007 800007800007800007800003C00003C00003C00003C00001E00001E00001E00001E00000F00000 F00000F00000F8001FFF>24 32 -3 1 24]74 dc[35 31 -3 0 35]75 dc[ 25 31 -3 0 29]76 dc[42 31 -3 0 41]77 dc[35 31 -3 0 34]78 dc[<01FC0000078380000E00E0001C007000 38003C0038001E0078000F007000070070000380F00003C0F00001C0F00001E0F00000E0F00000 F0F00000F0780000787800007878000078780000783C0000383C0000381C0000381E0000380E00 003807000038078000380380007001C0007000E00060003000E0001C01C0000707000001FC00> 29 33 -6 1 35]79 dc[30 31 -3 0 31]80 dc[<000007C0FFF00C200F80 1C1007803C1007803C0807803C0807803C0003C01E0003C01E0003C01E0003C01E0001E00F0001 E00E0001E01E0001E01C0000F0380000FFF00000F01E0000F00700007801C0007801E0007800F0 007800F0003C0078003C0078003C0078003C0078001E0078001E0070001E00E0001E03C001FFFF 00>29 32 -3 1 33]82 dc[<81F80000C6060000E80380007000C0006000E00060006000600070 00200030002000380020003800000038000000380000007800000078000001F800001FF000007F F00001FFE00001FF800003F8000003C0000003C000000380000003800100038001000380010001 80010001C0018000C003800060038000300580001C18C00007E040>26 33 -3 1 26]83 dc[28 31 -8 0 33]84 dc[<07E000000C1800003804000030020000700100007000 8000F0004000F0004000F0002000F0002000F0002000780010007800100078001000780010003C 0008003C0008003C0008003C0008001E0004001E0004001E0004001E0004000F0002000F000200 0F0002000F00020007800100078001000780010007C003C07FFC1FF8>29 32 -9 1 34]85 dc[< 01000000018000000380000003C0000003C0000003E0000003D0000003D0000003C8000003C800 0003C4000003C2000007C200000781000007810000078080000780400007804000078020000780 200007801000078008000F8008000F0004000F0004000F0002000F0001000F0001000F0000800F 0000C00F8000E0FFF007FC>30 32 -9 1 34]86 dc[<04000800000006000800000006000C0000 0007001E00000007001E00000007801F00000007801F0000000FC01E8000000F601E8000000F20 1E4000000F101E4000000F101E2000000F081E2000000F081E1000000F041E0800000F041E0800 000F021E0400000F021E0400000F011E0200000F009E0200000F009E0100000F005E0100000F00 5E0080000F003E00C0000F003E0040000F003C0020000F003C0020000F003C0010000F003C0010 001F003C0018001F003E001C00FFF1FFC0FF80>41 32 -9 1 45]87 dc[35 31 -2 0 34]88 dc [<3FFC000003C0000001E0000001E0000001E0000001E0000000E0000000F0000000F0000000F0 0000007000000078000000780000007C000000FE000000FA000000F1000001F0800001F0400001 E0400003E0200003E0100003C0080003C00C0007C0040007800200078001000F8000800F0000C0 1F8000E0FFF003FC>30 31 -9 0 34]89 dc[<7070F8F8F8F8F8F8B0B080808080404040402020 1010080804040202>15 14 -12 -18 23]92 dc[<70F8F8F8B0808040402010080402>7 14 -9 -18 14]96 dc[<0F0700308C80705C40703C40F01C40F01C40F00E20F00E00F00E00F00E007807 007807007807003807003C03801C03800E03800707800389C000F180>19 20 -4 0 23]97 dc[< 1F0031C060E06070E038E03CE01CE01EE01EE01E700F700F700F700F380F380F3C0E3A0E1D0C1C F01C001C000E000E000E000E0007000700070007003F800780>16 32 -5 0 21]98 dc[<07C000 183800300400700200700100F00000F00000F00000F00000F000007800007800007800003C0200 1C07001E07800E078003008001C100007E00>17 20 -4 0 21]99 dc[<0F0700308C80705C4070 3C40F01C40F01C40F00E20F00E00F00E00F00E007807007807007807003807003C03801C03800E 03800707800389C000F1C00001C00001C00000E00000E00000E00000E000007000007000007000 00700003F8000078>21 32 -4 0 23]100 dc[<07C018383804700270017000F000F000F000F0 007C007BF0780C38023C011C010E01070101C2007C>16 20 -4 0 21]101 dc[<3C0000660000 F300007B000031800001800001C00001C00000C00000E00000E00000E00000E000007000007000 007000007000007000007000003800003800003800003800003800001C00001C00001C00001C00 01FFE0000E00000E00000E00000E00000E0000070000070000071800033C00033C00019C000078 >22 41 2 9 14]102 dc[<3F800060E000F07000783800301C00001C00001C00000E00000E0003 CE000C2E001C17001C0F003C07003C07003C03803C03803C03803C03801E01C01E01C01E01C00E 01C00F00E00700E00380E001C1E000E270003C60>20 29 -2 9 21]103 dc[<600700E00CC070 0C40701C20700C20700E20380E103807003807003807001C03801C03801C03801C03800E01C00E 01C00F01C00E8180076300071E0007000007000003800003800003800003800001C00001C00001 C00001C0000FE00001E000>20 32 -3 0 23]104 dc[<1C003300310070803080388038401C00 1C001C000E000E000E008700470043004380230033000E00000000000000000000000000000001 C001E001E000C0>11 31 -4 0 14]105 dc[<3C0000630000F1800079C00030E00000E00000E0 00007000007000007000007000003800003800003800003800001C00001C00001C00001C00000E 00000E00000E00020E00010700010700008700008700004600003C000000000000000000000000 000000000000000000000003800003C00003C0000180>18 40 2 9 14]106 dc[<601E00E03100 70310070708070708070708038384038700038700038E0001FC0001E00001D00001C80000E40C0 0E21E00E11E00E08E00704200703C007000007000003800003800003800003800001C00001C000 01C00001C0000FE00001E000>19 32 -3 0 21]107 dc[<38006400E200E200E200E200710070 007000700038003800380038001C001C001C001C000E000E000E000E0007000700070007000380 0380038003801FC003C0>10 32 -4 0 12]108 dc[<3003003800700700660038038062003803 80E100380380610038038071001C01C070801C01C038001C01C038001C01C038000E00E01C000E 00E01C000E00E01C008E00E01C004700700E004700700E004780680E004740640C002630C31800 1C0F80F000>33 20 -4 0 37]109 dc[<3001C07003303803103807083803083803881C03841C 01C01C01C01C01C00E00E00E00E00E00E08E00E04700704700704780604740602630C01C0F80> 22 20 -4 0 26]110 dc[<07C000187000301800700E00700F00F00700F00780F003C0F003C0F0 03C07801E07801E07801E03C01E01C01E01E01C00E01C003018001C300007C00>19 20 -4 0 23 ]111 dc[23 29 0 9 23]112 dc[<0FFE0000E00000E0000070000070 000070000070000038000038000F380030B800705C00703C00F01C00F01C00F00E00F00E00F00E 00F00E007807007807007807003807003C03801C03800E03800705800388C000F040>18 29 -4 9 21]113 dc[<3000007000003800003800003800003800001C00001C00001C00001C00000E00 000E00000E00008E00004703004707804787804783802661001C1E00>17 20 -4 0 19]114 dc[ <1F8020604010E008F00CF00C700E000E003E03FC07F80FF00F800C000C060C070C0306010302 00FC>16 20 -3 0 19]115 dc[<1E003100708070807040704038203800380038001C001C001C 001C000E000E000E000E000700FFF007000700038003800380038001C00180>12 28 -4 0 15] 116 dc[<07C3800C26401C1E20180E20180E201C0E201C07101C07001C07001C07000E03800E03 800E03808703804701C04301C04381C02301C03300E00E00C0>20 20 -4 0 24]117 dc[<03C0 000E30001C08001C04001C04001C02001C02001C01001C01001C01000E00800E00800E00808700 804700C04301C04383C02307C03307800E0380>18 20 -4 0 21]118 dc[<03E1F0000E130800 0C0F04001C0F02001C0602001C0701001C0701001C0700801C0700801C0700800E0380400E0380 400E038040870380404701C0604301C0E04381C1E02301C3E03300E3C00E00C1C0>27 20 -4 0 30]119 dc[<78780084C600E58100F38100F3808063808001C04001C00001C00001C00000E000 00E00000E00040E0002070C02071E01071E01068E00CC440038380>19 20 -3 0 21]120 dc[< 3E0000438000C0C000E06000F07000F03800003800001C00001C0007DC000C3C001C1E00180E00 180E001C0E001C07001C07001C07001C07000E03800E03800E03808703804701C04301C04381C0 2301C03300E00E00C0>19 29 -4 9 22]121 dc[<80E00041F80063FC003E0C00100200080200 0401000200000100000080000040000020000010000008000004000802000C1F0007F18003E080 01C040>18 20 -3 0 19]122 dc /fj df[26 2 -4 -10 35]0 dc[<03C0 0FF01FF83FFC7FFE7FFEFFFFFFFFFFFFFFFFFFFFFFFF7FFE7FFE3FFC1FF80FF003C0>16 18 -3 -2 23]15 dc[28 20 -3 -1 35]17 dc[26 36 -4 7 35]21 dc[<80003E0080007F808000FFC08001C1E0C00780 60C00F0030601E0030783800103FF000101FE0001007C00010>28 11 -3 -6 35]24 dc[<003F FFC000FFFFC003C00000070000000C0000001800000030000000300000006000000060000000C0 000000C0000000C0000000C0000000C0000000C0000000C0000000C00000006000000060000000 3000000030000000180000000C0000000700000003C0000000FFFFC0003FFFC0>26 28 -4 3 35 ]26 dc[<00000200000000030000000003000000000180000000018000000000C0000000006000 7FFFFFF000FFFFFFF8000000000C00000000070000000003C000000000F0000000007C00000001 F000000003800000000E00FFFFFFFC007FFFFFF0000000006000000000C000000000C000000001 8000000003000000000300000000020000>38 26 -3 2 45]41 dc[<003FF800FFF803C0000700 000C0000180000300000300000600000600000C00000C00000C00000FFFFF8FFFFF8C00000C000 00C000006000006000003000003000001800000C000007000003C00000FFF8003FF8>21 28 -4 3 30]50 dc[<400000C000006000006000003000003000001800001800000C00000C0000060000 06000006000003000003000001800001800000C00000C000006000006000003000003000001800 001800000C00000C000006000006000003000003000001800001800001800000C00000C0000060 00006000003000003000001800001800000C00000C>22 44 -6 11 0]54 dc[<00180000180000 3C00003C00003C0000660000660000660000C30000C30000C3000181800181800181800300C003 00C00600600600600600600C00300FFFF00FFFF018001818001818001830000C30000C30000C60 0006600006600006C00003400001>24 33 0 1 25]56 dc[18 32 -3 0 25]57 dc[<1800001800001800000FF0000E18000C0C001C0600360300 360300760380730380630180630180E301C0E181C0E181C0E181C0E181C0E0C1C0E0C1C0E0C1C0 E061C0E061C0E061C0E061C0E031C0E031C0603180603180601980701B80301B00300F00180E00 0C0C00061C0003F600000600000200>18 39 -2 4 23]59 dc[<00FE0003FF800F01E01C007030 001860000C60000CC00006C00006C00006C00006C00006C00006C00006C00006C00006C00006C0 0006C00006C00006C00006C00006C00006C00006C00006C00006C00006400002>23 28 -3 1 30 ]91 dc[<400002C00006C00006C00006C00006C00006C00006C00006C00006C00006C00006C000 06C00006C00006C00006C00006C00006C00006C00006C00006C0000660000C60000C3000181C00 700F01E003FF8000FE00>23 28 -3 1 30]92 dc[23 28 -3 1 30]94 dc[<00 1000003800003800006C00006C00006C0000C60000C60001830001830001830003018003018006 00C00600C00600C00C00600C006018003018003018003030001830001860000C60000C60000CC0 0006C00002>23 28 -3 1 30]95 dc[<000F0038006000E001C001C001C001C001C001C001C001 C001C001C001C001C001C001C001C0038007001E00F8001E000700038001C001C001C001C001C0 01C001C001C001C001C001C001C001C001C001C000E000600038000F>16 45 -3 11 23]102 dc [16 45 -3 11 23]103 dc[2 45 -5 11 13] 106 dc /fk df[<70F8F8F870>5 5 -4 0 13]58 dc[<000001C00000078000001E0000007800 0001E00000078000000E00000038000000F0000003C000000F0000003C000000F0000000F00000 003C0000000F00000003C0000000F0000000380000000E0000000780000001E000000078000000 1E0000000780000001C0>26 26 -4 2 35]60 dc[26 26 -4 2 35]62 dc[30 32 -2 0 34]65 dc[<00FE00000381C000060020000C001800180004003800020038000100700001007000008070 000080F0000080F0000000F0000000F0000000F000000078000000780000007800000078000000 3C0000003C0000001E0000101E0000100F000018070000180380001801C0001800C0001C006000 3C0038003C001C004C000781860000FE02>31 33 -2 1 33]67 dc[33 31 -2 0 38]68 dc[32 31 -2 0 29]70 dc[44 31 -2 0 44]77 dc[<01FC0000078380000E00E0001C00700038003C00 38001E0078000F007000070070000380F00003C0F00001C0F00001E0F00000E0F00000F0F00000 F0780000787800007878000078780000783C0000383C0000381C0000381E0000380E0000380700 0038078000380380007001C0007000E00060003000E0001C01C0000707000001FC00>29 33 -2 1 35]79 dc[31 31 -2 0 29]80 dc[<000003E0FFFC071807C00E0403C01E 0403C01E0203C01E0203C01E0001E00F0001E00F0001E00F0001E00F0000F0078000F0070000F0 0F0000F00E0000781C00007FF80000780F0000780380003C01E0003C00F0003C0078003C007800 1E003C001E003C001E003C001E003C000F003C000F0038000F0070000F01E000FFFF80>31 32 -2 1 35]82 dc[<81F80000C60E0000E8030000700180006001C0006000C0006000E000200060 0020007000200070000000700000007000000070000000F0000003F000003FF00000FFE00001FF C00003FF800003F8000003C0000003800000038000000380020003800200038002000180020001 C0030000C007000060070000300B00001811800007E080>25 33 -3 1 28]83 dc[<7FFFC00001 F0000000F0000000F0000000F0000000F0000000780000007800000078000000780000003C0000 003C0000003C0000003C0000001E0000001E0000001E0000001E0000000F0000000F0000000F00 00800F0010400780084007800860078008200780082003C0081003C0081803C0181E03C0380FFF FFFC>30 31 -1 0 27]84 dc[<0080000000C0000001C0000001E0000001F0000001F0000001E8 000001E8000001E4000001E2000003E2000003C1000003C1800003C0800003C0400003C0400003 C0200003C0100003C0100007C00800078008000780040007800200078002000780010007800080 078000800F8000400F0000400F0000600F800078FFF801FF>32 32 -2 1 27]86 dc[37 31 -1 0 38]88 dc[<0F0780308C40705C40703C20F01C20F01C20F00E10F00E00F00E00F00E00780700 7807007807003807003C03801C03800E03800707800389C000F180>20 20 -2 0 24]97 dc[<1F 0031C060E06070E038E03CE01CE01EE01EE01E700F700F700F700F380F380F3C0E3A0E1D0C1CF0 1C001C000E000E000E000E0007000700070007003F800780>16 32 -2 0 20]98 dc[<0FC01838 300470027001F000F000F000F000F0007800780078003C041C0E1E0F0E0F070101C2007C>16 20 -2 0 20]99 dc[<0F0780308C40705C40703C20F01C20F01C20F00E10F00E00F00E00F00E0078 07007807007807003807003C03801C03800E03800707800389C000F1C00001C00001C00000E000 00E00000E00000E00000700000700000700000700003F8000078>21 32 -2 0 24]100 dc[<07 C018383004700270017000F000F000F000F0007C007BF0780C38023C011C010E01070101C2007C >16 20 -2 0 21]101 dc[<3C0000620000F3000079800031800001C00000C00000E00000E000 00E00000E000007000007000007000007000007000003800003800003800003800003800001C00 001C00001C00001C00001C00000E00000E0000FFF0000E00000E00000E00000700000700000700 00070000030C00039E00019E0000CE00007C>23 41 -2 9 22]102 dc[<3FC000607000F03800 781C00300E00000E00000E0000070000070001E7000617000E0B800E07801E03801E03801E01C0 1E01C01E01C01E01C00F00E00F00E00F00E00700E007807003807001C07000E0F0007138001E30 >21 29 0 9 22]103 dc[<0E00190038803840384038401C201C001C000E000E00070007008700 438043804380238013000E00000000000000000000000000000000C001E001E000E0>11 31 -2 0 16]105 dc[<38006400E200E200E200E200710070007000700038003800380038001C001C00 1C001C000E000E000E000E00070007000700070003800380038003801FC003C0>10 32 -2 0 14 ]108 dc[<1801800F0038038018801C01C018401C01C038401C01C038201C01C01C200E00E01C 100E00E00E000E00E00E000E00E00E000700700700070070070007007007008700700700438038 0380438038038043C034030023A032030023186186001E07C07C00>36 20 -2 0 40]109 dc[< 1801E03803101C03081C07081C07041C03840E03820E01C00E01C00E01C00700E00700E00700E0 8700E043807043807043C07023A0602318C01E0780>23 20 -2 0 27]110 dc[<07C000187000 301800700E00700F00F00700F00780F003C0F003C0F003C07801E07801E07801E03C01E01C01E0 1E01C00E01C003018001C300007C00>19 20 -2 0 22]111 dc[23 29 1 9 23]112 dc[<1800003800001C00001C00001C00001C00000E00000E00000E00000E000007 000007000007000087000043830043878043C78023C3802321001E1E00>17 20 -2 0 21]114 dc[<1FC020304008E004F006F00670070007001F01FE03FC07F807800E00060606070603030101 82007C>16 20 -2 0 21]115 dc[<0F00188038403820382038201C101C001C001C000E000E00 0E000E0007000700070007000380FFF80380038001C001C001C001C000E000C0>13 28 -1 0 16 ]116 dc[<03E1E00613100E0F100C07080C07080E07080E03840E03800E03800E03800701C007 01C00701C08381C04380E041C0E021C0E02180E01180700F0060>22 20 -2 0 26]117 dc[<01 F0780007098600060781000E0780800E0380800E0380400E0380400E0380200E0380200E038020 0701C0100701C0100701C0108381C0104380E01841C0E03821C0E0782180E0F8118070F00F0060 60>29 20 -2 0 33]119 dc[<383C00446300E2C080F1C080F1C04061C04000E02000E00000E0 0000E0000070000070000070004070002038602038F01038F01034700C622003C1C0>20 20 -2 0 26]120 dc[<1F000021C000606000707000783800781800001C00000E00000E0003EE00061E 000E0F000C07000C07000E07000E03800E03800E03800E03800701C00701C00701C08381C04380 E041C0E021C0E02180E01180700F0060>20 29 -2 9 22]121 dc /fl df[<7FE3FF0007007000 070070000700700007007000070070000700700007007000070070000700700007007000070070 0007007000070070000700700007007000070070000700700007007000FFFFFF80070070000700 700007007000070070000700700007007000070070000300F0300380F87801C0787800F06E3000 1F83E0>29 32 0 0 27]11 dc[<7FC3FE0700E00700E00700E00700E00700E00700E00700E007 00E00700E00700E00700E00700E00700E00700E00700E00700E00700E00700E0FFFFE007000007 00000700000700000700000700000701E00701E00381E001C0C000E0C0003F00>23 32 0 0 25] 12 dc[<7FE7FE0700E00700E00700E00700E00700E00700E00700E00700E00700E00700E00700 E00700E00700E00700E00700E00700E00700E00700E0FFFFE00700E00700E00700E00700E00700 E00700E00700E00700E00381E001C1E000E0E0003FE0>23 32 0 0 25]13 dc[<7FE3FE3FF007 007007000700700700070070070007007007000700700700070070070007007007000700700700 070070070007007007000700700700070070070007007007000700700700070070070007007007 0007007007000700700700FFFFFFFF000700700000070070000007007000000700700000070070 000007007000000700F00F000300F00F000380F80F0001C07C060000F04F0400001F81F800>36 32 0 0 38]14 dc[<70F8F8F8700000000000202020202070707070707070707070F8F8F8F8F8 F8F870>5 33 -4 0 13]33 dc[<402020101008100808040804040204020402743AFC7EFC7EF8 7C7038>15 14 -2 -18 23]34 dc[<07E00F801C183860380670307801C0107003C008F003C008 F0074000F00E2000F01E1000701C100070380800307808001870040008F0020004E0020003E001 0001C0010001C00080038001C003C003E003A00FFC031000000708000007080000070400000704 00000702000007020000070200000702000003020000018400000084000000780000>30 34 -2 1 35]38 dc[<40201010080804040474FCFCF870>6 14 -4 -18 13]39 dc[<00200040008001 00020006000C000C00180018003000300030007000600060006000E000E000E000E000E000E000 E000E000E000E000E000E0006000600060007000300030003000180018000C000C000600020001 00008000400020>11 46 -3 12 18]40 dc[<800040002000100008000C000600060003000300 01800180018001C000C000C000C000E000E000E000E000E000E000E000E000E000E000E000E000 C000C000C001C001800180018003000300060006000C0008001000200040008000>11 46 -3 12 18]41 dc[<01800180018001800180C183F18F399C0FF003C003C00FF0399CF18FC18301800180 018001800180>16 20 -3 -14 23]42 dc[<000600000006000000060000000600000006000000 060000000600000006000000060000000600000006000000060000000600000006000000060000 FFFFFFF0FFFFFFF000060000000600000006000000060000000600000006000000060000000600 0000060000000600000006000000060000000600000006000000060000>28 32 -3 5 35]43 dc [<40201010080804040474FCFCF870>6 14 -4 9 13]44 dc[10 2 -1 -9 15]45 dc[<70F8F8F870>5 5 -4 0 13]46 dc[16 45 -3 11 23]47 dc[<03F0000E1C001C0E00180600380700780780700380700380700380F003C0F003C0F003C0F0 03C0F003C0F003C0F003C0F003C0F003C0F003C0F003C0F003C0F003C070038070038070038070 03803807001806001C0E000E1C0003F000>18 31 -2 1 23]48 dc[15 30 -4 0 23]49 dc[18 30 -2 0 23]50 dc[<03F0001C3C00200E00400F00400780F00780F807C0F807C0F807C02007C00007C000 0780000780000F00000E00003C0003F000003800001C00000E00000F00000F00000F80380F8078 0780780780780F80200F00100E000C1C0003F000>18 31 -2 1 23]51 dc[<00FFE0000E00000E 00000E00000E00000E00000E00000E00FFFFF0C00E00400E00200E00200E00100E00080E00080E 00040E00020E00020E00010E00008E00008E00004E00002E00002E00001E00000E00000E000006 00000600>20 30 -1 0 23]52 dc[<03E0000C3800100E00200600400700400380E00380F003C0 F003C07003C00003C00003C00003C0000380000380100780100700180E00161C0011F000100000 1000001000001000001000001000001FE0001FF8001FFC001FFE00180300>18 31 -2 1 23]53 dc[<01F000061C000C0E001807003807003803807003807003C07003C0F003C0F003C0F003C0F0 03C0F003C0F80380F80380F80700F40600F21C00F1F0007000007000007800003800003803001C 07800C07800E0380070100018200007C00>18 31 -2 1 23]54 dc[<0300000780000780000780 0007800007800007800007800003800003800003800003800001800001C00000C00000C0000040 000040000020000020000010000008000008008004008002008002004001007FFF807FFF807FFF C0400000>18 31 -3 1 23]55 dc[<03F0000C0C00100200200100600180C00080C000C0C000C0 C000C0C001C04001C0600380300F80103F000C7E0007FC0003F8000FF0001FC8003F06003E0300 7803007001806001806001806001802001803003001006000C0C0003F000>18 31 -2 1 23]56 dc[<0FC000107000201800700C00780E0078060030070000070000038000038000038003E3C00E 13C0180BC03807C07007C07007C0F003C0F003C0F003C0F003C0F003C0F00380F0038070038070 07003807003806001C0C000E180003F000>18 31 -2 1 23]57 dc[<70F8F8F870000000000000 0000000070F8F8F870>5 20 -4 0 13]58 dc[<40202010101008080878F8F8F0700000000000 000000000070F8F8F870>5 29 -4 9 13]59 dc[<7FFFFFE0FFFFFFF000000000000000000000 00000000000000000000000000000000000000000000FFFFFFF07FFFFFE0>28 12 -3 -5 35] 61 dc[<07000F800F800F80070000000000000000000000020002000200020002000200030001 000180018000C000E000700038603CF03CF03CE03C4038403830700FC0>14 32 -3 0 21]63 dc [<001FF00000E01F00010001C0060000700800000008000000100F07802030CC4020605C2040C0 3C2041C01C1041C01C1081801C1083801C1083801C1083801C1083801C1083801C1083801C1081 801C1041C01C2041C01C2040C02020206040402030C040100F0080080001000800010006000600 0100080000E07000001F8000>28 32 -3 0 35]64 dc[31 32 -1 0 34]65 dc[26 31 -2 0 32]66 dc[<000FC0000070380001C00400038002 00070001000E0000801E0000801C0000403C0000407C0000407C00004078000000F8000000F800 0000F8000000F8000000F8000000F8000000F8000000F8000000F8000000780000407C0000407C 0000403C0000C01C0000C01E0000C00E0001C0070003C0038005C001C009C0007030C0000FC040 >26 33 -3 1 33]67 dc[29 31 -2 0 35]68 dc[27 31 -2 0 31]69 dc[25 31 -2 0 30]70 dc[<000FE0000078182000E0046003 8002E0070001E00F0001E01E0001E01E0001E03C0001E03C0001E07C0001E0780001E0F80003E0 F8007FFCF8000000F8000000F8000000F8000000F8000000F8000000F8000000780000207C0000 203C0000203C0000601E0000601E0000600F0000E0070001E0038002E000E004E000781860000F E020>30 33 -3 1 36]71 dc[29 31 -2 0 34]72 dc[14 31 -1 0 16]73 dc[<0F800030E000407000407800F0 3800F83C00F83C00F83C00203C00003C00003C00003C00003C00003C00003C00003C00003C0000 3C00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C0000 7C000FFFC0>18 32 -2 1 23]74 dc[30 31 -2 0 35]75 dc[23 31 -2 0 28]76 dc[37 31 -2 0 42]77 dc[ 29 31 -2 0 34]78 dc[<001F800000F0F00001C0380007801E000F000F000E0007001E000780 3C0003C03C0003C07C0003E07C0003E0780001E0F80001F0F80001F0F80001F0F80001F0F80001 F0F80001F0F80001F0F80001F0F80001F0780001E0780001E07C0003E03C0003C03C0003C01E00 07800E0007000F000F0007801E0001C0380000F0F000001F8000>28 33 -3 1 35]79 dc[25 31 -2 0 31]80 dc[<0000078000000FC000001FE000001FE000003FF0000038 700000383000003010001FB01000F0F01001E0380007A03E000F204F000E2047001E1087803C0F 03C03C0003C07C0003E0780001E0780001E0F80001F0F80001F0F80001F0F80001F0F80001F0F8 0001F0F80001F0F80001F0F80001F0780001E07C0003E07C0003E03C0003C03C0003C01E000780 0E0007000F000F0007801E0001C0380000F0F000001F8000>28 41 -3 9 35]81 dc[<000003E0 FFFC0F100FC01E0807803E0407807E0407807C0407807C0007807C0007807C0007807800078078 0007807800078070000780F0000780E0000781C00007FF80000780F0000780780007803C000780 1E0007801E0007801F0007801F0007801F0007801F0007801E0007801E0007803C00078078000F 80F000FFFF8000>30 32 -2 1 33]82 dc[<81F800CE0C00F00600E00300C00380C001808001C0 8001C08001C08001C00001C00003C00003C0000780001F8003FF000FFE001FFC003FF0007F0000 780000F00000F00000E00080E00080E00080E001806001806001803003801007800C198007E080 >18 33 -3 1 25]83 dc[<07FFFE00001F8000000F0000000F0000000F0000000F0000000F0000 000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F00 00000F0000000F0000000F0000000F0000800F0010800F0010800F0010800F0010C00F0030400F 0020400F0020600F0060780F01E07FFFFFE0>28 31 -2 0 33]84 dc[<000FC000003820000070 180000E0080001C0040001C0020003800200038002000780010007800100078001000780010007 800100078001000780010007800100078001000780010007800100078001000780010007800100 07800100078001000780010007800100078001000780010007800100078003800FC007C0FFFC3F F8>29 32 -2 1 34]85 dc[<000100000003800000038000000380000007C0000007C0000007C0 00000F2000000F2000001F3000001E1000001E1000003C0800003C0800003C0800007804000078 040000F8060000F0020000F0020001F0010001E0010001E0010003C0008003C0008003C0008007 800040078000400F8000600F0000601F8000F8FFF003FE>31 32 -1 1 34]86 dc[<0004000200 00000C00030000000E00070000000E00070000001E00078000001F000F8000001F000F8000001F 000F8000003C801E4000003C801E4000003C801E40000078C03E20000078403C20000078403C20 0000F0403C100000F02078100000F02078100001F02078080001E010F0080001E010F0080003E0 10F00C0003C009E0040003C009E0040003C009E00400078007C00200078007C00200078007C002 000F0007C001000F00078001000F00078003801F800FC007C0FFF07FF81FF0>44 32 -1 1 47] 87 dc[31 31 -1 0 34]88 dc[<007FFE000007C0000003C0000003C00000 03C0000003C0000003C0000003C0000003C0000003C0000003C0000003C0000003C0000007C000 0007A000000FB000001F1000001E0800003E0800003C0400007C040000F8020000F0030001F001 0001E0008003E0008007C00040078000400F8000601F8000F8FFF003FF>32 31 -1 0 34]89 dc [22 31 -3 0 28]90 dc[7 45 -4 11 13]91 dc[<381C7C3EFC7EFC7EB85C804080408040402040202010201010080804>15 14 -5 -18 23]92 dc[7 45 -1 11 13]93 dc[<387CFCFCB8808080404020201008> 6 14 -3 -18 13]96 dc[<0F83C0386720781E10F01E10F00E10F00E10F00E10780E00380E001E 0E00078E0000FE00000E00000E00000E00300E00781C007818003030001FE000>20 20 -2 0 23 ]97 dc[<083E000CC3000D01C00F00E00E00E00E00700E00700E00780E00780E00780E00780E00 780E00780E00700E00700E00E00F00E00F01C00EC3800E3E000E00000E00000E00000E00000E00 000E00000E00000E00000E00000E0000FE00000E0000>21 32 -1 0 25]98 dc[<03F00E0C1C02 3801380170007000F000F000F000F000F000F00070007000380C381E1C1E0E0C03F8>16 20 -2 0 20]99 dc[<03E3F80E1B801C0780380780380380700380700380F00380F00380F00380F00380 F00380F003807003807003803803803803801C0780061B8003E380000380000380000380000380 000380000380000380000380000380000380003F80000380>21 32 -2 0 25]100 dc[<01F800 0706000C0100180080380080700000700000F00000F00000F00000FFFF80F00380F00380700380 7007003807003807001C0E000E1C0003F000>17 20 -1 0 20]101 dc[<7FF007000700070007 0007000700070007000700070007000700070007000700070007000700FFF00700070007000700 0700070007000706038F018F00C6007C>16 32 0 0 14]102 dc[<03FC001C03803000C0600060 C00030C00030C00030C000306000703001E00FFFC01FFF803FFE00300000300000200000200000 33E0001E38001C1C00380E00780F00780F00780F00780F00780F00380E001C1C300E3C3003E330 0000E0>20 31 -1 10 23]103 dc[22 32 -1 0 25]104 dc[10 31 0 0 12]105 dc [<3F006180F0C0F060607000700070007000700070007000700070007000700070007000700070 007000700070007000700070007000F007F0007000000000000000000000000000E001F001F001 F000E0>12 40 2 9 14]106 dc[21 32 -1 0 24 ]107 dc[11 32 0 0 12]108 dc[35 20 -1 0 38]109 dc[22 20 -1 0 25]110 dc[<01F800070E001C0380 3801C03801C07000E07000E0F000F0F000F0F000F0F000F0F000F0F000F07000E07000E03801C0 3801C01C0380070E0001F800>20 20 -1 0 23]111 dc[21 29 -1 9 25]112 dc[<003FF800038000038000038000038000038000038000038000038003E3800E1380 1C0B80380780380380780380700380F00380F00380F00380F00380F00380F00380700380780380 3803803C07801C058006198003E080>21 29 -2 9 24]113 dc[15 20 -1 0 18]114 dc[ <8F80D060E030C018C01880188018803800700FF03FE07F807800E000C010C010C01040303070 1F90>13 20 -2 0 18]115 dc[<01E0031006100E080E080E080E080E080E000E000E000E000E 000E000E000E000E000E000E00FFF83E000E000E0006000600020002000200>13 28 -1 0 18] 116 dc[<01F1FC030DC00603C00E03C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01 C00E01C00E01C00E01C00E01C00E01C00E01C0FE1FC00E01C0>22 20 -1 0 25]117 dc[<0020 0000700000700000700000E80000E80001EC0001C40001C4000382000382000382000701000701 000E00800E00800E00801C00C01E01E0FF83F8>21 20 -1 0 24]118 dc[<0040080000601800 00E01C0000E01C0000F03C0001D03A0001D0320003C8730003887100038861000704E0800704C0 800707C0800E03C0400E0380400E0380401C0380201C0300603C078070FF9FE1FC>30 20 -1 0 33]119 dc[23 20 0 0 24]120 dc[<3C 0000620000F10000F08000F0800000400000400000400000200000200000700000700000700000 E80000E80001EC0001C40001C4000382000382000382000701000701000E00800E00800E00801C 00C01E01E0FF83F8>21 29 -1 9 24]121 dc[16 20 -1 0 20]122 dc[22 1 0 -12 23]123 dc /fm df[<60F07830>5 4 -4 0 12]46 dc[28 26 -3 0 29]75 dc[<1E18613460F2C072C072C072E038E038 E038E038701C301C381C181C0E2E03CC>15 16 -4 0 20]97 dc[<1E00638060C0C0E0C060C070 E038E038E038E03870187018701878303C303BC0380038001C001C001C001C000E000E000E007E 00>13 26 -4 0 18]98 dc[<1F0030C06020E010E008E000E000E000E00060007000301018380C 18060801F0>13 16 -4 0 18]99 dc[<1E180061340060F200C07200C07200C07200E03800E038 00E03800E03800701C00301C00381C00181C000E2E0003CE00000E00000E000007000007000007 00000700000380000380000380001F80>17 26 -4 0 20]100 dc[<1F0030C060206010E008E0 00E000E000E000FFE07010700838081C08061801E0>13 16 -4 0 18]101 dc[<700000CC0000 E4000066000007000007000007000003800003800003800003800003800001C00001C00001C000 01C00001C00000E00000E00000E00000E00000E00007FF00007000007000007000007000003000 003000003B00001B80001980000700>17 33 1 7 12]102 dc[<7F0000C1C000E0E00060700000 700000380000380007B800187800183C00301C00301C00301C00380E00380E00380E00380E001C 07000C07000E0700060700038B8000F300>17 23 -2 7 18]103 dc[<600E00E0190070390070 3880701C80701C80381C00380E00380E00380E001C07001C07001E07001E07000F86000E7C000E 00000E00000700000700000700000700000380000380000380001F8000>17 26 -2 0 20]104 dc[<3864E4E272727038381C9C9C8E4E4C38000000000000060703>8 25 -4 0 12]105 dc[<30 68E4E4E4E470707070383838381C1C1C1C0E0E0E0E0707073F>8 26 -3 0 10]108 dc[<601807 00E0380C80701C1C80701C1C40701C0E40701C0E40380E0E00380E0700380E0700380E07009C07 03809C0703809E0703809E07838059866300307C1E00>26 16 -4 0 31]109 dc[<600E00E019 00703900703880701C80701C80381C00380E00380E00380E009C07009C07009E07009E07005986 00307C00>17 16 -4 0 22]110 dc[<1F0030C06060E030E018E01CE00CE00EE00E600E700E30 0E180E0C0C061801F0>15 16 -4 0 20]111 dc[19 23 0 7 20]112 dc[<6000E000700070007000700038003800 380038009C009C009C189E38591830F0>13 16 -4 0 16]114 dc[<3E00418080C0E060E06000 6000E00FE01FC01F801C00186018700830043003E0>12 16 -3 0 16]115 dc[<38006400E200 E100E100E100700070007000700038003800380038001C00FFC01C001C000E000E000E000E0006 00>10 23 -4 0 13]116 dc[<0F0C389A3079703970397039381C381C381C1C1C9C0E9C0E8E0E 4E0E4C073806>16 16 -4 0 21]117 dc[<0F0018C030407020701070103808380838081C089C 0C9C0C8E0C4E1C4C1C3818>14 16 -4 0 18]118 dc[<78F000C58800E78400C3820003820003 820001C00001C00001C00001C00020E00020E00020E18010F38008D180078F00>17 16 -2 0 18 ]120 dc /fn df[<0007F00000003FFE000000780F000001C001C000038000E00006000030000C 000018001800000C001800000C003000000600600000030060000003006000000300C000000180 C000000180C000000180C000000180C000000180C000000180C000000180600000030060000003 00600000030030000006001800000C001800000C000C000018000600003000038000E00001C001 C00000780F0000003FFE00000007F00000>33 33 -2 7 38]13 dc /fo df[28 26 -2 0 32]68 dc[25 26 -2 0 25]70 dc[<03F800000E0F00001C03C0 003800E0007000700070003800F0003C00F0001E00F0000E00F0000F00F0000F00F0000780F000 0780F0000780780003C0780003C0380003C03C0003C01C0003800E0003800F0003800700070001 C0070000E00E0000383800000FE000>26 26 -2 0 29]79 dc[<03000000030000000380000003 C0000003C0000003A0000003900000079000000708000007040000070400000702000007030000 070100000F0080000E0080000E0040000E0020000E0020000E0010000E0008000E0008001C0004 001C0006001E000700FFC01FE0>27 26 -2 0 22]86 dc /fp df[<7F0FF00E07000E07000E07 000E07000E07000E07000E07000E07000E07000E07000E07000E07000E07000E0700FFFFF00E07 000E07000E07000E07000E07000E070006070407078E0183C600FC7C>23 26 0 0 22]11 dc[< 7F0FE00E07000E07000E07000E07000E07000E07000E07000E07000E07000E07000E07000E0700 0E07000E0700FFFF000E00000E00000E00000E00000E00000E020006070007030001820000FC00 >19 26 0 0 21]12 dc[<7F9FE00E07000E07000E07000E07000E07000E07000E07000E07000E 07000E07000E07000E07000E07000E0700FFFF000E07000E07000E07000E07000E07000E070006 070007070003870000FF00>19 26 0 0 21]13 dc[<7F8FE3FC0E0380E00E0380E00E0380E00E 0380E00E0380E00E0380E00E0380E00E0380E00E0380E00E0380E00E0380E00E0380E00E0380E0 0E0380E0FFFFFFE00E0380000E0380000E0380000E0380000E0380000E038040060380E00703C0 6001C17040007E1F80>30 26 0 0 32]14 dc[<08000700180018800C00184006003040060070 2003007020018070200180702000C070200060702000607020003030400018184000181880000C 07000E060000310300003083000060818000E040C000E040C000E0406000E0403000E0403000E0 401800E05FEC0060E01C0030800E00310007000E000300>27 30 -2 2 32]37 dc[5 11 -3 -15 11]39 dc[<00800100020004000C000800180030003000300060 00600060006000E000E000E000E000E000E000E000E000E000E000600060006000600030003000 3000180008000C000400020001000080>9 38 -3 10 15]40 dc[<800040002000100018000800 0C0006000600060003000300030003000380038003800380038003800380038003800380030003 00030003000600060006000C00080018001000200040008000>9 38 -2 10 15]41 dc[<000C00 00000C0000000C0000000C0000000C0000000C0000000C0000000C0000000C0000000C0000000C 0000000C0000FFFFFF80FFFFFF80000C0000000C0000000C0000000C0000000C0000000C000000 0C0000000C0000000C0000000C0000000C0000000C0000>25 26 -2 4 30]43 dc[<8040202010 101070F0F060>4 11 -3 7 11]44 dc[10 2 0 -7 13]45 dc[<60F0F060>4 4 -3 0 11]46 dc[<078018603030703860186018E01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE0 1CE01C601860183030303018600780>14 24 -2 0 19]48 dc[12 24 -3 0 19]49 dc[14 24 -2 0 19]50 dc[<0F8030E040704038C03CE0 3CE03C003C003C0038007000E00F8000C00060007000700078203870386078207010E00F80>14 24 -2 0 19]51 dc[<07FF007000700070007000700070FFFFC070407020703070107008700C70 047002700370017000F000F0007000300030>16 24 -1 0 19]52 dc[<0F8030E0403040388018 E01CE01C401C001C001C001800382030386027C0200020002000200020003FC03FE03FF03018> 14 24 -2 0 19]53 dc[<07C01860303030187018601C601CE01CE01CE01CE018F018F030E860 E7C0E000600070003000303818380C18061001E0>14 24 -2 0 19]54 dc[<0200070007000700 070007000700030003000300030001000180018000800040004080208010801040087FFC7FFC7F FE4000>15 25 -2 0 19]55 dc[<0FC0186020106008C00CC00CC00CC00C401C603830F819F007 C00F803E603C3070106018601860182018303018600780>14 24 -2 0 19]56 dc[<1F00218060 4070607030003800180018001C0F9C185C303C603C601CE01CE01CE01CE018E018601870303030 18600780>14 24 -2 0 19]57 dc[<8040202010101070F0F060000000000000000060F0F060> 4 23 -3 7 11]59 dc[25 10 -2 -4 30]61 dc[26 26 -1 0 29]65 dc[22 26 -2 0 27]66 dc[<003F0001C0C003 00300E00081C00081C0004380004780002700002700002F00000F00000F00000F00000F00000F0 00007000027000027800023800061C00061C000E0E001E03002E01C0C6003F02>23 26 -2 0 28 ]67 dc[24 26 -2 0 29]68 dc[22 26 -2 0 26]69 dc[20 26 -2 0 25]70 dc[<003F 820001C06600030016000E000E001C000E001C000E0038000E0078000E0070000E0070000E00F0 01FFC0F0000000F0000000F0000000F0000000F000000070000200700002007800020038000600 1C0006001C000E000E001E0003002E0001C0C600003F0200>26 26 -2 0 30]71 dc[24 26 -2 0 29]72 dc[11 26 -1 0 14]73 dc[25 26 -2 0 30]75 dc[19 26 -2 0 24]76 dc[30 26 -2 0 35]77 dc[< FF80101C00300800300800700800700800F00801D00801D0080390080390080710080E10080E10 081C10081C1008381008701008701008E01008E01009C0100B80100B80100F00100F0038FE01FF >24 26 -2 0 29]78 dc[<007F000001C1C000070070000E0038001C001C003C001E0038000E00 78000F0078000F00F0000780F0000780F0000780F0000780F0000780F0000780F0000780F00007 807000070078000F0038000E003C001E001C001C000E0038000700700001C1C000007F0000>25 26 -2 0 30]79 dc[21 26 -2 0 26]80 dc[25 26 -2 0 28]82 dc[<87E0D818E004C006C0028003800380030003000700 0E003E07FC1FF83FE07E007000E000C002C002C002C0066006200E18360FC2>16 26 -2 0 21] 83 dc[<03FFE000001C0000001C0000001C0000001C0000001C0000001C0000001C0000001C00 00001C0000001C0000001C0000001C0000001C0000001C0000001C0000001C0000001C0000801C 0080801C0080801C0080C01C0180401C0100401C0100701C07007FFFFF00>25 26 -1 0 28]84 dc[<003E0000C1800180400300400700200600200E00100E00100E00100E00100E00100E00100E 00100E00100E00100E00100E00100E00100E00100E00100E00100E00100E00100E00100E0038FF E1FF>24 26 -2 0 29]85 dc[<000C0000000C0000001E0000001E0000001E0000003900000039 000000390000007080000070800000E0400000E0400000E0400001C0200001C0200003C0300003 801000038010000700080007000800070008000E0004000E0004001C0006001E000F00FF801FC0 >26 26 -1 0 29]86 dc[26 26 -1 0 29]88 dc[7 37 -3 9 11]91 dc[7 37 0 9 11]93 dc[<3078F8B080808040402018>5 11 -2 -15 11]96 dc[<1E3C71FBE0F1E071E071E070707030701C7007F000700070207070E070 C03F80>16 16 -2 0 19]97 dc[<10F0001B0C001E07001C03001C03801C01C01C01C01C01C01C 01C01C01C01C01C01C01801C03801E07001F0E001CF8001C00001C00001C00001C00001C00001C 00001C00001C00001C0000FC0000>18 26 -1 0 21]98 dc[<07E00C18380830047000E000E000 E000E000E000E00070003008381C0C1C07F8>14 16 -1 0 17]99 dc[<07CFC01C2E00381E0070 0E00600E00E00E00E00E00E00E00E00E00E00E00E00E00700E00300E00380E000C3E0003CE0000 0E00000E00000E00000E00000E00000E00000E00000E00000E00007E00>18 26 -1 0 21]100 dc[<07E00C18380830046000E000E000E000E000FFFCE00C600C701830181C3007C0>14 16 -1 0 17]101 dc[<7FE00E000E000E000E000E000E000E000E000E000E000E000E000E000E00FFC0 0E000E000E000E000E000E000E100738031801F0>13 26 0 0 12]102 dc[<07E0381C6006C003 C003C003C003600F1FFE3FFC3FF07000600020002FC0186030307038703870387038303018730F CE>16 24 -1 8 19]103 dc[18 26 -1 0 21]104 dc[ 9 26 0 0 10]105 dc[<7E00E300E18041C001C001C001C001C001C001C001C001C001C001C001 C001C001C001C001C001C001C001C00FC0000000000000000000000000018003C003C00180>10 33 2 7 12]106 dc[18 26 -1 0 20]107 dc[9 26 0 0 10]108 dc[29 16 -1 0 32] 109 dc[18 16 -1 0 21]110 dc[<07E01C38381C700E6006E007E007 E007E007E007E0076006700E300C1C3807E0>16 16 -1 0 19]111 dc[18 23 -1 7 21]112 dc[<007FC0000E00 000E00000E00000E00000E00000E0007CE001C2E00381E00700E00700E00E00E00E00E00E00E00 E00E00E00E00E00E00700E00300E00381E000C260003C200>18 23 -1 7 20]113 dc[12 16 -1 0 15]114 dc[<8F80F040C020C0308030807000F01FE03FC07F00F000C020C020402060E01F20>12 16 -1 0 15]115 dc[<03800E401C201C201C201C201C201C001C001C001C001C001C001C001C00FFC0 3C001C000C000C00040004000400>11 23 -1 0 15]116 dc[<07CFC00C2E001C1E001C0E001C 0E001C0E001C0E001C0E001C0E001C0E001C0E001C0E001C0E001C0E001C0E00FC7E00>18 16 -1 0 21]117 dc[<00800001C00001C00001C00003A00003A0000790000710000710000E08000E 08001E0C001C04001C04003C0600FF1F80>17 16 -1 0 20]118 dc[<010040000180C0000380 E0000380E00003C1E0000741D000074190000F2398000E2388000E2308001E170C001C1704001C 160400380E06003C0E0700FF3F9F80>25 16 -1 0 28]119 dc[18 16 -1 0 20]120 dc[<780000E40000E20000E1000001000001000000800000800001C00001C00001 C00003A00003A0000790000710000710000E08000E08001E0C001C04001C04003C0600FF1F80> 17 23 -1 7 20]121 dc[13 16 -1 0 17]122 dc /fq df[<40C0E06070703038383C1C1E1E0E0F0F06>8 17 -1 -1 10]48 dc[<01FF8007FF800E0000180000300000600000600000600000C00000C00000FF FF80FFFF80C00000C000006000006000006000003000001800000E000007FF8001FF80>17 22 -3 3 24]50 dc /fr df[<60F0F060>4 4 -3 0 10]58 dc[<40402020101070F0F060>4 10 -3 6 10]59 dc[23 23 -1 0 26]65 dc[26 23 -1 0 29]68 dc[25 23 -1 0 22]70 dc[<03F0000E0E001803803801C07000E07000707000 38600038E0001C70001C70000E70000E70000E30000E38000E18000E1C000E0E000E06000C0300 1C01C018007070001FC0>23 23 -1 0 27]79 dc[24 23 -1 0 22]80 dc[25 23 -1 0 27]82 dc[<7FFC0003C00001C00001C00001C00001C00000E00000E00000E00000E000 007000007000007000007000003800003800803804403804401C04601C04201C04381C0E1FFFFE >23 23 -1 0 21]84 dc[<02000003000003800007800007400007600007200007100007100007 08000F04000E04000E02000E01000E01000E00800E00400E00401C00201C00301C00101C0018FF 807F>24 23 -2 0 21]86 dc[<387046C8C1C480C480C480C0C060C060C06060606070307018F0 0710>14 14 -2 0 19]97 dc[<3C004600C100818080C080C0C060C060C060C0606060704068C0 6780300030003000300018001800180018007C00>11 23 -2 0 15]98 dc[<3F0060C0C020C010 80008000C000C000C0006000207010700C2007C0>12 14 -2 0 15]99 dc[<1F0060C04020C010 C000C000C000C000FFC06020601030101C2007C0>12 14 -2 0 16]101 dc[<7800CC00E60066 00030003000300030001800180018001800180018000C000C000C000C000C007FC006000600060 00600060003600370013000E>16 29 -2 6 17]102 dc[<7F00C1C0E060606000300030073008 F01838101810181018180C180C180C0C0C0C0E060E031E00E2>15 20 0 6 17]103 dc[16 23 -2 0 20]104 dc[<1C0032003200310031001800180018000C008C00460046 0024001C00000000000000000000000000030003800300>9 23 -1 0 12]105 dc[<7800C600E3 006300018001800180018000C000C000C000C0006000600060086004300430022001C000000000 0000000000000000001000380018>13 29 0 6 14]106 dc[<70D0C8C8C8C06060606030303030 181818180C0C0C0C3E>7 23 -2 0 11]108 dc[<3018078030180440180C0C40180C0C20180C06 20180C06000C0606000C0603000C0603008E070300460301004702810044C66300383C1E00>27 14 -1 0 31]109 dc[<300F00300880181880181840180C40180C000C0C000C06000C06008E06 0046020047020044C600383C00>18 14 -1 0 21]110 dc[<3E006180C0C0C06080308030C018 C018C0186018201810100C2007C0>13 14 -2 0 17]111 dc[16 20 0 6 18]112 dc[<30 00300018001800180018000C000C000C008C0046304638451838F0>13 14 -1 0 16]114 dc[< 3F00C180C0C0E0606060006003E00FC01E003800187018700C2007C0>12 14 -2 0 16]115 dc[ <1E003100310030803080300018001800180018000C000C000C00FFC006000600060006000300 0300>10 20 -1 0 13]116 dc[<078E000C59001838801818801818801818000C0C000C0C000C 0C00860C004606004606002606001C0200>17 14 -1 0 20]117 dc[<78F000C50800E70400C3 020003020003000001800001800001800041800020C30020C38011A1800F1F00>17 14 -1 0 20 ]120 dc[<1E00218070C070600060003007B00C7018381818181818180C0C0C0C0C0C860C4606 460626061C02>15 20 -1 6 17]121 dc[<81C043E03C30100808080400020001800040002010 1018780FCC0784>14 14 -1 0 16]122 dc /fs df[<0102040C1818303070606060E0E0E0E0E0 E0E0E0E0E060606070303018180C040201>8 34 -3 9 14]40 dc[<8040203018180C0C0E0606 06070707070707070707070606060E0C0C181830204080>8 34 -2 9 14]41 dc[<07C01C7030 18701C600C600CE00EE00EE00EE00EE00EE00EE00EE00EE00E600C600C701C3018183007C0>15 21 -1 0 18]48 dc[<7FF007000700070007000700070007000700070007000700070007000700 070007000700FF0007000300>12 21 -2 0 18]49 dc[13 21 -2 0 18]50 dc[<0FE0 30304018C00CE00EE00E000E000E000C0018003007E0006000380018001C701C701C601830300F E0>15 21 -1 0 18]51 dc[<03FE00700070007000700070FFFEC0704070207010701870087004 700270017001F000F0007000300030>15 21 -1 0 18]52 dc[<1F0020C040608030E038E03840 38003800380030207030E02F80200020002000200024003FC03FE02030>13 21 -2 0 18]53 dc [<07C018303018300C600E600EE00EE00EE00EF00CF018EC30E3E0E00060007000301C181C080C 060801F0>15 21 -1 0 18]54 dc[<04000E000E000E000E000E00060006000200030001000100 00800080004080208010C0087FF87FFC7FFE4000>15 22 -2 0 18]55 dc[<0FE03830600CC004 C006C006C00E601E607C18F80FF00FC01F603E107818700C600C600C2018183007E0>15 21 -1 0 18]56 dc[<1F8020C0603070187018001C000C000E0F8E186E301E601EE00EE00EE00EE00CE0 0C60183018183007C0>15 21 -1 0 18]57 dc /ft df[19 17 -2 0 19]70 dc[21 17 -2 0 23]82 dc[<0400000600000F00 000D00000C80000C40000C60001C20001810001808001808001804001802003002003001003001 80FC03E0>19 17 -3 0 18]86 dc[<1F0060C04020C000C000C0006000600030C018400780>11 11 -2 0 14]99 dc[<7800CC0046000300030003000300018001800180018000C008C008C004C0 03800000000000000000000000200020>11 23 0 5 13]106 dc[<603860643062303230303030 181898189C189A1871F0>15 11 -2 0 19]110 dc[<79C0C73043100308030003000180218021 8C11440F38>14 11 -1 0 17]120 dc[<7C008600C180418000C00EC031C030E0306030603060 183098308C3048303810>12 16 -2 5 16]121 dc /fu df[<1F00318060C04040C060C060C060 C060C060C060C060C060404060C031801F00>11 16 -1 0 15]48 dc[9 16 -2 0 15]49 dc[11 16 -1 0 15]50 dc[<1F00 60808040C060C0600060004000800F000180008000C060C060C021801F00>11 16 -1 0 15]51 dc[<1FE00300030003000300FFE0C30043002300330013000B000F00070003000300>11 16 -1 0 15]52 dc[<1F00618080C0C060006000600060204030802F002000200020002C003F002080> 11 16 -1 0 15]53 dc[<1F00308060C04060C060C060C060E040F080CF00C000600060C030C0 18400780>11 16 -1 0 15]54 dc[<18001800180018001800080008000C000400040002000100 808080807FC07FE04000>11 17 -2 0 15]55 dc[<1F0060804040C060C060C06061C033800F00 3F00718060C060C060C031801F00>11 16 -1 0 15]56 dc[<3E004300608060C0004000601E60 21E040E0C060C060C060C04060C031801F00>11 16 -1 0 15]57 dc /fv df[16 14 -2 0 18]70 dc[10 19 -1 4 12 ]106 dc[<73C0CE204610060006000600231023181CF0>13 9 -1 0 16]120 dc /fw df[21 14 -2 0 25]77 dc[17 14 -2 0 20]82 dc[<0FF00180018001800180018001 8001800180818181818181C183FFFF>16 14 -2 0 20]84 dc bop 391 422 a fl(REF)-5 b (A)o(CTORING)15 b(OBJECT-ORIENTED)i(FRAMEW)o(ORKS)942 954 y(BY)733 1041 y(WIL\ LIAM)f(F.)e(OPD)o(YKE)688 1137 y(B.S.,)h(Drexel)g(Univ)o(ersit)o(y)l(,)h(1979) 688 1194 y(B.S.,)f(Drexel)g(Univ)o(ersit)o(y)l(,)h(1979)513 1250 y(M.S.,)e (Univ)o(ersit)o(y)i(of)e(Wisconsin)j(-)e(Madison,)g(1982)893 1704 y(THESIS) 463 1800 y(Submitted)h(in)g(partial)g(ful\014llmen)o(t)h(of)d(the)i(requireme\ n)o(ts)380 1856 y(for)e(the)i(degree)f(of)g(Do)q(ctor)f(of)h(Philosoph)o(y)h (in)g(Computer)f(Science)671 1913 y(in)h(the)f(Graduate)g(College)h(of)f(the) 483 1969 y(Univ)o(ersit)o(y)h(of)f(Illinois)j(at)d(Urbana-Champaign,)g(1992) 821 2454 y(Urbana,)f(Illinois)g eop bop 391 135 a fl(REF)-5 b(A)o(CTORING)15 b (OBJECT-ORIENTED)i(FRAMEW)o(ORKS)711 270 y(William)g(F.)d(Op)q(dyk)o(e,)i(Ph.\ D.)643 327 y(Departmen)o(t)e(of)h(Computer)g(Science)483 383 y(Univ)o(ersit)o (y)h(of)f(Illinois)j(at)d(Urbana-Champaign,)g(1992)706 439 y(Ralph)i(E.)d(Joh\ nson,)i(Advisor)37 1155 y(This)k(thesis)g(de\014nes)g(a)e(set)h(of)g(program) f(restructuring)h(op)q(erations)g(\(refactorings\))f(that)g(supp)q(ort)h(the) 37 1211 y(design,)d(ev)o(olution)g(and)g(reuse)f(of)g(ob)s(ject-orien)o(ted)g (application)i(framew)o(orks.)108 1268 y(The)11 b(fo)q(cus)h(of)f(the)g(thesi\ s)h(is)f(on)h(automating)e(the)h(refactorings)g(in)h(a)f(w)o(a)o(y)f(that)g (preserv)o(es)i(the)f(b)q(eha)o(vior)37 1324 y(of)22 b(a)f(program.)38 b(The) 22 b(refactorings)g(are)f(de\014ned)i(to)e(b)q(e)i(b)q(eha)o(vior)f(preservin\ g,)h(pro)o(vided)g(that)e(their)37 1381 y(preconditions)15 b(are)f(met.)19 b (Most)12 b(of)h(the)h(refactorings)f(are)g(simple)i(to)d(implemen)o(t)j(and)f (it)f(is)h(almost)f(trivial)37 1437 y(to)g(sho)o(w)f(that)g(they)h(are)g(b)q (eha)o(vior)g(preserving.)20 b(Ho)o(w)o(ev)o(er,)12 b(for)g(a)h(few)f(refacto\ rings,)h(one)g(or)f(more)h(of)f(their)37 1493 y(preconditions)22 b(are)f(in)g (general)g(undecidable.)38 b(F)l(ortunately)l(,)21 b(for)f(some)g(cases)h(it) f(can)h(b)q(e)g(determined)37 1550 y(whether)16 b(these)f(refactorings)g(can) g(b)q(e)h(applied)h(safely)l(.)108 1606 y(Three)h(of)f(the)g(most)g(complex)h (refactorings)f(are)g(de\014ned)i(in)f(detail:)26 b(generalizing)19 b(the)f (inheritance)37 1663 y(hierarc)o(h)o(y)l(,)f(sp)q(ecializing)i(the)d(inherita\ nce)i(hierarc)o(h)o(y)e(and)g(using)h(aggregations)e(to)g(mo)q(del)i(the)f (relation-)37 1719 y(ships)23 b(among)d(classes.)39 b(These)22 b(op)q(eration\ s)g(are)f(decomp)q(osed)h(in)o(to)f(more)g(primitiv)o(e)i(parts,)f(and)f(the) 37 1776 y(p)q(o)o(w)o(er)c(of)g(these)g(op)q(erations)g(is)h(discussed)h(from) d(the)h(p)q(ersp)q(ectiv)o(es)i(of)e(automatabilit)o(y)g(and)g(usefulness)37 1832 y(in)g(supp)q(orting)e(design.)108 1889 y(Tw)o(o)e(design)h(constrain)o (ts)f(needed)h(in)h(refactoring)d(are)i(class)f(in)o(v)m(arian)o(ts)h(and)g (exclusiv)o(e)h(comp)q(onen)o(ts.)37 1945 y(These)21 b(constrain)o(ts)f(are)g (needed)i(to)e(ensure)h(that)e(b)q(eha)o(vior)i(is)g(preserv)o(ed)g(across)e (some)h(refactorings.)37 2002 y(This)j(thesis)f(giv)o(es)f(some)g(conserv)m (ativ)o(e)h(algorithms)g(for)e(determining)j(whether)f(a)f(program)f(satis\ \014es)37 2058 y(these)c(constrain)o(ts,)e(and)i(describ)q(es)g(ho)o(w)f(to)g (use)g(this)h(design)g(information)f(to)g(refactor)f(a)h(program.)956 2760 y (iii)g eop bop 499 1350 a fl(T)l(o)15 b(Brenda,)g(for)g(her)g(encouragemen)o (t)g(and)g(supp)q(ort.)957 2760 y(iv)g eop bop 697 221 a fd(Ac)n(kno)n(wledge\ men)n(ts)108 578 y fl(I)13 b(thank)g(m)o(y)f(advisor,)h(Prof.)19 b(Ralph)14 b (Johnson,)f(for)f(his)i(supp)q(ort,)f(guidance)h(and)f(patience)h(during)g (m)o(y)37 634 y(studies)j(at)f(the)g(Univ)o(ersit)o(y)g(of)g(Illinois.)25 b (I)16 b(learned)h(m)o(uc)o(h)f(from)f(our)h(w)o(eekly)g(Monda)o(y)f(w)o(orkin\ g)h(lunc)o(hes)37 691 y(and)h(from)f(other)g(feedbac)o(k)h(he)g(ga)o(v)o(e)e (me.)24 b(I)17 b(w)o(as)f(amazed)g(b)o(y)h(b)q(oth)f(his)i(insigh)o(ts)f(and) f(his)i(stamina.)23 b(He)37 747 y(in)o(v)o(ested)16 b(his)g(most)f(v)m(aluabl\ e)i(resource)e(on)g(m)o(y)g(b)q(ehalf:)21 b(his)16 b(time.)108 803 y(I)d(also) g(thank)g(the)g(other)g(mem)o(b)q(ers)g(of)f(m)o(y)h(committee.)19 b(Prof.)f (Simon)c(Kaplan)g(w)o(as)e(helpful)j(in)f(p)q(oin)o(t-)37 860 y(ing)j(out)e (places)h(in)h(sev)o(eral)f(drafts)e(of)i(the)f(thesis)i(where)e(clarit)o(y)h (could)h(b)q(e)f(impro)o(v)o(ed)g(and)g(claims)g(made)37 916 y(more)j(precise\ .)32 b(His)19 b(views)g(on)g(supp)q(orting)h(the)e(soft)o(w)o(are)f(design)j (pro)q(cess)f(fundamen)o(tally)h(in\015uenced)37 973 y(the)d(approac)o(h)f (I)g(to)q(ok)g(in)h(m)o(y)f(w)o(ork.)22 b(Prof.)g(Sam)16 b(Kamin)h(pro)o(vide\ d)g(v)m(aluable)h(insigh)o(ts)f(regarding)f(data)37 1029 y(\015o)o(w)f(analys\ is.)21 b(I)15 b(also)h(thank)f(Prof.)k(Genev)m(a)c(Belford)h(and)g(Prof.)j (Larry)c(Jones)g(for)g(their)h(input.)108 1086 y(I)k(o)o(w)o(e)g(thanks)g(to) f(man)o(y)h(others)f(who)h(w)o(ere)g(at)f(the)h(Univ)o(ersit)o(y)h(of)f(Illin\ ois)j(during)e(m)o(y)e(graduate)37 1142 y(program.)29 b(Prof.)g(Mehdi)19 b (Harandi)g(and)g(Prof.)28 b(Ro)o(y)19 b(Campb)q(ell)h(pro)o(vided)f(helpful)h (guidance)g(early)f(in)37 1199 y(m)o(y)c(graduate)f(studies.)21 b(During)15 b (m)o(y)g(early)g(researc)o(h,)g(P)o(eter)f(Madan)o(y)h(pro)o(vided)h(in)o(v)m (aluable)h(input)f(from)37 1255 y(his)f(w)o(ork)e(on)h(the)g fi(Choic)n(es)e fl(\014le)j(system)f(framew)o(ork.)k(Vince)d(Russo)f(w)o(as)f(helpful)j(in)e (p)q(oin)o(ting)h(me)f(to)o(w)o(ard)37 1312 y(P)o(eter.)19 b(Mic)o(k)12 b(Mur\ ph)o(y)g(protot)o(yp)q(ed)f(a)h(fron)o(t)f(end)h(to)f(m)o(y)h(refactoring)f (protot)o(yp)q(e.)18 b(Stev)o(e)12 b(Marc)o(h)g(pro)o(vided)37 1368 y(exp)q (ert)k(help)h(in)f(mac)o(hine)g(administration)g(of)e(m)o(y)h(w)o(orkstation.) 108 1424 y(Brian)21 b(F)l(o)q(ote)f(w)o(as)f(helpful)k(at)d(sev)o(eral)g(stag\ es)g(of)g(m)o(y)g(researc)o(h.)35 b(Early)20 b(on,)h(he)g(shared)g(with)f(me) 37 1481 y(what)c(it)g(w)o(as)f(lik)o(e)h(to)g(w)o(ork)e(with)i(Ralph)h(Johnso\ n.)22 b(Later,)16 b(he)g(w)o(as)f(a)g(go)q(o)q(d)h(sounding)g(b)q(oard)g(for) f(ideas.)37 1537 y(Throughout,)g(he)g(shared)h(m)o(y)e(liking)j(for)e(m)o(ush\ ro)q(om)g(pizza.)108 1594 y(I)24 b(also)f(o)o(w)o(e)f(thanks)h(to)f(sev)o(era\ l)h(curren)o(t)g(and)h(former)e(mem)o(b)q(ers)h(of)g(A)l(T&T)g(Bell)i(Lab)q (oratories.)37 1650 y(P)o(aul)14 b(Zislis,)g(m)o(y)f(former)f(departmen)o(t)g (head)i(at)e(Bell)j(Labs,)e(w)o(as)f(instrumen)o(tal)h(in)h(m)o(y)f(b)q(eing) h(selected)g(for)37 1707 y(A)l(T&T's)g(full-time)h(do)q(ctoral)e(supp)q(ort)g (program.)18 b(I)c(hold)g(in)g(highest)g(regard)f(his)h(p)q(ersonal)g(in)o (tegrit)o(y)f(and)37 1763 y(concern)19 b(for)d(his)j(sta\013.)25 b(W)l(arren) 18 b(Mon)o(tgomery)d(serv)o(ed)j(at)f(v)m(arious)h(times)g(as)f(sup)q(ervisor) h(and)g(men)o(tor.)37 1820 y(Early)i(on,)g(he)g(pro)o(vided)g(helpful)h(advic\ e)f(as)f(I)h(considered)h(sev)o(eral)e(p)q(ossible)i(researc)o(h)e(topics.)33 b(Later,)37 1876 y(he)20 b(pro)o(vided)g(w)o(ords)e(of)h(encouragemen)o(t)g (during)h(di\016cult)h(stages)d(of)h(m)o(y)f(researc)o(h.)32 b(Mo)q(o)q(dy)19 b(Ahmad,)37 1933 y(John)j(Degan,)f(Mo)q(e)g(Grzelak)o(o)o(wski)f(and)h(Jac)o (k)g(W)l(ang)f(also)h(pro)o(vided)h(managemen)o(t)e(supp)q(ort)h(for)f(m)o (y)37 1989 y(w)o(ork.)108 2045 y(I)i(thank)g(Bjarne)g(Stroustrup)g(for)f(his) i(encouragemen)o(t)f(of)f(m)o(y)h(pursuing)h(this)f(area)f(of)h(researc)o(h.) 37 2102 y(Jim)17 b(V)l(andendorp)q(e,)f(Dew)o(a)o(yne)f(P)o(erry)g(and)g(Jim) h(Coplien)h(review)o(ed)g(parts)d(of)h(m)o(y)g(thesis.)21 b(Larry)15 b(Ma)o (yk)m(a)37 2158 y(pro)o(vided)h(exp)q(ert)g(advice)g(in)g(using)g(Common)f (LISP)h(for)e(m)o(y)h(protot)o(yping.)108 2215 y(A)o(t)e(Drexel)h(Univ)o(ersi\ t)o(y)l(,)g(Prof.)k(James)c(Maginnis)g(spark)o(ed)f(m)o(y)g(in)o(terest)g(in) h(man)o(y)f(areas)g(of)g(computer)37 2271 y(science.)29 b(A)o(t)17 b(the)h (Univ)o(ersit)o(y)g(of)f(Wisconsin,)i(Prof.)26 b(Randy)18 b(Katz)g(spark)o (ed)f(m)o(y)g(in)o(terest)h(in)h(computer)37 2328 y(science)e(researc)o(h.) 108 2384 y(I)k(thank)f(those)f(man)o(y)h(others)g(not)f(named)i(here)f(who)g (pro)o(vided)h(encouragemen)o(t)f(and)g(assistance)37 2441 y(during)d(m)o(y)d (graduate)h(studies.)108 2497 y(I)g(thank)g(m)o(y)f(paren)o(ts)g(for)g(their) h(supp)q(ort.)20 b(I)15 b(esp)q(ecially)i(appreciated)f(m)o(y)e(father's)g (w)o(ords)g(of)g(encour-)37 2554 y(agemen)o(t,)e(and)h(his)g(abilit)o(y)h(to) d(put)i(to)q(da)o(y's)e(`crises')h(in)h(p)q(ersp)q(ectiv)o(e.)21 b(I)13 b(tha\ nk)f(m)o(y)g(Aun)o(t)g(Nancy)g(for)g(b)q(eing)37 2610 y(an)k(example)g(to)e (me.)963 2760 y(v)g eop bop 108 42 a fl(I)17 b(am)g(esp)q(ecially)j(thankful) d(to)f(m)o(y)h(wife)h(Brenda)f(and)g(our)g(c)o(hildren.)27 b(When)17 b(I)h (b)q(egan)f(m)o(y)f(do)q(ctoral)37 98 y(program,)h(I)h(w)o(as)e(32)h(y)o(ears) g(old,)h(married,)f(and)h(the)f(father)g(of)g(sev)o(eral)h(presc)o(ho)q(ol)g (aged)f(c)o(hildren.)28 b(The)37 154 y(transition)16 b(to)f(graduate)f(sc)o (ho)q(ol)i(w)o(as)e(an)h(adjustmen)o(t)g(for)f(all)i(of)f(us.)108 211 y(I)d (thank)g(m)o(y)f(c)o(hildren)j(Da)o(vid,)e(Andrew,)g(Jamie)h(and)f(Daniel)h (for)e(man)o(y)g(encouraging)i(times)f(together,)37 267 y(and)k(for)e(lo)o (ving)i(me)g(more)e(for)h(who)g(I)g(am)g(than)g(for)g(what)f(I'v)o(e)i(done.) 108 324 y(I)j(am)g(esp)q(ecially)i(thankful)f(to)e(m)o(y)g(wife)h(Brenda)h (for)e(her)h(supp)q(ort)g(during)g(m)o(y)g(graduate)f(studies.)37 380 y(Witho\ ut)i(her,)g(I)f(nev)o(er)g(w)o(ould)h(ha)o(v)o(e)f(made)g(it)g(through)g(the) g(program.)31 b(As)19 b(a)g(wife)h(and)f(mother,)g(she)37 437 y(pic)o(k)o(ed) 14 b(up)g(the)f(slac)o(k)g(and)g(encouraged)g(me)g(in)h(an)f(extraordinary)f (w)o(a)o(y)l(.)19 b(She)13 b(deserv)o(es)g(an)g(a)o(w)o(ard)f(at)g(least)37 493 y(as)j(v)m(aluable)i(as)e(m)o(y)g(PhD.)108 550 y(Finally)l(,)g(I)f(am)g (thankful)g(to)f(Go)q(d)h(for)f(ha)o(ving)h(gran)o(ted)f(me)g(the)h(skills)i (and)e(opp)q(ortunities)g(that)f(made)37 606 y(this)j(p)q(ossible.)957 2760 y (vi)g eop bop 728 374 a fd(T)-6 b(able)22 b(of)h(Con)n(ten)n(ts)37 596 y fh (Chapter)37 698 y(1)43 b(In)o(tro)q(duction)i fk(:)22 b(:)g(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)96 b fl(1)106 754 y (1.1)45 b(The)16 b(Problem)37 b fk(:)23 b(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)60 b fl(1)106 811 y(1.2)45 b(A)15 b(Prop)q (osed)h(Solution)28 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)h(:)60 b fl(1)106 867 y(1.3)45 b(Con)o(tributions)24 b fk(:)f(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)60 b fl(5)37 969 y fh(2)43 b(Motiv)m(ation)k fk(:)23 b(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)96 b fl(6)106 1026 y(2.1)45 b(Bac) o(kground:)20 b(Soft)o(w)o(are)14 b(Reuse)45 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)60 b fl(6)106 1082 y(2.2)45 b(Bac)o(kground:)20 b(Soft)o(w)o (are)14 b(Restructuring)29 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)60 b fl(7)106 1139 y(2.3)45 b(Ob)s(ject-Orien)o(ted)17 b(Programming,)d(Reuse)i(and)f(Restructur\ ing)h fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)60 b fl(8) 37 1241 y fh(3)43 b(Refactoring)19 b(Application)g(F)l(ramew)o(orks)g fk(:)j (:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)73 b fl(12)106 1297 y(3.1)45 b(Ob)s(ject-Orien)o(ted)17 b(Appl\ ication)g(F)l(ramew)o(orks)39 b fk(:)22 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(12)106 1353 y(3.2)45 b (Refactoring)16 b(T)l(o)f(Generalize:)21 b(Creating)15 b(An)g(Abstract)g(Sup) q(erclass)46 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(13)106 1410 y(3.3)45 b(Refactoring)16 b(T)l(o)f(Sp)q(ecialize:)23 b(Sub)q(classing) 17 b(and)e(Simplifying)j(Conditionals)35 b fk(:)23 b(:)f(:)g(:)h(:)f(:)h(:)37 b fl(15)106 1466 y(3.4)45 b(Capturing)16 b(Aggregations)e(and)h(Comp)q(onen)o (ts)36 b fk(:)22 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(17)106 1523 y(3.5)45 b(Supp)q(orting)16 b (Refactorings)28 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(22)106 1579 y(3.6)45 b(Language)15 b(F)l(eatures)g(in)h(Refactoring)h fk (:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(24)106 1636 y(3.7)45 b(Summary:)20 b(Imp)q(ortance)15 b(&)h(Complexit)o(y)g(of)e(Refactoring)35 b fk(:)23 b(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(25)37 1738 y fh (4)43 b(Preserving)16 b(Beha)o(vior)h(During)h(Refactoring)43 b fk(:)22 b(:)h (:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)73 b fl(26)106 1794 y(4.1)45 b(Program)14 b(Prop)q(erties)i(and)f(Beha)o(vior)g (Preserv)m(ation)36 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(26)106 1851 y(4.2)45 b(Domains)15 b(of)g (Refactorings)23 b fk(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (30)106 1907 y(4.3)45 b(F)l(unctions)16 b(F)l(or)f(Describing)h(Preconditions) 45 b fk(:)22 b(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(32)106 1963 y(4.4)45 b(Summary)37 b fk(:) 22 b(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)h(:)37 b fl(37)37 2065 y fh(5)43 b(Lo)o(w-Lev)o(el)17 b(Refactorings)46 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)73 b fl(38)106 2122 y (5.1)45 b(Creating)15 b(a)g(Program)f(En)o(tit)o(y)42 b fk(:)23 b(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(39)106 2178 y(5.2)45 b(Deleting)16 b(a)f (Program)f(En)o(tit)o(y)f fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)37 b fl(41)106 2235 y(5.3)45 b(Changing)16 b(a)f(Program)e(En)o(tit)o(y)25 b fk(:)e(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(42)106 2291 y(5.4)45 b (Mo)o(ving)15 b(a)g(Mem)o(b)q(er)g(V)l(ariable)39 b fk(:)23 b(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)37 b fl(51)106 2348 y(5.5)45 b(Comp)q(osite)15 b(Refac\ torings)38 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (52)37 2450 y fh(6)43 b(Refactoring)19 b(T)l(o)e(Generalize:)24 b(Creating)18 b(an)g(Abstract)g(Sup)q(erclass)11 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)73 b fl(56)106 2506 y(6.1)45 b(Creating)15 b(a)g(Common)g(Sup)q(erclass)27 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(58)106 2562 y(6.2)45 b(Mak\ ing)15 b(F)l(unction)h(Signatures)g(Compatible)23 b fk(:)f(:)g(:)h(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (59)950 2760 y(vii)g eop bop 106 42 a fl(6.3)45 b(Adding)17 b(F)l(unction)f (Signatures)f(to)g(the)g(Sup)q(erclass)i(Proto)q(col)d fk(:)22 b(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(63)106 98 y(6.4)45 b(Makin\ g)15 b(F)l(unction)h(Bo)q(dies)h(Compatible)27 b fk(:)22 b(:)h(:)f(:)g(:)h (:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)37 b fl(64)106 154 y(6.5)45 b(Making)15 b(V)l(ariables)i(Compatible)26 b fk (:)c(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(66)106 211 y(6.6)45 b(Migratin\ g)15 b(V)l(ariables)i(to)d(the)h(Sup)q(erclass)46 b fk(:)23 b(:)f(:)g(:)h(:)f (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(67)106 267 y(6.7)45 b(Migrating)15 b(Common)g(Co)q(de)g(to)g(the)g(Abstr\ act)f(Sup)q(erclass)26 b fk(:)d(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)37 b fl(67)106 324 y(6.8)45 b(Discussion)22 b fk(:)g(:)g(:)h (:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (69)37 426 y fh(7)43 b(Refactoring)19 b(T)l(o)e(Sp)q(ecialize:)26 b(Sub)q(cla\ ssing,)18 b(and)g(Simplifying)h(Conditionals)29 b fk(:)23 b(:)f(:)73 b fl(71) 106 482 y(7.1)45 b(Motiv)m(ation)h fk(:)22 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(71)106 539 y(7.2)45 b(Clas\ s)15 b(In)o(v)m(arian)o(ts)j fk(:)k(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(72)106 595 y(7.3)45 b(Bac)o(kground:)20 b (Data)14 b(Flo)o(w)h(Analysis)26 b fk(:)d(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (74)106 652 y(7.4)45 b(Chec)o(king)16 b(Whether)f(a)g(Predicate)h(is)g(a)f (Class)g(In)o(v)m(arian)o(t)33 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(76)106 708 y(7.5)45 b(Refactoring:)20 b (Create)15 b(Sub)q(classes)i(and)e(Assign)h(In)o(v)m(arian)o(ts)e fk(:)23 b (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(77)106 764 y(7.6)45 b(Using)16 b(A)f(Class)g(In)o(v)m(arian)o(t)h(T)l(o)f(Simplify)i(A)e (Conditional)24 b fk(:)e(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)h(:)37 b fl(79)106 821 y(7.7)45 b(Refactoring:)20 b(Migrate)15 b(&)g (Simplify)j(Conditionals)23 b fk(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(80)106 877 y(7.8)45 b(Using)16 b (A)f(Class)g(In)o(v)m(arian)o(t)h(T)l(o)f(Sp)q(ecialize)j(Expressions)e(That) f(Create)f(Instances)43 b fk(:)23 b(:)f(:)h(:)37 b fl(81)106 934 y(7.9)45 b (Refactoring:)20 b(Sp)q(ecialize)f(Expressions)c(That)g(Create)g(Instances)20 b fk(:)j(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(82)106 990 y (7.10)22 b(Discussion)g fk(:)g(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(83)37 1092 y fh(8)43 b(Refactoring) 19 b(T)l(o)e(Capture)h(Aggregations)g(&)f(Comp)q(onen)o(ts)27 b fk(:)22 b(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)73 b fl(86)106 1149 y(8.1)45 b(Mot\ iv)m(ation)h fk(:)22 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)37 b fl(86)106 1205 y(8.2)45 b(Chec)o(king)16 b(If)g (A)f(V)l(ariable)h(Quali\014es)h(As)f(A)f(Comp)q(onen)o(t)36 b fk(:)22 b(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(87)106 1262 y(8.3)45 b(Adding)17 b(A)e(Mem)o(b)q(er)g(V)l(ariable)h(T)l(o)f(The)h(Set)f (Of)g(Comp)q(onen)o(t)g(V)l(ariables)28 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h(:)f (:)h(:)37 b fl(91)106 1318 y(8.4)45 b(Remo)o(ving)16 b(A)f(Mem)o(b)q(er)g(V)l (ariable)i(F)l(rom)d(The)i(Set)f(Of)g(Comp)q(onen)o(t)g(V)l(ariables)29 b fk (:)22 b(:)g(:)h(:)f(:)h(:)37 b fl(92)106 1374 y(8.5)45 b(Mo)o(ving)15 b(Mem)o (b)q(ers)g(in)o(to)g(a)g(Comp)q(onen)o(t)g(\(P)o(oin)o(ter)g(to)f(Aggregate)g (Stored)h(in)h(Comp)q(onen)o(t\))29 b(92)106 1431 y(8.6)45 b(Mo)o(ving)15 b (Mem)o(b)q(ers)g(in)o(to)g(a)g(Comp)q(onen)o(t)g(\(Aggregate)f(P)o(assed)h (as)g(F)l(unction)h(Argumen)o(t\))26 b fk(:)37 b fl(97)106 1487 y(8.7)45 b (Mo)o(ving)15 b(Mem)o(b)q(ers)g(in)o(to)g(Aggregate\(s\))h fk(:)22 b(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)37 b fl(99)106 1544 y(8.8)45 b(Discussion:)21 b(Comp)q(onen)o (ts)15 b(and)h(Refactoring)f(\(Revisited\))22 b fk(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(102)106 1600 y(8.9)45 b(Con)o (v)o(erting)15 b(an)g(Asso)q(ciation,)h(Mo)q(deled)g(Using)g(Inheritance,)g (in)o(to)f(an)g(Aggregation)23 b fk(:)f(:)h(:)14 b fl(103)106 1657 y(8.10)22 b (Discussion)g fk(:)g(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)14 b fl(106)37 1759 y fh(9)43 b(Examples)f fk(:)22 b (:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)50 b fl(108)106 1815 y(9.1)45 b(Generalizing)17 b(&)f(Sp)q(ecializin)q (g:)22 b(Men)o(u)15 b(Planning)i(Example)40 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(108)106 1872 y(9.2)45 b(Con)o(v)o (erting)15 b(to)f(an)i(Aggregation:)j(Matrix)14 b(Example)19 b fk(:)k(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(112) 106 1928 y(9.3)45 b(Summary)37 b fk(:)22 b(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(116)37 2030 y fh(10)j (Related)i(Approac)o(hes)12 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)50 b fl(118)106 2086 y(10.1)22 b(CR)o(C)15 b(Approac)o (h)g(to)g(Designing)h(Ob)s(ject-Orien)o(ted)h(Systems)27 b fk(:)22 b(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(118)106 2143 y(10.2)22 b(Designing)16 b(Reusable)h(Classes)37 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)14 b fl(119)106 2199 y(10.3)22 b(Ac)o(hieving)17 b(Go)q(o)q (d)e(St)o(yle)h(in)g(Smalltalk)g(Programs)38 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(119)106 2256 y (10.4)22 b(Demeter)15 b(Pro)s(ject)38 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(119)106 2312 y(10.5)22 b(Reorganiz\ ing)17 b(Generic)f(Applications:)22 b(Ithaca)16 b fk(:)22 b(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl (121)106 2369 y(10.6)22 b(Managing)15 b(Sc)o(hema)g(Ev)o(olution)h(in)g(an)f (OODB)27 b fk(:)22 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(122)106 2425 y(10.7)22 b(Program)14 b(T)l (ransformations)33 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(123)106 2482 y(10.8)22 b(Summary)37 b fk(:)22 b(:)g(:)h(:)f(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(124)944 2760 y (viii)g eop bop 37 42 a fh(11)17 b(Conclusions)26 b fk(:)d(:)f(:)g(:)h(:)f (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)50 b fl(125) 106 98 y(11.1)22 b(Summary)15 b(of)g(Con)o(tributions)f fk(:)22 b(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(125)106 154 y(11.2)22 b(Limitations)17 b(of)d(Approac)o(h)24 b fk(:)e(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h (:)14 b fl(125)106 211 y(11.3)22 b(Implemen)o(tation)17 b(Considerations)30 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(126)106 267 y(11.4)22 b(Other) 16 b(Areas)f(for)f(F)l(uture)h(Researc)o(h)35 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f (:)h(:)14 b fl(131)106 324 y(11.5)22 b(Summary)37 b fk(:)22 b(:)g(:)h(:)f(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(131)37 465 y fh(Bibliograph)o(y)38 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)50 b fl(134)37 567 y fh(Vita) 19 b fk(:)j(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)50 b fl(142)957 2760 y(ix)g eop bop 776 374 a fd(List)22 b(of)i(Figures)106 596 y fl(3.1)45 b(Creating)15 b(An)h (Abstract)e(Sup)q(erclass)32 b fk(:)23 b(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (14)106 653 y(3.2)45 b(Simplifying)18 b(Mem)o(b)q(er)d(F)l(unction)h fi(optim\ ize)j fk(:)k(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(18)106 709 y(3.3)45 b(Sup)q(erclass)17 b (Con)o(v)o(erted)d(to)h(Comp)q(onen)o(t)32 b fk(:)22 b(:)h(:)f(:)g(:)h(:)f (:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(21)106 807 y(4.1)45 b(Erroneous)15 b(Renaming)h(Of)g(Mem)o(b)q(er)f(F)l (unction)h(F2)i fk(:)k(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)h(:)37 b fl(27)106 905 y(6.1)45 b(Refactoring)16 b(The)f (F)l(unction)h fi(mapUnit)23 b fk(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(57)106 961 y(6.2)45 b(De\014ning)16 b(the)g(Sup)q(erclass)g(Proto)q(col)37 b fk(:)23 b (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g (:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl(61)106 1059 y(7.1)45 b(Simplifying)18 b (Mem)o(b)q(er)d(F)l(unction)h fi(optimize)j fk(:)k(:)f(:)g(:)h(:)f(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)37 b fl (74)106 1157 y(8.1)45 b(Class)15 b ff(GraphicalObject)j fl(and)d(its)h(Sub)q (classes)33 b fk(:)22 b(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h (:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(103)106 1214 y(8.2)45 b ff(Graphic\ alObject)18 b fl(and)d ff(ArchitecturalObject)p fl(,)j(After)d(Refactoring)27 b fk(:)c(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(103)106 1270 y (8.3)45 b(Migrating)15 b(Mem)o(b)q(ers)g(Bet)o(w)o(een)g(Aggregate)g(and)g (Comp)q(onen)o(t)g(Classes)44 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(107)106 1368 y(9.1)45 b(Inheritance)17 b(Relationship)h(Bet)o(w)o(een)d (Classes)g ff(Tw)o(oDim)o(ensionalArra)o(y)d fl(and)k ff(Matrix)48 b fk(:)22 b (:)h(:)14 b fl(113)106 1466 y(11.1)22 b(Soft)o(w)o(are)14 b(Refactoring)h(Pro) q(cess)38 b fk(:)22 b(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f (:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)14 b fl(133)963 2760 y (x)g eop bop 37 353 a fc(Chapter)35 b(1)37 560 y fb(In)m(tro)s(duction)37 801 y fd(1.1)70 b(The)23 b(Problem)37 903 y fl(Design)15 b(is)f(hard.)20 b(The)14 b(design)h(of)f(reusable)h(soft)o(w)o(are)d(is)j(esp)q(ecially)h(hard.)k(Reus\ able)15 b(soft)o(w)o(are)e(usually)i(is)37 959 y(the)g(result)f(of)g(man)o (y)f(design)i(iterations.)20 b(Some)14 b(of)g(these)g(iterations)g(o)q(ccur)h (after)e(the)h(soft)o(w)o(are)e(has)i(b)q(een)37 1016 y(reused,)k(and)e(the)h (resulting)g(c)o(hanges)g(a\013ect)f(not)g(only)h(the)g(design)g(of)f(the)h (reusable)g(soft)o(w)o(are,)e(but)h(also)37 1072 y(the)d(design)f(of)g(other) f(soft)o(w)o(are)g(that)g(is)h(using)h(it.)19 b(Making)12 b(soft)o(w)o(are)e (easier)i(to)g(c)o(hange)f(mak)o(es)h(subsequen)o(t)37 1128 y(design)17 b(ite\ rations)e(easier,)g(and)h(mak)o(es)e(the)i(soft)o(w)o(are)d(more)i(reusable.) 108 1185 y(Although)k(there)f(ha)o(v)o(e)f(b)q(een)i(no)f(scien)o(ti\014c)i (studies)e(that)g(v)m(alidate)h(the)f(claim,)h(it)f(is)h(nonetheless)g(a)37 1241 y(strongly)g(held)h(conclusion)h(among)e(man)o(y)f(practitioners)i(that) e(ob)s(ject-orien)o(ted)h(soft)o(w)o(are)e(is)j(easier)f(to)37 1298 y(c)o(han\ ge)c(than)e(con)o(v)o(en)o(tional)i(soft)o(w)o(are)d([79)o(].)19 b(Some)14 b (c)o(hanges)g(to)f(ob)s(ject-orien)o(ted)h(soft)o(w)o(are)f(can)h(b)q(e)g(mad\ e)37 1354 y(simply)i(b)o(y)d(adding)i(new)f(sub)q(classes)h(or)e(b)o(y)h(addi\ ng)h(new)f(op)q(erations)g(on)f(existing)i(classes,)f(while)i(lea)o(ving)37 1411 y(most)f(of)g(the)g(original)h(soft)o(w)o(are)e(unc)o(hanged.)108 1467 y (Ho)o(w)o(ev)o(er,)i(ob)s(ject-orien)o(ted)h(soft)o(w)o(are)e(is)j(harder)f (to)f(c)o(hange)h(than)g(it)g(migh)o(t)g(at)f(\014rst)h(app)q(ear)g(to)f(b)q (e.)37 1524 y(Changing)h(an)g(ob)s(ject-orien)o(ted)g(system)f(often)g(requir\ es)i(c)o(hanging)f(the)f(abstractions)h(em)o(b)q(o)q(died)h(in)f fi(ex-)37 1580 y(isting)12 b fl(ob)s(ject)g(classes)h(and)g(the)g(relationships)h(among) e(those)h(classes.)19 b(This)14 b(in)o(v)o(olv)o(es)f(structural)f(c)o(hanges) 37 1637 y(suc)o(h)20 b(as)e(mo)o(ving)h(v)m(ariables)h(and)f(functions)h(b)q (et)o(w)o(een)f(classes)g(and)h(partitioning)f(a)g(complicated)h(class)37 1693 y(in)o(to)13 b(sev)o(eral)g(classes.)19 b(When)13 b(a)g(structural)f(c)o(hang\ e)h(is)g(made)f(to)g(a)h(class)g(or)f(set)g(of)g(classes,)h(corresp)q(onding) 37 1749 y(c)o(hanges)18 b(ma)o(y)f(also)h(b)q(e)g(needed)h(elsewhere)g(in)f (a)g(program,)e(due)j(to)e(naming,)h(t)o(yping)g(and)f(scoping)i(\(in-)37 1806 y(heritance\))f(dep)q(endencies.)27 b(T)l(rac)o(king)16 b(do)o(wn)h(the)f(dep) q(endencies)k(b)o(y)c(hand)h(and)g(consisten)o(tly)g(up)q(dating)37 1862 y (the)f(program)e(can)h(b)q(e)h(time)g(consuming,)f(di\016cult)i(and)e(error)g (prone.)108 1919 y(The)i(reusabilit)o(y)g(b)q(ene\014ts)g(of)f(ob)s(ject-orie\ n)o(ted)h(programming)e(can)i(b)q(e)g(di\016cult)g(to)f(realize)h(without)37 1975 y(some)e(form)g(of)g(automated)f(supp)q(ort)h(for)g(making)g(these)h(str\ uctural)f(c)o(hanges)g([59)o(,)g(98)o(].)37 2118 y fd(1.2)70 b(A)23 b(Prop)r (osed)h(Solution)37 2220 y fl(This)16 b(dissertation)g(describ)q(es)h(an)e (approac)o(h)f(for)h(pro)o(viding)h(automated)e(supp)q(ort)i(for)e(the)h(rest\ ructuring)37 2276 y(of)g(ob)s(ject-orien)o(ted)h(programs.)108 2333 y(P)o(eop\ le)e(usually)g(think)f(ab)q(out)g(soft)o(w)o(are)e(c)o(hanges)i(either)g(at)f (a)h(high)h(lev)o(el,)g(in)g(terms)e(of)g(features)h(to)f(b)q(e)37 2389 y(add\ ed)17 b(to)e(a)h(system,)f(or)g(at)g(a)g(lo)o(w)h(lev)o(el,)h(in)g(terms)e (of)g(lines)j(of)d(co)q(de)h(to)f(b)q(e)i(c)o(hanged.)22 b fi(R)n(efactorings) 15 b fl(are)37 2446 y(reorganization)h(plans)h(that)e(supp)q(ort)i(c)o(hange) f(at)f(an)h(in)o(termediate)h(lev)o(el.)23 b(Consider,)16 b(for)g(example,)g (the)37 2502 y(refactoring)g(that)f(mo)o(v)o(es)g(a)g(mem)o(b)q(er)h(function) h(from)e(one)h(class)g(to)f(another.)21 b(The)16 b(reason)g(for)f(applying)37 2559 y(this)j(refactoring)f(migh)o(t)g(b)q(e)h(to)f(supp)q(ort)g(a)g(new)g (feature)g(in)h(the)g(system,)f(whic)o(h)h(will)h(b)q(e)f(implemen)o(ted)964 2760 y(1)g eop bop 37 42 a fl(using)20 b(a)d(class)i(for)f(whic)o(h)h(the)f (mem)o(b)q(er)h(function)g(is)g(needed.)30 b(This)19 b(refactoring)f(maps)g (in)o(to)g(lo)o(w)g(lev)o(el)37 98 y(c)o(hanges)d(not)f(only)g(in)h(these)g (t)o(w)o(o)e(classes)h(but)h(p)q(ossibly)h(also)e(in)h(other)f(classes)g(that) g(in)o(v)o(ok)o(e)g(the)g(mem)o(b)q(er)37 154 y(function.)108 211 y(Refactori\ ngs)f(do)g(not)f(c)o(hange)h(the)g(b)q(eha)o(vior)h(of)e(a)h(program;)f(that) g(is,)h(if)h(the)f(program)e(is)j(called)g(t)o(wice)37 267 y(\(b)q(efore)i (and)h(after)e(a)h(refactoring\))f(with)h(the)g(same)g(set)g(of)f(inputs,)i (the)f(resulting)h(set)f(of)g(output)f(v)m(alues)37 324 y(will)20 b(b)q(e)e (the)g(same.)27 b(Refactorings)18 b(are)g(b)q(eha)o(vior)g(preserving)g(so)g (that,)f(when)h(their)h(preconditions)g(are)37 380 y(met,)c(they)g(do)g(not)g (\\break")g(the)g(program.)108 437 y(While)22 b(refactorings)d(do)h(not)g(c)o (hange)g(the)g(b)q(eha)o(vior)h(of)f(a)g(program,)g(they)g(can)g(supp)q(ort)g (soft)o(w)o(are)37 493 y(design)12 b(and)f(ev)o(olution)g(b)o(y)g(restructuri\ ng)f(a)h(program)e(in)j(the)e(w)o(a)o(y)g(that)g(allo)o(ws)g(other)h(c)o(hang\ es)f(to)g(b)q(e)h(made)37 550 y(more)18 b(easily)l(.)30 b(Complicated)19 b (c)o(hanges)f(to)f(a)h(program)f(can)h(require)h(b)q(oth)f(refactorings)g(and) g(additions.)37 606 y(F)l(or)c(example,)h(a)e(new)i(feature)e(migh)o(t)h(b)q (e)h(added)g(to)e(a)h(program)f(b)o(y)h(\014rst)f(refactoring)h(part)f(of)h (a)g(complex)37 663 y(class)i(in)o(to)f(a)g(comp)q(onen)o(t)g(class,)h(and)f (then)h(using)f(the)h(comp)q(onen)o(t)f(class)h(in)g(de\014ning)g(the)g(new)f (feature.)108 719 y(There)h(are)e(sev)o(eral)i(cases)f(where)g(refactorings)g (migh)o(t)g(b)q(e)h(applied)h([85)o(]:)93 813 y(1.)22 b fi(Extr)n(acting)17 b (a)g(r)n(eusable)f(c)n(omp)n(onent.)21 b fl(F)l(or)15 b(example,)i(an)f(indus\ trial)h(pro)q(cess)f(con)o(trol)g(system)f(had)151 869 y(serv)o(ed)e(user)h (needs)g(w)o(ell)g(for)f(sev)o(eral)g(y)o(ears.)19 b(Customers)12 b(require)i (a)f(new)h(pro)q(duct)f(to)g(supp)q(ort)g(new)151 926 y(pro)q(cess)18 b(appro\ ac)o(hes,)f(but)h(with)g(a)f(user)h(in)o(terface)f(that)g(is)h(compatible)h (with)f(the)f(older)h(system.)151 982 y(When)12 b(the)f(older)h(system)f(w)o (as)f(originally)j(designed)f(and)g(implemen)o(ted,)h(it)f(w)o(as)e(factored) h(suc)o(h)g(that)151 1039 y(the)19 b(user)f(in)o(terface)h(functions)g(w)o (ere)f(in)o(terw)o(o)o(v)o(en)f(with)i(other,)f(obsolete)h(functions.)30 b (Extracting)151 1095 y(the)15 b(user)h(in)o(terface)f(comp)q(onen)o(t)h(\014r\ st)e(requires)i(refactoring)f(the)g(existing)i(soft)o(w)o(are.)93 1189 y(2.) 22 b fi(Impr)n(oving)c(c)n(onsistency)g(among)h(c)n(omp)n(onents.)28 b fl(F)l (or)17 b(example,)j(t)o(w)o(o)c(comp)q(onen)o(ts)j(of)e(a)h(soft)o(w)o(are) 151 1245 y(system)j(are)f(implemen)o(ted)j(b)o(y)e(di\013eren)o(t)g(pro)s(jec\ t)f(mem)o(b)q(ers.)37 b(While)23 b(these)e(comp)q(onen)o(ts)g(w)o(ere)151 1302 y(initially)g(though)o(t)d(to)f(b)q(e)i(distinct,)h(it)e(w)o(as)g(later)g(dis\ co)o(v)o(ered)h(that)e(they)h(shared)h(a)f(common)f(ab-)151 1358 y(straction.) 25 b(T)l(o)17 b(mak)o(e)f(the)h(design)h(of)f(the)g(system)g(easier)g(to)f (understand,)i(and)f(to)g(reduce)g(future)151 1415 y(main)o(tenance)g(costs,) f(it)h(is)f(desirable)i(to)e(refactor)g(the)g(system)g(to)g(mak)o(e)g(more)g (explicit)i(the)f(com-)151 1471 y(monalities)g(b)q(et)o(w)o(een)e(the)g(t)o (w)o(o)f(comp)q(onen)o(ts.)93 1565 y(3.)22 b fi(Supp)n(orting)15 b(the)g(iter) n(ative)g(design)g(of)g(an)g(Obje)n(ct-Oriente)n(d)f(Applic)n(ation)g(F)m(r)n (amework.)20 b fl(An)14 b(ob)s(ject-)151 1621 y(orien)o(ted)k(application)h (framew)o(ork)e(is)h(an)f(abstract)g(design)i(of)e(an)g(application,)j(consis\ ting)e(of)g(an)151 1678 y(abstract)c(class)g(for)g(eac)o(h)h(ma)s(jor)e(comp) q(onen)o(t.)20 b(It)14 b(is)h(an)g(imp)q(ortan)o(t)f(ob)s(ject-orien)o(ted)g (tec)o(hnique)i(to)151 1734 y(facilitate)f(design-lev)o(el)i(reuse)d([127)o (].)19 b(Go)q(o)q(d)14 b(framew)o(orks)e(are)i(usually)h(the)f(result)g(of)g (man)o(y)g(design)151 1791 y(iterations)i(and)f(a)g(lot)g(of)g(hard)g(w)o(ork\ ,)f(in)o(v)o(olving)i(structural)f(c)o(hanges.)151 1866 y(F)l(or)j(example,)i (the)f(application)i(framew)o(ork)c(for)h(managing)h(\014les)g(in)h(an)f(op)q (erating)f(system)h([77)o(])151 1922 y(b)q(egan)i(as)g(an)f(implemen)o(tation) j(of)d(only)h(one)g(\014le)h(format.)35 b(Then,)23 b(it)e(w)o(as)f(to)g(b)q (e)h(extended)h(to)151 1979 y(handle)h(additional)g(\014le)f(formats.)37 b (Unfortunately)l(,)23 b(in)g(the)e(initial)j(implemen)o(tation)e(the)g(more) 151 2035 y(general,)e(common)e(abstractions)g(w)o(ere)g(in)o(tert)o(wined)h (with)g(features)f(sp)q(eci\014c)j(to)d(the)g(\014le)i(format)151 2092 y(supp) q(orted.)i(Refactoring)17 b(w)o(as)e(necessary)h(to)f(separate)g(out)g(the)h (common)g(abstractions)f(in)i(order)151 2148 y(to)e(impro)o(v)o(e)g(the)g(des\ ign)h(of)f(the)g(framew)o(ork)f(and)h(facilitate)i(reuse.)108 2242 y(The)i (researc)o(h)f(describ)q(ed)i(here)f(fo)q(cused)g(on)g(the)f(third)h(area;)g (namely)l(,)h(in)f(ho)o(w)f(these)h(refactorings)37 2298 y(can)j(supp)q(ort)g (the)g(iterativ)o(e)g(design)g(of)g(ob)s(ject-orien)o(ted)f(application)j(fra\ mew)o(orks.)38 b(The)21 b(other)h(t)o(w)o(o)37 2355 y(areas)13 b(are)h(co)o (v)o(ered)f(as)g(w)o(ell,)i(since)g(as)e(a)g(framew)o(ork)f(matures)h(reusabl\ e)i(comp)q(onen)o(ts)f(are)f(extracted)g(and)37 2411 y(consistency)k(among)d (comp)q(onen)o(ts)h(is)h(impro)o(v)o(ed.)108 2468 y(There)h(are)g(sev)o(eral) g(reasons)g(wh)o(y)f(this)i(researc)o(h)e(has)h(fo)q(cuses)h(on)e(refactoring) h fi(obje)n(ct-oriente)n(d)g fl(sys-)37 2524 y(tems:)964 2760 y(2)g eop bop 93 42 a fl(1.)22 b(Compared)17 b(with)g(more)g(traditional)h(soft)o(w)o(are)d (dev)o(elopmen)o(t)j(approac)o(hes,)f(ob)s(ject-orien)o(ted)h(pro-)151 98 y (gramming)e(mak)o(es)h(refactoring)f fi(mor)n(e)i(fe)n(asible)d fl(b)o(y)i (making)g(more)f(explicit)j(the)d(structural)h(infor-)151 154 y(mation)e(need\ ed)i(to)d(refactor)g(a)h(program.)93 248 y(2.)22 b(Refactoring)16 b(is)g fi (esp)n(e)n(cial)r(ly)g(imp)n(ortant)g fl(in)h(ob)s(ject-orien)o(ted)f(program\ ming.)21 b(Some)15 b(in)i(the)f(ob)s(ject-)151 305 y(orien)o(ted)i(programmin\ g)e(culture)i(ha)o(v)o(e)f(placed)h(high)g(v)m(alue)g(in)g(designing)g(and)g (redesigning)g(soft-)151 361 y(w)o(are)j(to)f(mak)o(e)h(it)g(more)g(reusable) h([59)o(,)f(98)o(].)38 b(In)22 b(some)f(cases,)h(the)f(b)q(est)h(w)o(a)o(y)e (to)g(impro)o(v)o(e)h(the)151 418 y(design)15 b(of)e(a)g(program)f(is)i(to)f (re-write)h(it.)19 b(In)14 b(other)f(cases,)h(restructuring)f(a)h(program)e (\(rather)h(than)151 474 y(rewriting)j(it\))f(ma)o(y)f(b)q(e)i(a)f(more)g(pra\ ctical)h(w)o(a)o(y)e(to)h(impro)o(v)o(e)g(its)g(design.)37 596 y fe(1.2.1)56 b (Dealing)17 b(With)i(the)f(Complexitie)o(s)e(of)j(Refactoring)37 682 y fl(The\ re)d(are)f(sev)o(eral)g(asp)q(ects)h(that)e(mak)o(e)h(refactoring)f(ob)s(ject\ -orien)o(ted)i(framew)o(orks)d(di\016cult:)93 775 y(1.)22 b(There)f(is)h(no)f (theory)f(\(i.e.)38 b(systematically)22 b(organized)f(explanation\))h(of)e (ho)o(w)h(p)q(eople)h(refactor)151 832 y(ob)s(ject-orien)o(ted)15 b(applicati\ on)i(framew)o(orks)d(and)h(the)h(kinds)g(of)f(refactorings)f(they)i(mak)o(e.) 93 926 y(2.)22 b(Some)15 b(refactoring)f(op)q(erations)g(require)h(design)h (insigh)o(ts)f(that)e(are)h(hard)h(to)f(obtain)g(b)o(y)g(insp)q(ecting)151 982 y(the)h(program)f(to)h(b)q(e)h(refactored.)93 1076 y(3.)22 b(Tw)o(o)16 b(\(co\ n\015icting\))i(ob)s(jectiv)o(es)f(of)f(a)h(set)f(of)h(refactorings)f(are)h (that)f(they)h(b)q(e)h(b)q(oth)f(b)q(eha)o(vior)g(pre-)151 1132 y(serving)12 b (and)g(expressiv)o(e.)19 b(They)12 b(should)h(b)q(e)f(p)q(o)o(w)o(erful)g(eno\ ugh)g(to)f(handle)i(the)e(imp)q(ortan)o(t)h(program)151 1189 y(restructuring) 17 b(tasks)g(at)f(a)h(lev)o(el)i(that)d(shields)j(the)e(user)g(from)g(most)f (of)h(the)g(complexit)o(y)l(.)27 b(A)o(t)16 b(the)151 1245 y(same)j(time,)g (they)g(should)h(b)q(e)f(restrictiv)o(e)g(enough)h(to)e(preserv)o(e)h(the)f (b)q(eha)o(vior)i(of)e(the)h(program.)151 1302 y(In)14 b(shielding)j(complexi\ t)o(y)d(from)f(the)h(user,)g(the)g(refactorings)f(themselv)o(es)h(b)q(ecome)h (more)e(complex.)151 1358 y(These)22 b(complexities,)i(and)d(the)g(limitation\ s)h(in)g(inferring)g(design)g(in)o(ten)o(t,)h(mak)o(e)d(it)i(di\016cult)g(to) 151 1415 y(ensure)16 b(that)e(the)i(in)o(tended)g(b)q(eha)o(vior)g(is)g(prese\ rv)o(ed.)108 1508 y(A)d(to)q(ol)g(that)f(pro)o(vides)h(automated)e(supp)q(ort) i(for)f(refactoring)h(should)g(guaran)o(tee)f(that)g(its)h(op)q(erations)37 1565 y(preserv)o(e)g(the)g(b)q(eha)o(vior)h(of)e(a)g(program.)18 b(One)c(of)e (the)h(reasons)g(wh)o(y)f(programs)g(are)g(not)h(refactored)f(is)h(that)37 1621 y(an)o(y)g(c)o(hange)g(to)f(the)h(program)f(runs)h(the)g(risk)g(of)g(in) o(tro)q(ducing)h(defects)f(in)o(to)g(the)g(program.)18 b(An)13 b(imp)q(ortan) o(t)37 1678 y(fo)q(cus)i(of)e(this)i(thesis)f(is)h(on)f(ho)o(w)g(to)f(tell)i (whether)f(a)g(refactoring)g(can)g(b)q(e)g(applied)i(to)e(a)g(program)e(witho\ ut)37 1734 y(c)o(hanging)17 b(the)f(program's)e(b)q(eha)o(vior.)23 b(A)16 b (ma)s(jor)f(motiv)m(ation)h(for)f(automating)g(refactoring)h(is)h(to)e(ensure) 37 1791 y(that)g(defects)g(are)g(not)g(in)o(tro)q(duced)i(in)o(to)e(a)g(progr\ am.)108 1847 y(A)d(refactoring)g(that)g(can)g(b)q(e)h(applied)h(safely)e(to)g (a)g(program)f(will)j(not)e(necessarily)h(impro)o(v)o(e)f(its)h(design.)37 1904 y(On)e(the)g(con)o(trary)l(,)f(applying)i(arbitrary)e(refactorings)g(to) g(a)g(program)f(is)i(more)f(lik)o(ely)i(to)e(corrupt)g(the)h(design)37 1960 y (rather)17 b(than)h(impro)o(v)o(e)f(it,)h(ev)o(en)g(though)g(the)f(b)q(eha)o (vior)i(of)e(the)g(program)g(is)h(preserv)o(ed.)27 b(A)18 b(refactoring)37 2017 y(impro)o(v)o(es)h(design)g(if)g(the)f(resultan)o(t)g(co)q(de)h(units)g (corresp)q(ond)f(to)g(meaningful)i(abstractions)d(that)h(mak)o(e)37 2073 y (it)h(easier)g(to)e(re\014ne)i(or)e(extend)i(the)f(program.)28 b(What)18 b (abstractions)f(are)h(meaningful)i(dep)q(ends)f(on)f(the)37 2129 y(applicatio\ n)13 b(and)e(on)f(the)h(designer.)19 b(This)12 b(implies)g(that)e(refactoring) g(tasks,)h(esp)q(ecially)i(the)e(most)f(complex)37 2186 y(tasks,)19 b(require) h(some)e(in)o(teraction)i(with)f(the)g(designer.)32 b(A)19 b(refactoring)f (to)q(ol)h(can)g(help)h(a)f(designer)h(b)o(y)37 2242 y(pro)o(viding)13 b(the) f(righ)o(t)g(set)f(of)g(refactorings,)h(and)g(b)o(y)g(ensuring)g(that)f(eac)o (h)h(refactoring)g(is)g(applied)h(correctly)l(,)37 2299 y(but)23 b(it)g(canno\ t)g(decide)h(whic)o(h)g(refactorings)e(to)g(apply)l(.)43 b(Th)o(us,)24 b(refa\ ctoring)e(cannot)h(b)q(e)g(completely)37 2355 y(automated.)108 2412 y(T)l(o) 17 b(understand)i(ho)o(w)e(p)q(eople)i(refactor)d(programs,)h(related)h(resea\ rc)o(h)f([9,)g(30)o(,)h(59)o(,)f(71,)g(98)o(])h(w)o(as)e(sur-)37 2468 y(v)o (ey)o(ed,)22 b(and)e(an)h(analysis)g(w)o(as)f(done)g(of)g(the)h(structural)f (c)o(hanges)g(made)h(to)f(the)g fi(Choic)n(es)f fl(\014le)j(system)37 2525 y (framew)o(ork)13 b([77)o(])g(o)o(v)o(er)f(a)h(t)o(w)o(o)g(y)o(ear)g(p)q(erio) q(d.)20 b(The)14 b fi(Choic)n(es)e fl(\014le)j(system)e(framew)o(ork)f(w)o (as)h(dev)o(elop)q(ed)i(using)964 2760 y(3)g eop bop 37 42 a fl(the)16 b fi (C++)e fl(programming)h(language)g([114)o(].)20 b(Based)15 b(on)g(that)g(anal\ ysis,)g(the)h(follo)o(wing)g(set)f(of)f(eigh)o(t)i(basic)37 98 y(refactorings) f(w)o(as)g(compiled)i([85)o(]:)648 81 y fs(1)93 185 y fl(1.)22 b(de\014ning) 17 b(an)e(abstract)f(sup)q(erclass)i(of)f(one)h(or)e(more)h(existing)h(classe\ s)93 277 y(2.)22 b(sp)q(ecializin)q(g)17 b(a)e(class)g(b)o(y)g(de\014ning)i (sub)q(classes,)e(and)g(using)h(sub)q(classing)h(to)d(eliminate)j(conditional) 151 333 y(tests)93 424 y(3.)22 b(c)o(hanging)17 b(ho)o(w)f(the)h(whole/part)g (asso)q(ciation)g(b)q(et)o(w)o(een)g(classes)g(is)g(mo)q(deled,)h(from)e(usin\ g)i(inheri-)151 481 y(tance)d(to)g(using)h(an)f(instance)h(hierarc)o(h)o(y)f (of)g(aggregates)f(and)h(their)h(comp)q(onen)o(ts)93 572 y(4.)22 b(mo)o(ving) 15 b(a)g(class)h(within)g(and)f(among)g(inheritance)i(hierarc)o(hies)93 663 y (5.)22 b(mo)o(ving)15 b(mem)o(b)q(er)h(v)m(ariables)g(and)f(functions)93 754 y (6.)22 b(replacing)17 b(a)e(co)q(de)g(segmen)o(t)g(with)h(a)f(function)h(call) 93 846 y(7.)22 b(c)o(hanging)16 b(the)f(names)g(of)g(classes,)g(v)m(ariables) i(and)e(functions)93 937 y(8.)22 b(replacing)17 b(unrestricted)f(access)f(to) g(mem)o(b)q(er)g(v)m(ariables)i(with)e(a)g(more)g(abstract)f(in)o(terface)108 1024 y(T)l(o)g(someone)g(in)o(terested)h(in)g(adding)g(new)f(features)g(to)f (an)i(ob)s(ject-orien)o(ted)f(program,)f(some)g(of)h(these)37 1081 y(refactor\ ings)k(ma)o(y)f(seem)h(lo)o(w)g(lev)o(el)h(and)f(not)g(particularly)h(di\016c\ ult;)h(ho)o(w)o(ev)o(er,)e(these)g(refactorings)f(re-)37 1137 y(quire)i(atten) o(tion)e(to)g(man)o(y)h(details)h(regarding)e(the)h(in)o(terrelationships)i (of)d(parts)g(of)h(a)f(program.)26 b(Some)37 1194 y(of)17 b(these)h(refactori\ ngs)e(emplo)o(y)i(other,)f(more)g(primitiv)o(e)h(refactorings.)26 b(F)l(or)16 b(example,)i(de\014ning)h(an)e(ab-)37 1250 y(stract)11 b(sup)q(erclass)i(ma)o (y)e(in)o(v)o(olv)o(e)i(c)o(hanging)f(the)g(name)g(of)g(mem)o(b)q(ers)g(\(v)m (ariables)g(and)g(functions\),)h(splitting)37 1307 y(functions)k(and)g(migrat\ ing)f(common)f(mem)o(b)q(ers)i(to)e(the)h(sup)q(erclass.)24 b(In)17 b(order)e (to)h(b)q(etter)g(deal)h(with)f(the)37 1363 y(complexit)o(y)h(of)d(the)i(refa\ ctoring)e(pro)q(cess,)h(the)h(refactorings)e(w)o(ere)h(organized)h(in)o(to:) 106 1450 y fj(\017)22 b fl(a)d(set)h(of)f(t)o(w)o(en)o(t)o(y)f(six)i fi(low-l\ evel)f fl(refactorings,)h(suc)o(h)g(as)f(renaming)h(a)f(mem)o(b)q(er)h(v)m (ariable.)34 b(These)151 1507 y(refactorings)15 b(are)g(de\014ned)h(in)g(c)o (hapter)f(\014v)o(e.)106 1598 y fj(\017)22 b fl(a)10 b(set)g(of)g(three)g(mor\ e)g(abstract,)g fi(high-level)f fl(refactorings:)17 b(de\014ning)12 b(an)e (abstract)f(sup)q(erclass,)j(simpli-)151 1655 y(fying)f(conditional)i(stateme\ n)o(ts)c(with)i(sub)q(classing,)i(and)e(sev)o(eral)g(comp)q(onen)o(t-related) g(refactorings.)151 1711 y(These)16 b(refactorings)e(are)h(detailed)i(in)f (c)o(hapters)f(six)h(through)f(eigh)o(t.)108 1798 y(The)k(lo)o(w-lev)o(el)h (refactorings)e(are)g(simple)i(enough)f(that)f(in)h(most)f(cases)g(it)h(is)g (trivial)g(to)f(sho)o(w)g(that)37 1855 y(they)g(are)g(b)q(eha)o(vior-preservi\ ng.)28 b(While)19 b(most)e(of)h(these)g(lo)o(w-lev)o(el)h(op)q(erations)e(ha) o(v)o(e)h(little)h(theoretical)37 1911 y(di\016cult)o(y)l(,)h(their)e(impleme\ n)o(tation)h(can)f(b)q(e)h(complicated.)29 b(The)18 b(high-lev)o(el)i(refacto\ rings)d(are)h(more)f(ex-)37 1968 y(pressiv)o(e)k(and)g(theoretically)g(in)o (teresting)g(refactorings.)35 b(They)20 b(are)g(constructed)h(using)g(the)f (lo)o(w-lev)o(el)37 2024 y(refactorings.)37 2145 y fe(1.2.2)56 b(Represen)n (ting)17 b(Design)h(In)n(ten)n(t)37 2231 y fl(Some)e(of)e(the)h(more)g(p)q (o)o(w)o(erful)g(refactorings)g(require)h(an)f(explicit)i(represen)o(tation)e (of)g(design)h(in)o(ten)o(t.)k(F)l(or)37 2287 y(example,)h(if)f(a)f(class)h (is)g(to)f(b)q(e)h(sp)q(ecialized)j(b)o(y)c(de\014ning)i(new)f(sub)q(classes,) h(deciding)g(what)e(sub)q(classes)37 2344 y(should)e(b)q(e)f(added)g(dep)q (ends)h(on)f(the)g(meaningful)g(sp)q(ecializations)j(for)14 b(that)h(applicat\ ion.)23 b(Tw)o(o)14 b(kinds)j(of)37 2400 y(design)g(information)e(are)g(neede\ d)h(for)f(some)g(of)g(the)g(high-lev)o(el)i(refactorings:)37 2476 y 750 2 v 89 2503 a fu(1)107 2519 y fp(The)h(refactorings)i(are)f(describ)q(ed)i(using)f (C++)e(terms)h(suc)o(h)g(as)g fm(memb)n(er)g(variable)d fp(and)k fm(memb)n (er)f(function)p fp(,)d(whic)o(h)37 2564 y(corresp)q(ond)21 b(to)e(the)g(Smal\ ltalk-80)571 2551 y fw(TM)637 2564 y fp([49])g(terms)g fm(instanc)n(e)d(varia\ ble)h fp(and)i fm(metho)n(d)p fp(.)33 b(Smalltalk-80)22 b(is)e(a)f(trademark) h(of)37 2610 y(P)o(arcPlace)15 b(Systems.)964 2760 y fl(4)g eop bop 93 42 a fl (1.)22 b(a)c fi(class)f(invariant)p fl(,)h(whic)o(h)h(is)f(a)f(predicate,)i (de\014ned)h(on)d(the)h(v)m(alues)h(of)f(mem)o(b)q(er)g(v)m(ariables,)h(that) 151 98 y(is)i(true)f(for)g(the)h(lifetime)h(of)e(an)g(instance)h(of)f(the)h (class.)36 b(Chapter)20 b(sev)o(en)g(de\014nes)i(refactorings)151 154 y(for) 16 b(simplifying)i(a)e(class)h(b)o(y)f(de\014ning)i(sub)q(classes.)25 b(In)16 b(mem)o(b)q(er)h(functions)g(of)f(the)g(newly)h(created)151 211 y(sub)q(class\ es,)f(class)g(in)o(v)m(arian)o(ts)f(are)g(used)h(in)g(simplifying)i(condition\ al)f(statemen)o(ts.)93 297 y(2.)22 b(a)c fi(list)g(of)g(c)n(omp)n(onent)g(mem\ b)n(er)h(variables)p fl(,)e(whic)o(h)i(is)f(a)g(subset)g(of)f(the)h(list)h (of)e(mem)o(b)q(er)h(v)m(ariables)151 353 y(de\014ned)h(in)g(a)e(class.)28 b (Comp)q(onen)o(t)17 b(mem)o(b)q(er)h(v)m(ariables)h(mo)q(del)g(a)e(sp)q(ecial) j fi(is-p)n(art-of)e fl(relationship)151 410 y(with)c(the)g(class)g(that)f (con)o(tains)h(them,)g(referred)g(to)f(as)g(an)h fi(aggr)n(e)n(gate)f fl(clas\ s.)20 b(Chapter)13 b(eigh)o(t)h(de\014nes)151 466 y(refactorings)h(that)f(in) o(v)o(olv)o(e)i(comp)q(onen)o(ts)f(and)g(the)g(aggregate)f(classes)h(that)f (con)o(tain)i(them.)j(Some)151 523 y(of)d(these)h(refactorings)f(require)h (that)f(the)g(comp)q(onen)o(ts)h(b)q(e)g fi(exclusive)p fl(,)f(that)f(is,)i (that)f(they)h(not)f(b)q(e)151 579 y(shared)f(among)g(m)o(ultiple)i(aggregate) d(ob)s(jects.)108 654 y(This)f(design)h(in)o(ten)o(t)e(is)h(not)f(made)h(expl\ icit)h(\(or)e(enforced\))g(in)i(a)e(language)h(suc)o(h)f(as)g(C++;)i(th)o(us,) e(a)g(sys-)37 710 y(tem)i(for)e(supp)q(orting)i(refactorings)f(m)o(ust)g(b)q (e)h(able)g(to)f(certify)h(class)f(in)o(v)m(arian)o(ts)h(and)g(lists)g(of)f (comp)q(onen)o(ts.)37 767 y(In)i(general,)g(it)f(is)h(undecidable)i(whether)e (a)f(predicate)h(is)g(a)f(class)g(in)o(v)m(arian)o(t)h(or)f(whether)g(a)g(mem) o(b)q(er)h(v)m(ari-)37 823 y(able)h(is)f(a)f(comp)q(onen)o(t.)20 b(Since)c (refactorings)e(m)o(ust)h(b)q(e)g(b)q(eha)o(vior)g(preserving,)g(it)g(is)g (b)q(etter)g(to)f(mistak)o(enly)37 880 y(decide)g(that)d(a)g(predicate)i(is)f (not)g(a)f(class)h(in)o(v)m(arian)o(t)g(\(and)g(so)f(not)h(b)q(e)g(able)h(to) e(p)q(erform)g(a)h(legal)g(refactoring\))37 936 y(than)k(it)h(is)f(to)g(mista\ k)o(enly)h(decide)g(that)f(a)g(predicate)h(is)f(a)g(class)h(in)o(v)m(arian)o (t)f(and)h(ev)o(en)o(tually)g(p)q(erform)f(an)37 993 y(illegal)i(refactoring.) j(Th)o(us,)15 b(a)g(system)g(for)g(supp)q(orting)h(refactorings)f(will)j(use) d(conserv)m(ativ)o(e)i(algorithms)37 1049 y(for)d(deciding)i(whether)f(a)f (predicate)h(is)g(a)f(class)g(in)o(v)m(arian)o(t)h(or)f(a)g(mem)o(b)q(er)g (v)m(ariable)i(is)f(a)f(comp)q(onen)o(t.)19 b(The)37 1106 y(thesis)14 b(will) h(describ)q(e)g(some)d(conserv)m(ativ)o(e)i(algorithms)f(for)f(b)q(oth)h(prob\ lems)h(that)e(are)h(based)g(on)g(data-\015o)o(w)37 1162 y(analysis.)37 1302 y fd(1.3)70 b(Con)n(tributions)37 1403 y fl(The)16 b(ma)s(jor)e(con)o(tribution\ s)i(of)e(this)i(researc)o(h)f(are:)93 1478 y(1.)22 b(It)d(iden)o(ti\014es)i (a)e(set)f(of)h(program)f(restructurings)h(\(refactorings\))f(that)g(p)q(eopl\ e)j(apply)e(to)g(ob)s(ject-)151 1534 y(orien)o(ted)d(application)h(framew)o (orks.)93 1620 y(2.)22 b(It)16 b(sho)o(ws)f(ho)o(w)g(to)f(automatically)i(sup\ p)q(ort)g(refactorings)f(in)h(a)g(w)o(a)o(y)e(that)h(preserv)o(es)g(the)h(b)q (eha)o(vior)151 1677 y(of)f(a)g(program.)93 1763 y(3.)22 b(It)15 b(de\014nes) i(in)f(detail)g(three)f(of)g(the)g(most)g(complex)h(refactorings.)93 1849 y (4.)22 b(It)15 b(de\014nes)h(design)f(constrain)o(ts)g(needed)h(in)f(refactor\ ing,)f(sp)q(eci\014cally)k(class)d(in)o(v)m(arian)o(ts)g(and)g(exclu-)151 1906 y(siv)o(e)h(comp)q(onen)o(ts.)108 1980 y(The)g(researc)o(h)f(describ)q(ed)i (here)f(could)h(serv)o(e)e(as)g(the)g(basis)h(for)f(a)g fi(softwar)n(e)i(r)n (efactory)e fl([85].)20 b(Whereas)37 2037 y(past)c(researc)o(h)f(in)o(to)h (a)f fi(softwar)n(e)h(factory)h fl(\(for)d(example,)i([110)o(]\))f(has)g(fo)q (cused)i(on)e(generating)h(a)f(soft)o(w)o(are)37 2093 y(program)10 b(from)g (sp)q(eci\014cations,)j(this)f(researc)o(h)e(has)h(fo)q(cused)g(on)g(ho)o(w)f (to)h(restructure)f(an)h(existing)h(program)37 2150 y(to)i(mak)o(e)f(it)h(eas\ ier)h(to)e(understand,)h(c)o(hange)g(and)h(reuse.)k(Before)14 b(a)g(practical) h(soft)o(w)o(are)d(refactory)h(can)h(b)q(e)37 2206 y(realized,)k(ho)o(w)o(ev) o(er,)e(sev)o(eral)g(additional)i(researc)o(h)e(issues)h(need)g(to)f(b)q(e)h (addressed,)f(as)g(noted)h(in)g(c)o(hapter)37 2262 y(elev)o(en.)108 2319 y (The)12 b(next)h(t)o(w)o(o)d(c)o(hapters)i(presen)o(t)g(the)g(motiv)m(ation)h (for)e(restructuring)h(ob)s(ject-orien)o(ted)g(systems,)g(and)37 2375 y(descr\ ib)q(e)19 b(the)f(refactoring)e(approac)o(h.)26 b(Chapter)17 b(four)f(describ) q(es)j(sev)o(eral)f(issues)g(related)f(to)g(preserving)37 2432 y(b)q(eha)o (vior)k(during)g(refactoring.)34 b(Chapter)19 b(\014v)o(e)i(describ)q(es)g (the)f(lo)o(w-lev)o(el)i(refactorings.)33 b(Chapters)20 b(six)37 2488 y(throu\ gh)d(eigh)o(t)f(describ)q(e)j(the)d(three)h(highest)g(lev)o(el)h(refactorings\ ,)e(whic)o(h)h(are)g(the)f(most)g(expressiv)o(e)h(and)37 2545 y(most)k(algori\ thmically)i(complex.)38 b(The)22 b(\014nal)g(three)f(c)o(hapters)g(pro)o(vide) g(extended)i(examples,)g(surv)o(ey)37 2601 y(closely)14 b(related)f(w)o(ork,) e(brie\015y)j(discuss)f(an)f(implemen)o(tation)i(of)e(the)g(approac)o(h)g(and) h(presen)o(t)f(conclusions.)964 2760 y(5)g eop bop 37 353 a fc(Chapter)35 b (2)37 560 y fb(Motiv)-7 b(ation)37 783 y fl(A)16 b(soft)o(w)o(are)e(pro)s(jec\ t)h(\\is)h(capable)g(of)g(b)q(ecoming)g(a)g(monster)f(of)g(missed)h(sc)o(hedu\ les,)h(blo)o(wn)f(budgets)g(and)37 839 y(\015a)o(w)o(ed)j(pro)q(ducts")f([24) o(].)30 b(One)19 b(approac)o(h)g(to)e(ac)o(hieving)j(meaningful)g(reductions) g(in)f(soft)o(w)o(are)e(costs)h(is)37 896 y(to)e(acquire)g(an)g(existing)h (soft)o(w)o(are)d(system)h(rather)h(than)f(dev)o(eloping)j(a)d(new)i(one.)22 b (Often,)16 b(ho)o(w)o(ev)o(er,)e(the)37 952 y(a)o(v)m(ailable)k(soft)o(w)o (are)c(systems)i(do)g(not)f(pro)o(vide)i(an)f(exact)g(\014t)f(for)h(the)g(pro\ blem)h(at)e(hand.)23 b(Soft)o(w)o(are)14 b(that)37 1009 y(solv)o(es)g(a)f fi (similar)g fl(problem)i(migh)o(t)e(b)q(e)h(a)o(v)m(ailable,)h(but)f(suc)o(h)g (soft)o(w)o(are)d(ma)o(y)i(need)i(to)d(b)q(e)j(c)o(hanged)e(in)i(some)37 1065 y(w)o(a)o(y)g(b)q(efore)g(it)h(can)f(b)q(e)h(reused.)k(These)c(c)o(hanges)f (ma)o(y)g(in)o(v)o(olv)o(e)g(restructuring)h(the)f(soft)o(w)o(are.)108 1122 y (Ob)s(ject-orien)o(ted)i(programming)e(is)h(often)f(touted)h(as)f(promoting)h (soft)o(w)o(are)e(reuse)i([45)o(].)21 b(Sometimes)37 1178 y(ho)o(w)o(ev)o(er) 15 b(the)g(b)q(ene\014ts)h(of)f(the)g(ob)s(ject-orien)o(ted)h(approac)o(h)e (are)h(o)o(v)o(erstated,)f(and)h(claims)h(are)f(made)g(that)37 1235 y(feature\ s)h(can)f(b)q(e)h(added)g(to)f(an)g(ob)s(ject-orien)o(ted)h(system)f(without) g(disturbing)i(the)e(existing)h(implemen-)37 1291 y(tation.)j(As)12 b(this)h (c)o(hapter)f(will)j(sho)o(w,)d(ob)s(ject-orien)o(ted)g(soft)o(w)o(are)f(ofte\ n)h(needs)h(to)f(b)q(e)h(restructured)f(b)q(efore)37 1347 y(it)k(can)f(b)q (e)h(reused.)37 1491 y fd(2.1)70 b(Bac)n(kground:)33 b(Soft)n(w)n(are)23 b (Reuse)37 1592 y fl(The)d(high)g(costs)e(of)h(dev)o(eloping)h(soft)o(w)o(are) e(motiv)m(ate)g(the)i(reuse)f(and)g(ev)o(olution)h(of)f(existing)h(soft)o(w)o (are.)37 1649 y(Soft)o(w)o(are)15 b(reuse)i(in)g(its)g(broadest)f(sense)g(in) o(v)o(olv)o(es)h(reapplying)h(kno)o(wledge)f(ab)q(out)f(one)g(soft)o(w)o(are) f(system)37 1705 y(to)e(reduce)i(the)e(e\013orts)g(of)g(dev)o(eloping)i(and)e (main)o(taining)i(another)e(system.)19 b(Closely)14 b(related)g(to)f(soft)o (w)o(are)37 1761 y(reuse)k(is)g(soft)o(w)o(are)e(main)o(tenance,)i(where)g (kno)o(wledge)g(ab)q(out)f(a)g(soft)o(w)o(are)f(system)h(is)h(used)g(to)e(dev) o(elop)j(a)37 1818 y(v)o(ersion)e(that)e(re\014nes)i(or)f(extends)h(it.)697 1801 y fs(1)108 1874 y fl(Approac)o(hes)e(that)g(supp)q(ort)g(reuse)g(address) h(one)f(or)f(more)h(of)g(the)g(follo)o(wing)h(four)f(imp)q(ortan)o(t)f(asp)q (ects)37 1931 y([19]:)93 2025 y(1.)22 b fi(\014nding)13 b fl(a)i(reusable)g (comp)q(onen)o(t.)20 b(This)15 b(is)h(usually)g(is)f(not)f(as)g(simple)i(as)e (\014nding)i(an)f(exact)f(matc)o(h,)151 2081 y(but)h(rather)g(in)o(v)o(olv)o (es)h(\014nding)g(the)g(most)e(similar)i(comp)q(onen)o(t.)93 2175 y(2.)22 b fi (understanding)d fl(the)g(comp)q(onen)o(t.)31 b(Understanding)20 b(what)f(a)g (comp)q(onen)o(t)g(do)q(es)g(is)h(imp)q(ortan)o(t)f(in)151 2231 y(order)c(to) g(use)g(it,)g(but)h(dev)o(eloping)g(that)f(men)o(tal)g(mo)q(del)h(is)g(di\016\ cult)h([24)o(,)d(88].)37 2315 y 750 2 v 89 2342 a fu(1)107 2358 y fp(Most)d (\(60%\))f(of)h(the)g(activities)i(analyzed)g(in)e(Osb)q(orne's)g(soft)o(w)o (are)g(main)o(tenance)i(study)e([80],)g(w)o(ere)f(found)h(neither)h(to)f(b)q (e)37 2403 y(correctiv)o(e)i(\(that)e(is,)h(diagnosing)i(and)e(\014xing)g(err\ ors\))g(nor)f(adaptiv)o(e)i(\(c)o(hanging)g(soft)o(w)o(are)e(to)g(w)o(ork)g (with)h(new)f(hardw)o(are)h(and)37 2449 y(p)q(eripherals\))18 b(but)e(rather) f(w)o(ere)g fm(p)n(erfe)n(ctive)e fp(activities,)k(where)f(pressure)g(w)o(as) f(brough)o(t)h(to)f(b)q(ear)h(on)f(dev)o(elop)q(ers)i(to)e(extend)37 2495 y (and)f(enhance)g(the)g(functionalit)o(y)i(of)c(a)h(system.)18 b(P)o(erfectiv) o(e)13 b(soft)o(w)o(are)g(main)o(tenance)i(is)f(closely)g(related)h(to)e(soft) o(w)o(are)f(reuse.)964 2760 y fl(6)g eop bop 93 42 a fl(3.)22 b fi(mo)n(difyi\ ng)15 b fl(a)g(comp)q(onen)o(t)g(or)f(a)h(set)g(of)g(comp)q(onen)o(ts.)20 b (Understanding)c(what)e(c)o(hanges)h(are)g(needed)151 98 y(has)20 b(pro)o(v)o (en)g(to)f(b)q(e)h(h)o(uman-in)o(tensiv)o(e)i(and)e(few)g(to)q(ols)f(ha)o(v)o (e)h(pro)o(v)o(en)g(v)o(ery)f(helpful.)36 b(As)20 b(will)i(b)q(e)151 154 y (sho)o(wn)15 b(b)q(elo)o(w,)g(these)h(mo)q(di\014cations)g(often)f(in)o(v)o (olv)o(e)h(restructuring.)93 246 y(4.)22 b fi(c)n(omp)n(osing)14 b fl(the)h (comp)q(onen)o(ts)g(together.)k(The)d(comp)q(osition)g(pro)q(cess)f(can)g(b)q (e)h(di\016cult,)g(esp)q(ecially)151 302 y(when)g(a)e(comp)q(onen)o(t)i(has)e (the)i(dual)f(purp)q(oses)h(of)f(b)q(eing)h(a)f(useful)h(indep)q(enden)o(t)h (en)o(tit)o(y)e(and)g(b)q(eing)151 359 y(used)h(to)e(create)h(other)g(comp)q (osite)h(structures.)108 447 y(While)e(some)f(soft)o(w)o(are)e(reuse)i(tec)o (hniques)h(ha)o(v)o(e)f(fo)q(cused)g(at)f(the)h(co)q(de)h(lev)o(el,)g(others) f(ha)o(v)o(e)f(fo)q(cused)i(on)37 503 y(design-lev)o(el)i(reuse.)k(There)13 b (are)g(limitations)h(on)g(the)f(reuse)g(of)g(co)q(de:)19 b(it)14 b(w)o(orks)e (b)q(est)h(when)h(the)f(domain)h(is)37 560 y(narro)o(w)e(and)g(w)o(ell)i(unde\ rsto)q(o)q(d)f(and)g(the)f(underlying)j(tec)o(hnology)d(is)h(v)o(ery)f(static\ .)19 b(Sometimes)13 b(the)g(design)37 616 y(of)i(soft)o(w)o(are)e(is)j(reusab\ le)g(ev)o(en)f(when)h(the)f(co)q(de)h(is)f(not.)20 b(Ho)o(w)o(ev)o(er,)14 b (a)g(ma)s(jor)g(problem)i(with)f(design-lev)o(el)37 673 y(reuse)h(is)g(that)e (there)i(is)f(no)g(w)o(ell-de\014ned)j(represen)o(tation)d(system)g(for)g(des\ ign.)108 729 y(Reuse)i(do)q(es)g(not)f(happ)q(en)h(b)o(y)f(acciden)o(t;)h(one) g(needs)g(to)e(plan)i(to)f(reuse)g(soft)o(w)o(are)f(and)h(lo)q(ok)h(for)e(sof\ t-)37 786 y(w)o(are)20 b(to)f(reuse.)34 b(Reuse)21 b(requires)f(the)g(righ)o (t)g(attitude,)g(to)q(ols)g(and)g(tec)o(hniques)h([59)o(,)f(117)o(].)33 b(T)l (o)q(ols)20 b(and)37 842 y(tec)o(hniques)f(to)e(supp)q(ort)h(soft)o(w)o(are)e (reuse)i(include)i(comp)q(ositional)f(and)f(generational)g(approac)o(hes)f ([18)o(].)37 899 y(The)d(comp)q(osition-based)h(mo)q(del)g(of)e(reuse)h(is)g (based)g(on)g(the)f(notion)h(of)f(plugging)i(comp)q(onen)o(ts)f(together,)37 955 y(with)j(little)g(or)e(no)h(mo)q(di\014cation)h(of)e(those)h(comp)q(onen) o(ts,)g(in)g(order)g(to)f(create)h(target)e(soft)o(w)o(are)g(systems.)37 1011 y(The)19 b(comp)q(onen)o(ts)f(migh)o(t)g(b)q(e)h(co)q(de)g(sk)o(eletons)f([32) o(,)g(68)o(],)g(subroutines)h([32)o(,)f(68)o(,)g(96])f(or)h(functions.)29 b (The)37 1068 y(generation-based)16 b(approac)o(h,)e(on)h(the)g(other)f(hand,) h(is)h(aimed)f(at)g(reusing)g(patterns)g(that)f(driv)o(e)h(the)g(cre-)37 1124 y(ation)k(of)f(sp)q(eci\014c)j(or)d(customized)i(v)o(ersions)f(of)f(themselv) o(es.)31 b(Application)21 b(generators)c([83])h(and)h(some)37 1181 y(program) c(transformation)e(systems)i([23)o(,)g(33)o(,)g(43,)f(83])h(are)g(examples)h (of)e(generation-based)i(systems.)108 1237 y(Soft)o(w)o(are)g(restructuring)i (relates)f(to)g(eac)o(h)h(of)f(the)g(four)g(imp)q(ortan)o(t)g(asp)q(ects)h (of)f(reuse)h(listed)g(ab)q(o)o(v)o(e.)37 1294 y(Restructuring)i(a)f(program) f(can)h(mak)o(e)f(it)i(easier)f(to)f fi(understand)h fl(the)g(design)h(of)f (a)f(program)g(and)h(can)37 1350 y(assist)12 b(in)h fi(\014nding)d fl(reusabl\ e)j(comp)q(onen)o(ts.)19 b(Some)11 b(restructurings)h fi(mo)n(dify)g fl(a)g (comp)q(onen)o(t)g(to)f(mak)o(e)g(it)h(more)37 1407 y(reusable;)k(suc)o(h)f (comp)q(onen)o(ts)f(can)h(b)q(e)g(easier)g(to)f fi(c)n(omp)n(ose)g fl(togethe\ r)g(for)g(an)h(application.)21 b(The)15 b(follo)o(wing)37 1463 y(section)h (discusses)h(soft)o(w)o(are)c(restructuring.)37 1605 y fd(2.2)70 b(Bac)n(kgro\ und:)33 b(Soft)n(w)n(are)23 b(Restructuring)37 1707 y fl(Soft)o(w)o(are)18 b (sometimes)h(needs)g(to)f(b)q(e)i(restructured)f(b)q(efore)g(it)g(is)g(reused\ .)31 b(Arnold)20 b([3)o(])e(de\014nes)i(soft)o(w)o(are)37 1763 y(restructurin\ g)f(as)f(\\the)h(mo)q(di\014cation)h(of)e(soft)o(w)o(are)f(to)h(mak)o(e)g(the) g(soft)o(w)o(are)f(\(1\))h(easier)h(to)f(understand)37 1820 y(and)e(to)e(c)o (hange)i(or)e(\(2\))h(less)g(susceptible)j(to)c(error)h(when)g(future)h(c)o (hanges)f(are)g(made.")108 1876 y(A)20 b(ma)s(jor)f(goal)h(of)g(soft)o(w)o (are)e(restructuring)j(is)g(to)e(preserv)o(e)i(or)e(increase)j(the)e(v)m(alue) h(of)f(a)g(piece)i(of)37 1933 y(soft)o(w)o(are.)28 b(Restructuring)20 b(a)e (system)g(ma)o(y)g(mak)o(e)g(it)g(p)q(ossible)i(to)e(add)h(more)f(features)g (to)g(the)g(existing)37 1989 y(system,)12 b(or)e(mak)o(e)h(the)g(soft)o(w)o (are)e(more)i(reusable)g(in)h(other)f(systems.)18 b(Soft)o(w)o(are)10 b(restr\ ucturing)h(approac)o(hes)37 2045 y(ha)o(v)o(e)k(b)q(ecome)i(increasingly)g (attractiv)o(e)d(as)h(the)h(cost)e(of)h(programmer)f(time)i(relativ)o(e)g(to) f(computer)g(time)37 2102 y(has)j(increased.)27 b(Soft)o(w)o(are)16 b(restruc\ turing)i(is)g(most)e(often)h(used)h(during)g(soft)o(w)o(are)e(main)o(tenance,) i(where)37 2158 y(the)i(lac)o(k)g(of)f(soft)o(w)o(are)e(structure)j(often)f (is)h(most)f(eviden)o(t)h(and)g(exp)q(ensiv)o(e.)34 b(Ho)o(w)o(ev)o(er,)19 b (it)h(can)f(also)h(b)q(e)37 2215 y(applied)e(in)e(the)f(earlier)h(design)g (and)g(dev)o(elopmen)o(t)f(phases.)108 2271 y(Soft)o(w)o(are)g(structure)i (can)f(b)q(e)i(broadly)f(de\014ned)h(as)e(a)g(collection)j(of)d(soft)o(w)o (are)f(attributes)h(that)g(mak)o(e)37 2328 y(sense)i(to)f(the)h(p)q(erceiv)o (er)g([3].)26 b(Since)18 b(programmers')e(p)q(erceptions)j(di\013er)f(from)e (eac)o(h)i(other,)f(and)g(a)h(pro-)37 2384 y(grammer's)c(p)q(erception)j(can) e(c)o(hange)g(o)o(v)o(er)g(time,)g(the)g(notion)h(of)e(soft)o(w)o(are)g(struc\ ture)h(is)g(dynamic.)108 2441 y(Man)o(y)j(factors)g(can)i(con)o(tribute)f(to) f(p)q(o)q(or)h(soft)o(w)o(are)f(structure.)31 b(These)19 b(factors)f(include) j(an)e(inade-)37 2497 y(quate)d(design)g(metho)q(dology)g([14)o(],)f(absence) h(of)f(dev)o(elopmen)o(t)h(and)g(main)o(tenance)g(standards)f([2],)g(buggy)37 2554 y(optimizations)j([113)o(])f(and)g(exp)q(edien)o(t)h(but)g(p)q(o)q(orly) f(conceiv)o(ed)h(c)o(hanges)f(made)g(to)g(the)g(soft)o(w)o(are)e(system)37 2610 y(to)g(re\015ect)h(c)o(hanges)f(in)h(the)f(en)o(vironmen)o(t)h(in)g(whic) o(h)g(it)f(op)q(erates)g([25)o(].)964 2760 y(7)g eop bop 108 42 a fl(W)l(ein) o(b)q(erg)12 b(in)f([123)o(])f(suggests)g(that)g(v)o(ery)h(small)g(c)o(hanges) g(to)f(a)h(soft)o(w)o(are)e(system)h(are)g(m)o(uc)o(h)h(more)f(prone)37 98 y (to)15 b(error)f(than)g(larger)h(c)o(hanges,)f(b)q(ecause)i(p)q(eople)g(tend) f(to)f(tak)o(e)g(v)o(ery)h(small)g(c)o(hanges)g(less)g(seriously)h(and)37 154 y(are)g(therefore)g(less)g(lik)o(ely)i(to)d(test)g(them)h(adequately)l(.)23 b (The)16 b(lo)o(w)o(er)f(lev)o(el)i(refactorings)f(describ)q(ed)h(in)g(this)37 211 y(thesis)f(are)e(examples)h(of)f(small)i(c)o(hanges)e(that)g(if)h(not)f (done)h(carefully)h(can)e(lead)i(to)e(errors)f(in)j(a)e(program.)108 267 y (Impro)o(ving)e(a)f(programmer's)f(p)q(erception)j(of)e(the)h(structure)f(of) g(a)h(soft)o(w)o(are)d(system)j(do)q(esn't)f(necessar-)37 324 y(ily)j(require) g(mo)q(difying)g(the)f(co)q(de.)19 b(Design)14 b(reco)o(v)o(ery)e(is)h(a)f (soft)o(w)o(are)f(reengineering)k(approac)o(h)d(that)g(recre-)37 380 y(ates)g (design)h(abstractions)f(from)g(a)f(collection)k(of)c(co)q(de,)i(existing)h (do)q(cumen)o(tation,)e(general)h(kno)o(wledge)g(of)37 437 y(the)i(domain)f (and)h(heuristic)g(reasoning)g([17)o(,)e(34].)19 b(Design)14 b(reco)o(v)o(ery) g(has)g(b)q(een)h(prop)q(osed)g(using)g(program)37 493 y(structures)k(\()p fi (cliches)p fl(\))f(and)h(graph)g(parsing)h([97)o(],)f(a)g(heuristic-based)i (concept-recognition)g(mec)o(hanism)37 550 y(with)d(m)o(ultiple)h(views)e(of) f(program)g(kno)o(wledge)i([55)o(],)e(and)i(an)e(approac)o(h)h(using)h(an)e (in)o(termediate)i(mo)q(d-)37 606 y(ular)h(in)o(terconnection)g(language)g (to)e(generate)h(design)h(descriptions)g([35)o(].)28 b(None)19 b(of)e(these)i (approac)o(hes)37 663 y(in)o(v)o(olv)o(e)13 b(co)q(de)f(c)o(hanges.)18 b(Also\ ,)12 b(they)g(do)f(not)g(directly)i(address)f(ho)o(w)f(to)f(c)o(hange)i(the)f (implemen)o(tation)i(once)37 719 y(the)k(existing)g(structure)f(is)g(understo) q(o)q(d;)h(although)f(clearly)i(the)e(kno)o(wledge)g(gathered)g(during)h(soft) o(w)o(are)37 775 y(reengineering)h(should)e(help)g(a)f(dev)o(elop)q(er)h(dete\ rmine)h(where)e(c)o(hanges)g(need)h(to)f(b)q(e)h(made.)108 832 y(Man)o(y)i (other)f(soft)o(w)o(are)g(restructuring)h(approac)o(hes)g(in)o(v)o(olv)o(e)h (co)q(de)g(c)o(hanges.)29 b(A)18 b(ma)s(jor)f(purp)q(ose)i(of)37 888 y(these) h(c)o(hanges)g(is)g(to)e(infuse)j(the)e(co)q(de)h(with)g(structure,)g(making) g(the)f(\015o)o(w)g(of)g(con)o(trol)g(in)h(a)g(program)37 945 y(more)e(explic\ it.)29 b(Approac)o(hes)18 b(ha)o(v)o(e)f(b)q(een)i(prop)q(osed)f(based)g(on)g (co)q(de)g(insp)q(ections)h(and)f(w)o(alk)g(throughs)37 1001 y([42,)j(47],)i (adherence)g(to)e(soft)o(w)o(are)f(metrics)i([11],)g(main)o(tainabilit)o(y)i (measures)e([26)o(])g(or)f(other)h(criteria)37 1058 y([29,)14 b(52)o(,)g(65,) g(68,)g(78)o(,)g(87,)g(88)o(,)h(90)o(,)f(112)o(].)20 b(Man)o(y)14 b(of)g(the) h(earliest)g(commercial)g(pro)q(ducts)g(in)h(this)f(area)f(w)o(ere)37 1114 y (dev)o(elop)q(ed)j(for)e(restructuring)g(COBOL)i(programs)d([75)o(,)g(82,)h (121)o(].)108 1171 y(Sev)o(eral)g(tec)o(hniques)g(ha)o(v)o(e)e(b)q(een)i(dev) o(elop)q(ed)h(based)e(on)g(structured)g(programming)g(guidelines;)i(these)37 1227 y(include)h(goto)d(elimination)i([4)o(,)f(20)o(,)f(128)o(],)g(case)g(sta\ temen)o(t)g(re\014nemen)o(t)h([73)o(])f(and)g(other)g(tec)o(hniques)i(\(e.g.,) 37 1284 y([29]\).)h(P)o(arnas)10 b([87)o(])g(giv)o(es)h(principles)j(for)c (partitioning)h(a)g(system)f(in)o(to)h(mo)q(dules)g(to)f(increase)i(its)f(mai\ n)o(tain-)37 1340 y(abilit)o(y)l(.)21 b(Ly)o(ons)12 b([75)o(])g(and)g(Morgan) f([82)o(])h(describ)q(e)i(to)q(ols)e(that)g(reduce)h(gotos,)e(remo)o(v)o(e)g (dead)i(\(unreac)o(hable\))37 1396 y(co)q(de,)g(con)o(v)o(ert)e(notes)h(to)f (commen)o(ts,)h(ph)o(ysically)h(group)f(I/O,)g(and)g(highligh)o(t)h(lo)q(opin\ g)g(conditions.)20 b(Other)37 1453 y(to)q(ols)c(to)e(supp)q(ort)h(soft)o(w)o (are)f(restructuring)h(include)j(prett)o(y)c(prin)o(ters)h(and)h(co)q(de)g (formatters,)d(in)o(tegrated)37 1509 y(programming)i(en)o(vironmen)o(ts)g([10\ ,)f(122])g(and)i(rule-based)g(program)e(transformation)g(systems)h([91)o(].) 108 1566 y(Soft)o(w)o(are)f(restructuring)h(con)o(tin)o(ues)h(to)e(b)q(e)i (an)f(imp)q(ortan)o(t)g(area)g(of)g(soft)o(w)o(are)e(engineering)k(researc)o (h.)37 1709 y fd(2.3)70 b(Ob)t(ject-Orien)n(ted)19 b(Programming,)j(Reuse)g (and)h(Restructuring)37 1810 y fl(Ob)s(ject-orien)o(ted)18 b(programming)d (is)i(often)g(touted)f(as)g(promoting)g(soft)o(w)o(are)f(reuse)h([45].)23 b (Ho)o(w)o(ev)o(er,)15 b(it)i(is)37 1867 y(not)i(a)f(panacea.)30 b(This)19 b (section)g(discusses)h(some)e(of)g(the)h(strengths)e(of)i(ob)s(ject-orien)o (ted)f(programming)37 1923 y(regarding)e(reuse,)f(and)g(some)g(of)g(its)g(lim\ itations.)37 2045 y fe(2.3.1)56 b(F)-5 b(eatures)18 b(of)h(Ob)s(ject-Orien)n (ted)e(Systems)g(That)i(Supp)r(ort)f(Reuse)37 2131 y fl(Most)d(ob)s(ject-orie\ n)o(ted)g(languages)h(com)o(bine)g(sev)o(eral)f(features)g(that)g(supp)q(ort) g(reuse:)21 b(data)14 b(abstraction,)37 2187 y(class)i(inheritance)h(and)e (p)q(olymorphism.)108 2244 y(Most)21 b(ob)s(ject-orien)o(ted)g(languages)h (pro)o(vide)g fi(data)h(abstr)n(action)e fl(using)h(classes.)39 b(Class)22 b (de\014nitions)37 2300 y(pro)o(vide)f(encapsulation)g(and)e(in)i(some)e(cases) g(pro)o(vide)h(information)g(hiding,)i(and)e(can)f(often)h(serv)o(e)f(as)37 2357 y(reusable)e(comp)q(onen)o(ts.)108 2413 y fi(Class)f(inheritanc)n(e)f fl (allo)o(ws)h(the)g(op)q(erations)g(and)g(p)q(ossibly)h(the)f(in)o(ternal)h (structure)f(of)g(a)f(class)h(to)g(b)q(e)37 2470 y(inherited)f(and)d(reused)h (b)o(y)f(its)h(sub)q(classes.)20 b(Inheritance)14 b(is)f(sometimes)f(used)h (to)f(represen)o(t)g(sp)q(ecialization)37 2526 y(hierarc)o(hies,)17 b(where)e (the)g(sub)q(classes)h(are)f(sp)q(ecializations)j(of)d(the)g(sup)q(erclass.) 21 b(Another)15 b(common)f(use)i(of)964 2760 y(8)g eop bop 37 42 a fl(inherit\ ance)18 b(is)e(to)f(supp)q(ort)h(programming)f(b)o(y)h(di\013erence;)h(one)f (w)o(a)o(y)e(to)h(reuse)h(the)g(existing)h(soft)o(w)o(are)d(is)37 98 y(to)h (create)g(a)g(sub)q(class)h(and)g(represen)o(t)f(the)g(di\013erences)h(in)g (the)g(newly)g(de\014ned)g(sub)q(class.)108 154 y fi(Polymorphism)i fl(is)h (another)f(p)q(o)o(w)o(erful)g(tec)o(hnique)h(of)f(ob)s(ject-orien)o(ted)g (languages.)28 b(P)o(olymorphism)37 211 y(is)15 b(the)f(notion)g(that)f(a)g (pro)q(cedure)i(can)f(b)q(e)g(in)o(v)o(ok)o(ed)g(on)g(an)f(ob)s(ject)h(withou\ t)f(kno)o(wing)h(its)g(exact)g(t)o(yp)q(e.)19 b(An)37 267 y(example)f(of)e (a)h(p)q(olymorphic)h(op)q(eration)f(is)g(an)f(op)q(eration)h(to)f(\014nd)i (the)e(maximal)h(elemen)o(t)h(in)f(an)g(arra)o(y)l(.)37 324 y(The)i(op)q(erat\ ion)g(could)g(b)q(e)h(de\014ned)f(in)h(the)e(arra)o(y)g(class)g(as)h(a)f(seri\ es)h(of)f(pairwise)h(comparisons)g(on)f(the)37 380 y(elemen)o(ts)g(in)h(the)e (arra)o(y)l(.)25 b(In)18 b(an)f(ob)s(ject-orien)o(ted)g(system,)g(this)h(coul\ d)g(b)q(e)g(implemen)o(ted)h(as)e(a)g(series)h(of)37 437 y(calls)h(to)e(arra) o(y)g(elemen)o(ts)h(to)g(compare)f(themselv)o(es)h(with)h(another)e(elemen)o (t)h(and)g(return)g(the)g(maximal)37 493 y(elemen)o(t.)23 b(The)16 b(op)q(era\ tion)g(could)h(b)q(e)g(de\014ned)g(once)f(on)g(the)g(arra)o(y)f(class)h(and)g (then)g(reused)h(on)e(arra)o(ys)g(of)37 550 y(di\013eren)o(t)k(t)o(yp)q(es,)f (as)f(long)h(as)g(eac)o(h)g(t)o(yp)q(e)g(of)f(arra)o(y)g(elemen)o(t)i(underst\ o)q(o)q(d)f(ho)o(w)f(to)h(compare)f(itself)i(with)37 606 y(another)c(arra)o (y)f(elemen)o(t)i(of)f(that)f(t)o(yp)q(e.)108 663 y(This)j(com)o(bination)g (of)e(features)h(is)h(supplemen)o(ted)h(in)f(Smalltalk)g(and)g(some)f(other)f (ob)s(ject-orien)o(ted)37 719 y(languages)f(with)g(a)f(sophisticated)h(user)f (in)o(terface)h(and)f(bro)o(wsing)h(facilities)h(that)e(help)h(mak)o(e)f(expl\ icit)i(the)37 775 y(inheritance)i(relationships)f(among)e(classes)i(and)f(the) f(proto)q(col)h(\(set)f(of)h(op)q(erations\))f(supp)q(orted)i(b)o(y)e(eac)o (h)37 832 y(class.)20 b(These)14 b(features)f(encourage)g(the)h(iden)o(tifyin\ g)h(and)f(reusing)g(of)f(existing)h(co)q(de)g(rather)f(than)g(writing)37 888 y (new)j(co)q(de)g(from)e(scratc)o(h.)37 1010 y fe(2.3.2)56 b(Ob)s(ject-Orien)n (ted)17 b(Application)h(F)-5 b(ramew)n(orks)18 b(and)h(Reuse)37 1096 y fl(Whi\ le)c(ob)s(ject-orien)o(ted)e(programming)g(mak)o(es)f(program)g(comp)q(onen)o (ts)i(more)e(reusable,)i(in)g(the)g(long)f(run)37 1152 y(reusing)j(the)e(desi\ gn)h(of)f(an)h(application)h(is)f(more)e(imp)q(ortan)o(t)h(than)h(reusing)g (the)f(implemen)o(tation)i(of)e(an)o(y)37 1209 y(one)i(of)g(its)f(comp)q(onen) o(ts.)22 b(Biggersta\013)14 b(and)i(Ric)o(h)o(ter)g(note)g(that)f(the)h(funda\ men)o(tal)g(problem)g(prev)o(en)o(ting)37 1265 y(successful)g(design)f(lev)o (el)h(reuse)e(is)h(\014nding)h(the)e(righ)o(t)g(represen)o(tation)g(of)g(desi\ gn.)21 b(Suc)o(h)15 b(a)e(represen)o(tation)37 1322 y(should)k([16)o(]:)106 1416 y fj(\017)22 b fl(represen)o(t)15 b(kno)o(wledge)h(ab)q(out)f(implemen)o (tation)i(structures)d(in)j(a)d(factored)h(form)106 1509 y fj(\017)22 b fl (p)q(ermit)16 b(partial)g(sp)q(eci\014cations)h(that)d(can)h(b)q(e)h(incremen) o(tally)h(extended)106 1603 y fj(\017)22 b fl(allo)o(w)16 b(\015exible)h(coup\ lings)g(b)q(et)o(w)o(een)e(a)g(design)h(and)g(its)f(v)m(arious)h(in)o(terpret\ ations)106 1697 y fj(\017)22 b fl(supp)q(ort)15 b(degrees)h(of)f(abstraction) f(and)i(precision.)108 1791 y(An)21 b(imp)q(ortan)o(t)g(ob)s(ject-orien)o(ted) g(tec)o(hnique)h(for)e(facilitate)i(design-lev)o(el)h(reuse)e(is)h(an)f fi (applic)n(ation)37 1847 y(fr)n(amework.)f fl(An)12 b(application)h(framew)o (ork)c(represen)o(ts)j(the)f(design)h(of)f(an)h(application;)i(it)d(consists) h(of)f(a)g(set)37 1904 y(of)i(classes)g(\(man)o(y)f(of)g(whic)o(h)i(ma)o(y)e (b)q(e)h(abstract\),)e(eac)o(h)i(represen)o(ting)g(a)g(ma)s(jor)e(comp)q(onen) o(t.)19 b(F)l(ramew)o(orks)37 1960 y(capture)13 b(the)g(designs)g(of)f(in)o (terfaces)h(and)g(the)f(w)o(a)o(y)g(functionalit)o(y)h(is)g(divided)i(among)d (comp)q(onen)o(ts,)h(whic)o(h)37 2017 y(Deutsc)o(h)i(argues)e(are)h(the)g(k)o (ey)g(in)o(tellectual)j(con)o(ten)o(t)d(of)f(soft)o(w)o(are)g([40)o(].)19 b (F)l(ramew)o(orks)13 b(de\014ne)i(an)f fi(external)37 2073 y(interfac)n(e)h fl (that)f(is)h(constan)o(t)f(across)g(all)i(uses)f(of)f(a)h(framew)o(ork,)e(and) i(an)g fi(internal)g(interfac)n(e)f fl(that)g(is)h(a)g(set)37 2129 y(of)g(con\ strain)o(ts)g(on)g(sub)q(class)h(co)q(de)g(or)f(a)g(comp)q(onen)o(t)g(ob)s (ject's)f(proto)q(col.)108 2186 y(A)d(framew)o(ork)f(is)i(a)f(mixture)h(of)f (abstract)f(and)i(concrete)f(classes.)19 b(One)12 b(of)f(the)h(main)f(c)o(har\ acteristics)h(of)37 2242 y(a)i(framew)o(ork)e(is)i(that)f(it)h(is)g(designed) h(to)e(b)q(e)h(re\014ned.)20 b(It)14 b(can)f(b)q(e)i(re\014ned)f(b)o(y)g(c)o (hanging)g(the)f(con\014guration)37 2299 y(of)h(its)g(comp)q(onen)o(ts)h(or)e (b)o(y)h(creating)g(new)h(kinds)g(of)e(comp)q(onen)o(ts)h(\(i.e.)20 b(new)14 b (classes,)h(often)f(as)f(sub)q(classes)37 2355 y(of)k(existing)g(classes\).) 24 b(A)16 b(mature)g(framew)o(ork)f(will)k(ha)o(v)o(e)d(a)g(large)g(class)h (library)g(of)g(concrete)f(sub)q(classes)37 2412 y(of)i(eac)o(h)g(abstract)e (class,)j(so)e(that)g(most)g(of)g(the)h(time)g(an)g(application)h(can)f(b)q (e)h(plugged)f(together)f(from)37 2468 y(existing)j(comp)q(onen)o(ts.)28 b (Ev)o(en)18 b(when)h(new)f(sub)q(classes)h(are)f(needed,)i(they)e(are)g(easy) f(to)h(pro)q(duce;)i(their)37 2525 y(abstract)h(sup)q(erclass)i(pro)o(vides)g (their)f(design)h(and)f(m)o(uc)o(h)g(of)f(their)i(co)q(de,)g(and)f(the)g(alre\ ady)g(existing)37 2581 y(concrete)16 b(sub)q(classes)g(pro)o(vide)g(examples) g(of)f(ho)o(w)f(to)h(sub)q(class)h(from)f(the)g(abstract)f(sup)q(erclass.)964 2760 y(9)g eop bop 108 42 a fl(Th)o(us,)21 b(an)f(ob)s(ject-orien)o(ted)h(app\ lication)h(framew)o(ork)d(is)h(a)g(represen)o(tation)h(that)e(supp)q(orts)i (design)37 98 y(lev)o(el)16 b(reuse)f(b)o(y)g(represen)o(ting)g(kno)o(wledge) g(in)h(a)e(factored)g(form,)g(p)q(ermitting)h(partial)g(sp)q(eci\014cations,) h(and)37 154 y(supp)q(orting)23 b(degrees)e(of)g(abstraction.)38 b(F)l(urther\ more,)22 b(sub)q(classing)h(can)e(b)q(e)h(used)g(in)h(an)e(application)37 211 y(framew)o(ork)14 b(to)h(mo)q(del)h(v)m(arious)g(concrete)f(represen)o(tation\ s)g(of)g(a)g(common)g(abstraction.)37 333 y fe(2.3.3)56 b(Reusing)18 b(&)g (Refactoring)g(Ob)s(ject-Orien)n(ted)f(Soft)n(w)n(are)37 418 y fl(One)22 b (migh)o(t)e(b)q(e)h(tempted)f(to)g(conclude)i(that)e(an)g(ob)s(ject-orien)o (ted)h(system,)g(once)f(dev)o(elop)q(ed,)j(can)e(b)q(e)37 475 y(reused)e(or)f (extended)h(simply)g(b)o(y)g(com)o(bining)g(comp)q(onen)o(ts)f(of)g(existing) h(classes)g(in)g(di\013eren)o(t)f(w)o(a)o(ys,)g(b)o(y)37 531 y(adding)h(op)q (erations)e(to)g(existing)h(classes)g(or)f(b)o(y)g(sub)q(classing)i(from)e (existing)h(classes.)27 b(Often,)18 b(ho)o(w)o(ev)o(er,)37 588 y(ob)s(ject-or\ ien)o(ted)f(soft)o(w)o(are)d(cannot)i(b)q(e)h(reused)g(without)f(\014rst)g (b)q(eing)h(restructuring.)23 b(There)16 b(are)g(sev)o(eral)37 644 y(reasons) f(for)g(this)g([31,)f(59]:)93 738 y(1.)22 b(When)16 b(dev)o(eloping)h(a)e(sof\ t)o(w)o(are)f(application,)j(it)f(is)g(di\016cult)h(to)e(determine)h fi(a)h (priori)f fl(what)f(classes)151 794 y(em)o(b)q(o)q(dy)e(the)f(imp)q(ortan)o (t)g(concepts)h(for)e(that)h(application)i(and)e(ho)o(w)g(they)g(in)o(terrela\ te.)20 b(Exp)q(erience)151 851 y(has)f(sho)o(wn)f(that)g(a)h(useful)h(taxonom) o(y)d(of)h(classes)i(is)f(disco)o(v)o(ered)g(through)g(an)f(iterativ)o(e)h (pro)q(cess)151 907 y(of)c(exploration.)21 b(As)16 b(an)f(understanding)i(of) e(the)g(application)i(impro)o(v)o(es,)e(the)h(system)f(often)g(needs)151 964 y (to)20 b(b)q(e)h(restructured)g(and)f(the)h(abstractions)f(em)o(b)q(o)q(died) i(in)f(existing)h(classes)e(often)h(need)g(to)f(b)q(e)151 1020 y(c)o(hanged.) 93 1114 y(2.)i(Ev)o(en)15 b(after)f(a)h(system)g(has)f(matured)h(through)g (sev)o(eral)g(iterations,)g(sw)o(eeping)h(structural)e(c)o(hanges)151 1171 y (migh)o(t)19 b(still)i(b)q(e)f(necessary)l(.)32 b(The)20 b(soft)o(w)o(are)d (system)i(m)o(ust)g(op)q(erate)g(in)h(an)f(en)o(vironmen)o(t)g(that)g(is)151 1227 y(constan)o(tly)14 b(c)o(hanging,)h(and)f(the)g(soft)o(w)o(are)f(system) g(m)o(ust)h(satisfy)g(user)g(needs)h(that)f(are)g(constan)o(tly)151 1283 y (c)o(hanging)i(as)f(w)o(ell.)93 1377 y(3.)22 b(When)c(attempts)f(are)g(made)h (to)f(reuse)h(soft)o(w)o(are)e(across)h(pro)s(jects,)h(new)g(issues)g(arise.) 28 b(A)18 b(system)151 1434 y(ma)o(y)e(need)h(to)f(b)q(e)h(partitioned)h(di\ \013eren)o(tly)l(,)f(due)g(to)f(organizational)h(and)g(other)f(factors,)f(in) j(order)151 1490 y(for)d(a)g(new)g(pro)s(ject)f(to)h(reuse)h(it.)k(Th)o(us,) 14 b(some)h(restructuring)h(ma)o(y)e(b)q(e)i(needed)h(to)d(e\013ect)h(reuse.) 93 1584 y(4.)22 b(Sub)q(classing)d(in)e(an)f(ob)s(ject-orien)o(ted)g(system)g (can)h(sim)o(ultaneously)h(serv)o(e)e(sev)o(eral)g(purp)q(oses,)h(lik)o(e)151 1640 y(co)q(de)22 b(sharing,)h(t)o(yp)q(e)e(v)m(alidation)i(and)e(mo)q(deling) i(generalization/sp)q(eciali)q(zation)h(relationships.)151 1697 y(It)18 b(can) g(b)q(e)h(di\016cult)h(to)d(reconcile)j(all)f(of)e(these)i(purp)q(oses)f(with\ out)g(some)g(restructuring)g(when)h(a)151 1753 y(c)o(hange)c(is)h(prop)q(osed\ .)108 1847 y(None)k(of)f(these)h(issues)h(is)f(exclusiv)o(e)h(to)e(ob)s(ject-\ orien)o(ted)h(systems.)33 b(The)20 b(fourth)f(issue)i(applies)g(to)37 1904 y (languages)h(that)e(ha)o(v)o(e)g(subt)o(yp)q(es;)k(the)d(other)g(three)g(issu\ es)h(apply)g(more)e(generally)l(.)39 b(The)21 b(imp)q(ortan)o(t)37 1960 y(p)q (oin)o(t)15 b(here)g(is)g(that)f(these)h(issues)g(do)f(not)g(disapp)q(ear)i (when)f(ob)s(ject-orien)o(ted)f(tec)o(hnology)h(is)g(in)o(tro)q(duced.)37 2017 y(One)21 b(of)e(the)h(essen)o(tial)h(di\016culties)h(in)f(dev)o(eloping)g(sof\ t)o(w)o(are)d(is)j(that)e(the)h(soft)o(w)o(are)e(m)o(ust)h(conform)g(to)37 2073 y(h)o(uman)i(institutions)g(and)g(systems)f(that)f(in)o(terface)i(with)g (it,)g(and)g(that)f(those)g(forces)g(are)g(constan)o(tly)37 2129 y(c)o(hangin\ g)c([24)o(].)108 2186 y(Nonetheless,)i(the)e(motiv)m(ation)h(to)f(restructure) g(ob)s(ject-orien)o(ted)g(programs)g(is)h(somewhat)e(di\013eren)o(t)37 2242 y (from)21 b(the)g(motiv)m(ation)h(for)f(man)o(y)g(soft)o(w)o(are)e(restructuri\ ng)j(approac)o(hes)f(in)h(the)f(past.)38 b(Man)o(y)20 b(of)h(the)37 2299 y (soft)o(w)o(are)15 b(restructuring)i(tec)o(hniques)h(describ)q(ed)h(earlier)f (w)o(ere)e(motiv)m(ated)h(b)o(y)f(the)h(need)h(to)e(understand)37 2355 y(and) c(ev)o(olv)o(e)f(unstructured)h(or)f(p)q(o)q(orly)h(structured)f(programs.)18 b(Ho)o(w)o(ev)o(er,)10 b(with)i(ob)s(ject-orien)o(ted)f(systems,)37 2412 y (some)k(structural)g(information)h(is)f(already)h(explicit)h(within)g(the)e (class)h(and)f(inheritance)i(structures;)d(the)37 2468 y(in)o(tegrated)j(dev) o(elopmen)o(t)g(en)o(vironmen)o(ts)g(for)f(Smalltalk)h(and)g(other)f(ob)s(jec\ t-orien)o(ted)g(languages)h(mak)o(e)37 2525 y(understanding)12 b(a)e(program) f(structure)h(easier)h(b)o(y)f(pro)o(viding)i(facilities)g(for)e(abstracting) g(and)g(bro)o(wsing)g(the)37 2581 y(program.)25 b(With)17 b(ob)s(ject-orien)o (ted)g(systems)g(refactoring)g(is)g(needed)i(not)d(so)h(m)o(uc)o(h)g(to)g(inf\ use)h(structure)952 2760 y(10)g eop bop 37 42 a fl(in)o(to)22 b(a)f(p)q(o)q (orly)h(structured)g(program,)f(but)h(rather)f(to)g(re\014ne)h(the)g(design)g (of)f(an)h(already)f(structured)37 98 y(program,)14 b(and)i(mak)o(e)e(it)i (easier)f(to)g(reuse.)108 154 y(The)e(need)g(to)f(in)o(v)o(estigate)h(approac) o(hes)f(for)g(soft)o(w)o(are)f(restructuring)i(has)f(b)q(een)i(motiv)m(ated)f (b)o(y)f(sev)o(eral)37 211 y(sources)g(within)g(the)g(ob)s(ject-orien)o(ted)f (comm)o(unit)o(y)l(.)19 b(These)12 b(include)h(w)o(ork)e(in)h(ob)s(ject-orien) o(ted)f(databases,)37 267 y(and)16 b(researc)o(h)f(in)o(to)g(impro)o(ving)h (the)g(st)o(yle)f(of)g(ob)s(ject-orien)o(ted)g(programs)g(to)f(increase)i(the\ ir)g(reusabilit)o(y)l(.)37 324 y(These)g(e\013orts)e(are)h(brie\015y)h(discus\ sed)h(b)q(elo)o(w)f(and)f(further)g(detailed)i(in)f(c)o(hapter)f(ten.)108 380 y(Ob)s(ject-orien)o(ted)21 b(databases)f(require)i(structural)e(c)o(hanges)h (for)f(man)o(y)g(of)g(the)h(same)f(reasons)g(that)37 437 y(ob)s(ject-orien)o (ted)d(programs)e(do:)21 b(users)16 b(often)g(need)h(to)e(view)i(the)f(databa\ se)g(sc)o(hema)g(\(structure\))f(di\013er-)37 493 y(en)o(tly)l(,)g(and)f(the) g(same)f(user)h(ma)o(y)f(need)i(to)e(view)i(the)e(sc)o(hema)h(di\013eren)o (tly)h(at)e(di\013eren)o(t)h(times.)20 b(The)14 b(issues)37 550 y(and)h(appro\ ac)o(hes)f(for)g(sc)o(hema)g(ev)o(olution)i(in)f(ob)s(ject-orien)o(ted)f(data\ bases)g(are)g(discussed)i(in)g([66)o(])e(and)g(the)37 606 y(references)i(ther\ ein.)108 663 y(Sev)o(eral)g(e\013orts)e(ha)o(v)o(e)h(b)q(een)h(underw)o(a)o (y)f(to)g(understand)h(go)q(o)q(d)f(st)o(yle)g(for)g(ob)s(ject-orien)o(ted)g (programs,)37 719 y(to)c(supp)q(ort)f(their)h(ev)o(olution)h(and)f(reuse.)18 b (Ro)q(c)o(hat)11 b([98)o(])f(discusses)i(the)f(imp)q(ortance)g(of)g(go)q(o)q (d)f(programming)37 775 y(st)o(yle)i(in)h(Smalltalk)g(and)e(prop)q(oses)h(sev) o(eral)g(seman)o(tic)g(and)g(syn)o(tactic)f(guidelines.)22 b(Lieb)q(erherr)13 b(and)f(others)37 832 y(in)g(the)f(Demeter)g(pro)s(ject)f([71)o(])g(ha)o(v)o (e)h(prop)q(osed)g(an)g(approac)o(h)f(for)h(hiding)h(the)f(structure)g(of)f (a)h(class)g(in)h(order)37 888 y(to)18 b(increase)g(main)o(tainabilit)o(y)l (.)30 b(Johnson)18 b(and)g(F)l(o)q(ote)g([59)o(])f(prop)q(ose)h(design)h(rule\ s)f(to)g(supp)q(ort)g(reusable)37 945 y(classes.)33 b(The)20 b(authors)e(argu\ e)h(that)g(restructuring)g(an)g(ob)s(ject-orien)o(ted)h(program)e(in)i(line)h (with)e(these)37 1001 y(guidelines)f(will)f(impro)o(v)o(e)e(its)h(reusabilit) o(y)g(and)g(main)o(tainabilit)o(y)l(.)108 1058 y(V)l(ery)k(recen)o(t)g(resear\ c)o(h)g(has)f(in)o(v)o(estigated)h(some)g(of)f(the)h(issues)h(in)o(v)o(olv)o (ed)f(in)h(restructuring)f(ob)s(ject)37 1114 y(orien)o(ted)d(programs)e([15)o (,)g(31].)22 b(Those)16 b(e\013orts)f(ha)o(v)o(e)g(tended)i(to)e(fo)q(cus)i (on)e(inheritance,)j(to)d(ac)o(hiev)o(e)i(suc)o(h)37 1171 y(goals)e(as)f(elim\ inating)i(duplicate)h(de\014nitions)f(of)e(a)g(v)m(ariable)i(in)f(a)f(program\ .)19 b(Refactoring)14 b(is)h(m)o(uc)o(h)g(more)37 1227 y(complex)g(that)e(thi\ s,)h(ho)o(w)o(ev)o(er.)k(Refactoring)c(not)f(only)h(in)o(v)o(olv)o(es)h(manip\ ulating)g(inheritance)g(hierarc)o(hies)37 1284 y(but)d(also)f(in)o(v)o(olv)o (es)h(suc)o(h)f(tasks)g(as)g(renaming)g(a)g(class,)h(splitting)h(up)f(classes) f(and)h(functions,)g(and)g(remo)o(ving)37 1340 y(conditional)i(statemen)o(ts.) j(Also,)c(some)e(refactorings)g(in)o(v)o(olv)o(e)h(not)f(only)h(inheritance)i (hierarc)o(hies)f(but)e(also)37 1396 y(instance)17 b(hierarc)o(hies,)f(where) f(an)g(instance)h(of)f(one)g(class)h(is)g(a)f(comp)q(onen)o(t)g(of)g(another) f(class)i([59)o(].)108 1453 y(The)j(follo)o(wing)h(c)o(hapter)f(in)o(tro)q (duces)h(the)f(set)f(of)h(refactorings,)g(pro)o(viding)h(examples)g(of)e(the) h(three)37 1509 y(high-lev)o(el)f(refactorings.)952 2760 y(11)g eop bop 37 353 a fc(Chapter)35 b(3)37 560 y fb(Refactoring)42 b(Application)37 685 y(F)-10 b (ramew)m(orks)37 926 y fd(3.1)70 b(Ob)t(ject-Orien)n(ted)20 b(Application)g (F)-6 b(ramew)n(orks)37 1027 y fl(An)16 b(imp)q(ortan)o(t)e(ob)s(ject-orien)o (ted)h(tec)o(hnique)h(to)f(facilitate)g(design-lev)o(el)j(reuse)d(is)g(an)g fi (applic)n(ation)h(fr)n(ame-)37 1084 y(work,)22 b fl(whic)o(h)e(is)g(an)g(abst\ ract)f(design)h(of)g(an)f(application,)j(consisting)f(of)e(an)h(abstract)e (class)i(for)f(eac)o(h)37 1140 y(ma)s(jor)f(comp)q(onen)o(t.)30 b(F)l(ramew)o (orks)17 b(are)i(an)g(emerging)g(tec)o(hnique;)i(there)e(is)g(still)h(m)o(uc) o(h)f(to)f(b)q(e)h(learned)37 1197 y(concerning)e(the)e(design,)h(con\014gura\ tion,)f(and)g(arc)o(hitecture-lev)o(el)i(description)g(of)d(framew)o(orks.)19 b(Among)37 1253 y(the)d(earliest)h(examples)f(of)f(ob)s(ject-orien)o(ted)h (application)h(framew)o(orks)d(w)o(ere)i(the)f(Lisa)i(T)l(o)q(olkit)f([57)o (])f(and)37 1309 y(Smalltalk)f(Mo)q(del/View/Con)o(troller)f([48)o(].)18 b (More)12 b(recen)o(tly)l(,)h(sev)o(eral)f(pro)s(jects)g(ha)o(v)o(e)f(b)q(een) j(undertak)o(en)e(at)37 1366 y(the)k(Univ)o(ersit)o(y)g(of)f(Illinois)j(at)d (Urbana-Champaign)h(to)f(design)h(framew)o(orks;)e(these)h(include)j(the)e fi (T)m(yp)n(e)n(d)37 1422 y(Smal)r(ltalk)h fl(\(TS\))g(optimizing)i(compiler)f (framew)o(ork)e(for)h(co)q(de)h(generation)f(and)h(optimization)g([60)o(],)f (the)37 1479 y(F)o(OIBLE)d(framew)o(ork)d(for)h(visual)i(programming)f([58)o (])f(and)h(the)g fi(Choic)n(es)f fl(ob)s(ject-orien)o(ted)g(op)q(erating)h (sys-)37 1535 y(tem.)20 b fi(Choic)n(es,)13 b fl(written)i(in)g(C++,)g(is)g (more)f(than)g(just)h(an)f(op)q(erating)h(system;)f(it)g(is)h(really)h(an)e (op)q(erating)37 1592 y(system)k(framew)o(ork)f(consisting)h(of)g(in)o(terlo) q(c)o(king)h(framew)o(orks)e(for)g(\014le)i(systems)e([77],)g(virtual)i(memor\ y)37 1648 y([103)o(],)c(comm)o(unication)h([129)n(],)f(and)g(pro)q(cess)h(sc) o(heduling)h([102)o(].)108 1705 y(Go)q(o)q(d)h(framew)o(orks)e(are)h(usually) i(the)f(result)g(of)f(man)o(y)g(design)i(iterations)f(and)g(a)f(lot)h(of)f (hard)g(w)o(ork)37 1761 y(in)o(v)o(olving)e(structural)d(c)o(hanges)h([59)o (,)f(85].)19 b(These)13 b(c)o(hanges)g(ma)o(y)f(in)o(v)o(olv)o(e)h(a)f(single) j(refactoring,)d(or)g(a)h(series)37 1818 y(of)e(related)g(refactorings.)18 b (The)11 b(follo)o(wing)g(sections)g(describ)q(e)i(examples)e(of)f(sev)o(eral) h(common)f(refactorings.)37 1874 y(They)i(are)e(mostly)h(based)g(on)g(the)g (analysis)h(of)e(c)o(hanges)h(made)g(during)h(the)f(iterativ)o(e)g(design)h (of)e(the)h fi(Choic)n(es)37 1930 y fl(\014le)i(system)f(framew)o(ork.)17 b (That)11 b(analysis)i(w)o(as)e(based)h(on)g(a)f(series)h(of)g(t)o(w)o(elv)o (e)f(snapshots)h(of)f(the)h(framew)o(ork)37 1987 y(co)o(v)o(ering)k(a)f(t)o (w)o(o-y)o(ear)e(p)q(erio)q(d.)108 2043 y(T)l(o)19 b(motiv)m(ate)g(the)g(prac\ tical)h(imp)q(ortance)f(of)g(refactoring)f(in)i(designing)h(application)f(fra\ mew)o(orks,)37 2100 y(the)15 b(examples)h(presen)o(ted)f(in)g(the)g(c)o(hapte\ r)f(are)g fi(r)n(e)n(al)p fl(;)g(that)g(is,)h(the)f(examples)i(describ)q(e)g (refactorings)e(that)37 2156 y(w)o(ere)j(actually)g(applied)i(\(man)o(ually\)) d(to)g(impro)o(v)o(e)h(application)h(framew)o(orks)d(in)i(the)g fi(Choic)n (es)e fl(op)q(erating)37 2213 y(system)20 b(and)h fi(T)m(yp)n(e)n(d)e(Smal)r (ltalk)h fl(pro)s(jects.)34 b(This)21 b(has)f(the)g(disadv)m(an)o(tage)g(that) g(the)g(examples)h(include)37 2269 y(some)f(extraneous)f(detail)h(and)g(compl\ exit)o(y)l(,)h(but)e(has)h(the)f(adv)m(an)o(tage)g(that)g(the)g(examples)h (sho)o(w)f(ho)o(w)37 2326 y(refactorings)c(are)g(applied)i(in)f(actual)g(desi\ gn)g(tasks.)962 2309 y fs(1)108 2382 y fl(The)e(relationships)h(among)d(class\ es)i(b)q(ecome)g(more)f(explicit)i(and)f(their)g(in)o(terfaces)f(b)q(ecome)h (more)f(ab-)37 2439 y(stract)e(as)h(a)g(framew)o(ork)e(matures.)18 b(A)12 b (shallo)o(w)h(\(almost)e(\015at\))g(hierarc)o(h)o(y)i(of)e(classes)i(ev)o(olv) o(es)f(in)o(to)g(a)f(deep)q(er)37 2522 y 750 2 v 89 2548 a fu(1)107 2564 y fp (Chapter)16 b(nine)i(describ)q(es)g(t)o(w)o(o)e(simpler,)i(alb)q(eit)g(less)f (practical,)i(examples)f(that)e(sho)o(w)h(ho)o(w)f(refactorings)i(de\014ned)g (in)37 2610 y(earlier)d(c)o(hapters)f(can)f(b)q(e)h(used)f(together.)952 2760 y fl(12)g eop bop 37 42 a fl(class)17 b(hierarc)o(h)o(y)l(.)23 b(Instance)17 b (hierarc)o(hies)h(emerge,)e(where)g(an)g(instance)h(of)f(one)g(class)h(is)g (a)f(comp)q(onen)o(t)g(of)37 98 y(another)j(class)g([59)o(].)30 b(Often,)20 b (as)e(instance)i(hierarc)o(hies)g(are)e(de\014ned)i(the)f(inheritance)h(hiera\ rc)o(hies)g(also)37 154 y(c)o(hange)e(and)g(b)q(ecome)h(easier)f(to)f(underst\ and.)28 b(Refactorings)18 b(to)f(generalize)j(and)e(sp)q(ecialize)i(classes)f (in)37 211 y(an)d(inheritance)g(hierarc)o(h)o(y)l(,)g(or)e(to)h(recognize)h (and)f(restructure)g(instance)h(hierarc)o(hies,)g(can)f(supp)q(ort)g(this)37 267 y(maturation)g(of)g(an)g(application)i(framew)o(ork.)37 411 y fd(3.2)70 b (Refactoring)22 b(T)-6 b(o)23 b(Generalize:)k(Creating)22 b(An)h(Abstract)f (Sup)r(er-)194 485 y(class)37 587 y fl(As)16 b(the)g(design)g(of)g(an)f(appli\ cation)i(framew)o(ork)d(matures,)h(general)h(concepts)g(are)g(usually)h(deriv) o(ed)f(from)37 643 y(sp)q(eci\014c)k(examples.)27 b(Often,)19 b(these)e(examp\ les)i(are)e(implemen)o(ted)i(in)f(concrete)g(classes)g(that)f(in)o(tert)o(win\ e)37 700 y(the)h(case-sp)q(eci\014c)h(b)q(eha)o(vior)f(with)g(more)e(general,) i(common)f(abstractions.)26 b(As)17 b(common)g(abstractions)37 756 y(are)g (determined,)g(it)g(is)g(useful)g(to)f(separate)g(these)h(abstractions)f(from) f(the)i(example-sp)q(eci\014c)i(b)q(eha)o(vior.)37 813 y(One)d(w)o(a)o(y)d (to)h(do)g(this)h(is)g(to)f(de\014ne)h(an)f(abstract)g(sup)q(erclass)h(for)f (a)g(set)g(of)g(concrete)h(classes,)f(and)h(migrate)37 869 y(the)j(common)f (b)q(eha)o(vior)h(to)e(that)h(sup)q(erclass.)27 b(This)18 b(refactoring)f(not) g(only)g(clari\014es)i(the)e(design)i(of)d(the)37 925 y(framew)o(ork,)10 b (but)h(b)q(etter)f(ensures)h(consistency)h(b)o(y)e(de\014ning)i(the)e(abstrac\ tion)g(in)i(one)e(place.)20 b(The)10 b(concrete)37 982 y(classes)16 b(retain) g(the)f(b)q(eha)o(vior,)g(although)h(it)f(is)h(no)o(w)f(inherited)i(rather)d (than)h(b)q(eing)i(lo)q(cally)g(de\014ned.)108 1038 y(Abstract)d(classes)i (represen)o(t)f(the)g fi(pr)n(oto)n(c)n(ol)g fl(of)f(an)h(ob)s(ject,)g(whic)o (h)g(is)h(a)f(k)o(ey)g(part)f(of)h(its)g(sp)q(eci\014cation.)37 1095 y(An)20 b (ob)s(ject's)e(proto)q(col)h(is)g(the)g(set)g(of)f(messages)h(that)f(it)h(wil\ l)i(accept.)1308 1078 y fs(2)1359 1095 y fl(Standard)e(proto)q(cols)f(supp)q (ort)37 1151 y(in)o(terc)o(hangeable)f(comp)q(onen)o(ts)e(and)g(assist)g(prog\ rammers)f(in)i(comm)o(unicating)g(with)g(one)f(another.)108 1208 y(Abstract)d (classes)h(nev)o(er)g(ha)o(v)o(e)f(instances,)i(and)e(often)h(do)f(not)h(ha)o (v)o(e)f(instance)h(v)m(ariables.)20 b(They)13 b(de\014ne)37 1264 y fi(b)n (ehavior)21 b fl(in)h(terms)e(of)g(a)g(few)h(unde\014ned)h(metho)q(ds)f(imple\ men)o(ted)h(in)g(the)e(sub)q(classes.)37 b(In)22 b(a)e(mature)37 1321 y(inher\ itance)f(hierarc)o(h)o(y)l(,)f(the)f(leaf)g(classes)g(are)g(concrete)g(and)g (the)g(classes)h(closer)f(to)f(the)h(ro)q(ot)f(are)h(more)37 1377 y(abstract.) i(When)14 b(de\014ning)h(a)f(new)g(class,)g(it)g(is)g(usually)i(desirable)f (to)e(inherit)i(from)e(an)h(abstract)f(class,)h(to)37 1434 y(inherit)j(the)e (proto)q(col)h(but)f(not)g(b)q(e)h(tied)f(to)g(a)g(particular)h(data)e(repres\ en)o(tation.)108 1490 y(Creating)g(an)g(abstract)g(class)g(is)h(imp)q(ortan)o (t)f(but)g(not)g(easy)l(.)20 b(Bec)o(k)14 b(observ)o(ed)g(that,)g(among)f(Sma\ lltalk)37 1546 y(researc)o(hers,)21 b(useful)f(abstractions)g(are)f(usually)i (created)f(b)o(y)f(programmers)g(who)g(are)h(willing)h(to)f(redo)37 1603 y (their)15 b(co)q(de)g(sev)o(eral)f(times)h(to)e(pro)q(duce)i(easy-to-understa\ nd)g(and)f(easy-to-sp)q(ecialize)j(classes)d([86)o(].)20 b(Cre-)37 1659 y(ati\ ng)c(reusable)h(abstract)d(classes)j(often)e(in)o(v)o(olv)o(es)h(examining)h (an)f(existing)g(implemen)o(tation)h(to)e(\014nd)i(an)37 1716 y(abstraction)c (hidden)j(in)e(a)f(concrete)g(class)h(\(or)e(classes\),)i(and)g(reorganizing) g(the)f(class)h(hierarc)o(h)o(y)f(to)g(mak)o(e)37 1772 y(that)i(abstraction)g (explicit)i([59)o(].)108 1829 y(Consider)f(the)f(example,)g(sho)o(wn)g(in)g (Figure)g(3.1,)f(of)g(an)h(abstract)f(class)h(created)g(for)g(the)g fi(Choic) n(es)e fl(\014le)37 1885 y(system)18 b(framew)o(ork)e([76)o(].)26 b(One)18 b (of)f(the)h(cen)o(tral)f(classes)h(in)h(that)d(framew)o(ork)1425 1869 y fs (3)1461 1885 y fl(is)i ff(Memo)o(r)o(yObject)e fl([104)o(].)37 1942 y(A)f ff (Memo)o(r)o(yObject)f fl(is)h(a)g(sequence)h(of)e(iden)o(tically)j(sized)f (blo)q(c)o(ks.)21 b(It)14 b(also)h(is)g(resp)q(onsible)i(for)d(main)o(taining) 37 1998 y(the)20 b(n)o(um)o(b)q(er)h(of)e(blo)q(c)o(ks)i(it)f(con)o(tains.)34 b(The)20 b(k)o(ey)g(op)q(erations)g(pro)o(vided)g(b)o(y)g ff(Memo)o(r)o(yObje\ cts)f fl(are)h fi(r)n(e)n(ad)p fl(,)37 2055 y fi(write)p fl(,)d(and)g fi(size) p fl(.)23 b(Man)o(y)16 b(parts)g(of)g(the)g(\014le)i(system)e(are)g ff(Memo)o (r)o(yObjects)p fl(,)g(suc)o(h)h(as)f(\014les)i(and)f(disks.)24 b(An)37 2111 y ff(Ino)q(de)140 2095 y fs(4)177 2111 y fl(con)o(tains)16 b(a)g(description)h (of)f(the)g(disk)h(la)o(y)o(out)e(of)h(a)f(\014le)i(and)g(other)e(information) h(suc)o(h)h(as)e(the)h(\014le)37 2167 y(o)o(wner,)d(access)g(p)q(ermissions)i (and)e(access)g(times)h([6)o(].)19 b(In)14 b(the)f fi(Choic)n(es)f fl(\014le) i(system)f(framew)o(ork,)e ff(Ino)q(de)j fl(w)o(as)37 2224 y(represen)o(ted)i (as)f(a)g(sub)q(class)h(of)f ff(Memo)n(ryObject)p fl(.)37 2305 y 750 2 v 89 2332 a fu(2)107 2348 y fp(The)e(sp)q(eci\014cation)i(of)e(an)g(ob)r(ject)h (also)g(includes)h(class)f(in)o(v)n(arian)o(ts)i(and)d(the)g(relationshi)q (ps)j(with)d(other)h(ob)r(jects.)89 2378 y fu(3)107 2393 y fp(The)g(\014le)h (system)g(has)g(a)f(la)o(y)o(ered)i(structure)f(that)g(is)g(m)o(uc)o(h)g(more) f(comprehensiv)o(e)j(than)e(what)g(is)g(presen)o(ted)g(here;)g(see)37 2439 y ([76)q(].)89 2469 y fu(4)107 2485 y fp(Ino)q(de)f(is)g(standard)g(UNIX)523 2468 y fw(R)514 2469 y fn(\015)565 2485 y fp(op)q(erating)h(system)f(terminol\ ogy;)i(it)d(is)h(a)g(con)o(traction)h(of)e(the)g(term)h fm(index)e(no)n(de.)k fp(UNIX)37 2530 y(is)e(a)f(registered)h(trademark)g(of)f(UNIX)f(Systems)i(Lab) q(oratories,)g(Inc.)952 2760 y fl(13)g eop bop 327 0 a 20458128 16050749 10196172 19076710 30654300 35127459 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Bold Helvetica-Bold %%Pages: 1 %%BoundingBox: 155 290 466 534 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t u %I 525 453 525 453 Line End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 67.2285 -4.33734 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 142 666 ] concat %I [ (BEFORE:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 131 631 ] concat %I [ (MemoryObject) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 5 6 ] concat %I 155 626 155 626 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 6 6 ] concat %I 167 613 167 575 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 155 578 ] concat %I [ (Inode \(BSD\)) ] Text End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 457.217 660.988 ] concat %I [ (DURING:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 313.048 15.494 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 406.048 573.952 ] concat %I [ (BSDInode) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 489.048 574.952 ] concat %I [ (SystemVInode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -40.952 45.9518 ] concat %I 510 565 471 532 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -34.952 46.9518 ] concat %I 518 566 565 530 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -34.952 46.9518 ] concat %I 529 560 529 560 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 441.53 627.036 ] concat %I [ (MemoryObject) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 13.012 -6.50604 ] concat Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 122.53 ] concat %I 267 437 351 437 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 292.578 613.976 ] concat %I [ (Steps 1 & 2:) ] Text End End %I eop Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -21.687 42.2891 ] concat Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t u %I 472 439 472 439 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 331.108 475.241 ] concat %I [ (AFTER:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 316.108 441.241 ] concat %I [ (MemoryObject) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 189.108 -176.759 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 282.108 337.241 ] concat %I [ (BSDInode) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 365.108 338.241 ] concat %I [ (SystemVInode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -164.892 -190.759 ] concat %I 510 565 471 532 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -158.892 -189.759 ] concat %I 518 566 565 530 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -158.892 -189.759 ] concat %I 529 560 529 560 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 337.108 389.241 ] concat %I [ (Inode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 188.108 -184.759 ] concat %I 167 613 167 575 Line End End %I eop Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -1.08435 -15.1808 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 464.228 530.808 ] concat %I [ (Steps 3 & 4:) ] Text End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 3.25301 135.542 ] concat %I 449 384 391 345 Line End End %I eop End %I eop showpage %%Trailer end endTexFig 514 1145 a fh(Figure)18 b(3.1)p fl(:)h(Creating)c(An)h(Abstrac\ t)e(Sup)q(erclass)108 1278 y(An)j(early)f(v)o(ersion)h(of)f(the)g fi(Choic)n (es)f fl(\014le)j(system)d(framew)o(ork)g(only)i(supp)q(orted)g(the)f(BSD)h (UNIX)g([37)o(])37 1334 y(op)q(erating)f(system)g(functions)g(and)g(formats.) k(Th)o(us,)c(instances)g(of)g(the)f ff(Ino)q(de)i fl(class)f(represen)o(ted)g (ino)q(des)37 1391 y(for)f(BSD)h(UNIX)g(\014le)g(systems.)21 b(A)15 b(series) h(of)f(c)o(hanges,)g(sho)o(wn)g(in)i(Figure)e(3.1,)f(w)o(ere)i(made)f(to)g (generalize)37 1447 y(the)h ff(Ino)q(de)g fl(class)f(in)h(order)f(to)g(supp)q (ort)g(b)q(oth)g(BSD)h(UNIX)g(and)f(UNIX)h(System)f(V)g([5])f(\014le)j(format\ s:)93 1554 y(1.)22 b(the)15 b ff(Ino)q(de)h fl(class)g(w)o(as)e(renamed)i(to) e ff(BSDIno)q(de)p fl(,)93 1647 y(2.)22 b(the)14 b ff(SystemVIno)q(de)f fl (class)h(w)o(as)f(added)h(as)g(a)f(sub)q(class)i(of)e ff(Memo)o(r)o(yObject;) g fl(v)m(ariables)i(and)f(functions)151 1704 y(w)o(ere)h(copied)h(from)f(the) g ff(BSDIno)q(de)i fl(class,)e(and)g(mo)q(di\014ed,)93 1798 y(3.)22 b(the)14 b ff(Ino)q(de)h fl(class)g(w)o(as)e(added)i(as)f(a)f(sub)q(class)j(of)d ff(Memo) o(r)o(yObject)g fl(and)i(as)e(an)i(abstract)e(sup)q(erclass)i(of)151 1854 y ff (BSDIno)q(de)h fl(and)g ff(SystemVIno)q(de)p fl(,)93 1948 y(4.)22 b(the)14 b (v)m(ariables)i(and)e(functions)h(common)f(to)g ff(BSDIno)q(de)h fl(and)g ff (SystemVIno)q(de)e fl(w)o(ere)h(migrated)g(up)h(to)151 2004 y(their)h(common) f(sup)q(erclass.)108 2111 y(During)e(the)g(fourth)g(step,)g(b)q(efore)g(some) g(of)f(the)i(common)e(mem)o(b)q(ers)h(could)h(b)q(e)g(mo)o(v)o(ed,)e(sev)o (eral)h(struc-)37 2167 y(tural)h(mo)q(di\014cations)h(to)f(the)f(sub)q(classe\ s)j(w)o(ere)d(needed.)21 b(F)l(or)13 b(example,)i(o)o(v)o(er)e(90)g(p)q(ercen) o(t)h(of)g(the)g(co)q(de)g(for)37 2224 y(the)h fi(mapUnit)f fl(function)h(in) h(the)e ff(SystemVIno)q(de)g fl(class)g(w)o(as)g(the)g(same)g(as)g(the)h fi (mapUnit)f fl(function)h(de\014ned)37 2280 y(in)k(the)e ff(BSDIno)q(de)h fl (class.)27 b(Ho)o(w)o(ev)o(er,)16 b(the)h(co)q(de)h(for)f(getting)g(and)g(set\ ting)g(a)g(logical)i(blo)q(c)o(k)f(n)o(um)o(b)q(er)f(w)o(as)37 2337 y(di\013e\ ren)o(t)g(b)q(et)o(w)o(een)f(the)g(t)o(w)o(o)e(\014le)j(system)e(formats,)g (hence)h(there)g(w)o(ere)g(a)f(few)h(di\013erences)h(in)g(the)f(imple-)37 2393 y(men)o(tation)g(of)f(the)h fi(mapUnit)g fl(functions.)22 b(Before)16 b(the)g (function)h(could)g(b)q(e)f(migrated)g(to)f(the)h(sup)q(erclass,)37 2449 y (these)e(di\013erences)g(needed)h(to)e(b)q(e)h(tak)o(en)f(out)f(of)h(the)h (sub)q(class)g(de\014nitions)h(of)e(the)g fi(mapUnit)h fl(function.)20 b(T)l (o)37 2506 y(handle)d(this,)e(the)h(follo)o(wing)f(structural)h(c)o(hanges)f (w)o(ere)g(made:)55 2600 y fh(4a\))24 b fl(new)15 b(functions)h(w)o(ere)f(de\ \014ned)h(in)g(eac)o(h)g(sub)q(class)g(to)f(capture)g(the)g(di\013erences)952 2760 y(14)g eop bop 55 42 a fh(4b\))23 b fl(in)e(the)f(de\014nitions)i(of)d (the)h fi(mapUnit)g fl(function,)i(the)e(di\013ering)g(co)q(de)h(w)o(as)e(rep\ laced)i(b)o(y)f(calls)h(to)151 98 y(these)16 b(functions.)55 192 y fh(4c\))23 b fl(the)15 b(sub)q(class)h(de\014nitions)g(of)e(the)h fi(mapUnit)f fl(functi\ on)i(no)o(w)e(matc)o(hed,)g(and)h(the)g(function)g(could)h(b)q(e)151 248 y (migrated)f(to)g(the)g(sup)q(erclass.)108 342 y(Note)e(that)g(of)g(the)h(four) f(steps)h(listed)h(ab)q(o)o(v)o(e)e(for)g(de\014ning)i(the)e(abstract)g(class) h(and)g(adding)g(System)f(V)37 399 y(features,)k(only)g(in)g(step)g(t)o(w)o (o)e(w)o(as)h(the)g(functionalit)o(y)i(of)e(the)h(system)f(c)o(hanged.)24 b (The)17 b(other)f(three)h(steps)37 455 y(w)o(ere)i(refactorings.)29 b(Step)19 b(one,)g(where)f(the)h(class)g(w)o(as)e(renamed,)j(w)o(as)d(clearly)j(needed) g(to)d(distinguish)37 511 y(the)d(old)h(\014le)g(format)d(from)h(the)h(new)h (format,)d(added)j(in)f(step)g(t)o(w)o(o.)k(Steps)c(three)g(and)g(four)g(adde\ d)g(no)g(new)37 568 y(features)h(to)f(the)i(system,)e(but)h(w)o(ere)g(applied) i(to)d(pro)q(duce)i(an)f(abstraction)f(that)h(allo)o(w)o(ed)g(additional)h (\014le)37 624 y(system)e(formats)e(to)i(b)q(e)g(more)g(easily)h(added)f(late\ r.)20 b(The)14 b(\014le)h(system)e(framew)o(ork)g(follo)o(w)o(ed)h(an)g(ev)o (olution)37 681 y(t)o(ypical)19 b(of)e(application)i(framew)o(orks:)24 b(as) 17 b(the)h(framew)o(ork)e(matured)h(and)h(reusable)h(abstractions)e(w)o(ere) 37 737 y(made)e(explicit,)h(new)e(features)f(suc)o(h)i(as)e(supp)q(ort)h(for) g(the)g ff(MS-DOS)1231 721 y fw(TM)1304 737 y fl(\014le)h(system)f(format)e (and)i(supp)q(ort)37 794 y(for)h(p)q(ersisten)o(t)h(ob)s(jects)e(w)o(ere)h (more)g(easily)h(in)o(tegrated)f(in)o(to)g(the)h(framew)o(ork)1411 777 y fs (5)1429 794 y fl(.)108 850 y(Note)e(also)g(that)f(in)i(the)f(ab)q(o)o(v)o(e)g (example,)h(steps)f(three)g(and)g(four)g(could)h(ha)o(v)o(e)f(come)g(b)q(efor\ e)g(step)g(t)o(w)o(o;)37 907 y(an)20 b(abstract)e(sup)q(erclass)i(could)g(ha) o(v)o(e)f(b)q(een)h(de\014ned)g(and)g(some)e(mem)o(b)q(ers)i(migrated)f(b)q (efore)g(the)g(new)37 963 y(class)i(w)o(as)e(added.)34 b(The)20 b(imp)q(ortan) o(t)g(p)q(oin)o(t)g(here)g(is)h(that)e(restructurings)h(are)f(a)h(critical)h (part)f(of)f(this)37 1020 y(high-lev)o(el)g(op)q(eration,)d(and)h(that)e(the) i(refactorings)e(can)i(b)q(e)g(separated)f(from)f(the)h(op)q(erations)h(that) e(add)37 1076 y(or)g(c)o(hange)g(functionalit)o(y)i(in)f(the)f(implemen)o(tat\ ion.)108 1132 y(Chapter)g(six)h(de\014nes)g(the)f(high-lev)o(el)j(op)q(eratio\ ns)d(for)g(de\014ning)h(an)f(abstract)g(sup)q(erclass.)37 1276 y fd(3.3)70 b (Refactoring)33 b(T)-6 b(o)34 b(Sp)r(ecializ)o(e:)48 b(Sub)r(classing)33 b (and)i(Simplifyi)o(ng)194 1350 y(Conditionals)37 1452 y fl(Sometimes)14 b(a)f (program)f(con)o(tains)h(a)g(class)g(that)g(em)o(b)q(o)q(dies)h(a)f(general)h (abstraction)e(and)i fi(sever)n(al)f(di\013er)n(ent)37 1508 y fl(concrete)23 b (cases.)40 b(In)23 b(this)f(case,)i(the)e(design)h(of)f(an)g(application)i (framew)o(ork)c(ma)o(y)i(b)q(e)g(impro)o(v)o(ed)h(b)o(y)37 1565 y(sp)q(eciali\ zi)q(ng;)k(that)21 b(is,)j(b)o(y)e(de\014ning)h(sub)q(classes)g(corresp)q(ond\ ing)g(to)e(the)h(cases,)h(and)f(migrating)f(case)37 1621 y(sp)q(eci\014c)d (b)q(eha)o(vior)d(do)o(wn)g(to)g(the)g(sub)q(classes.)108 1678 y(In)o(teresti\ ngly)l(,)25 b(while)f(refactoring)f(to)e(sp)q(ecialize)26 b(is)d(di\013eren)o (t)g(in)g(sev)o(eral)g(imp)q(ortan)o(t)f(w)o(a)o(ys)f(from)37 1734 y(refactor\ ing)h(to)g(generalize)i(\(discussed)f(in)g(the)g(prior)f(section\),)i(the)e (end)h(results)g(of)f(applying)h(these)37 1791 y(t)o(w)o(o)18 b(refactorings) h(are)f(v)o(ery)h(similar.)32 b(Generalizing)21 b(using)f(abstract)d(classes,) j(and)g(sp)q(ecializing)i(using)37 1847 y(sub)q(classing,)c(b)q(oth)e(can)g (b)q(e)h(used)f(to)g(capture)g(a)f(common)h(abstraction)g(in)g(an)g(abstract) f(sup)q(erclass)i(and)37 1903 y(capture)f(the)f(case-sp)q(eci\014c)i(b)q(eha) o(vior)f(in)g(the)f(sub)q(classes.)108 1960 y(In)i(order)f(to)g(appreciate)h (the)g(need)g(for)f(this)g(refactoring,)g(it)h(is)g(imp)q(ortan)o(t)f(to)g (understand)h(the)f(role)37 2016 y(of)f(subt)o(yping)g(for)f(sp)q(ecializatio\ n.)23 b(A)14 b fi(typ)n(e)h fl(c)o(haracterizes)g(the)g(b)q(eha)o(vior)g(of)g (its)f(instances)i(b)o(y)f(describing)37 2073 y(the)k(op)q(erations)f(that)f (can)h(manipulate)h(those)f(ob)s(jects)f([53)o(].)28 b(A)18 b(program)f(with) h(a)g(w)o(ell-designed)i(t)o(yp)q(e)37 2129 y(structure)c(will)h(minimize)h (and)d(lo)q(calize)j(the)d(dep)q(endencie)q(s)j(among)d(t)o(yp)q(es,)g(enhanc\ ing)i(main)o(tainabilit)o(y)37 2186 y(and)11 b(extensibilit)o(y)l(.)21 b(A)11 b fi(typ)n(e)h(hier)n(ar)n(chy)f fl(is)g(comp)q(osed)g(of)f(subt)o(yp)q(es)h (and)f(sup)q(ert)o(yp)q(es.)19 b(The)11 b(in)o(tuitiv)o(e)h(notion)37 2242 y (of)i(a)g(subt)o(yp)q(e)g(is)h(one)f(whose)g(ob)s(jects)f(pro)o(vide)i(all)g (the)f(b)q(eha)o(vior)h(of)e(another)h(t)o(yp)q(e)g(\(the)g(sup)q(ert)o(yp)q (e\))g(plus)37 2299 y(something)19 b(extra.)29 b(Subt)o(yping)20 b(is)f(most) f(frequen)o(tly)h(used)g(to)f(mo)q(del)h(conceptual)h(hierarc)o(hies.)31 b (When)37 2355 y(used)14 b(in)h(this)e(w)o(a)o(y)l(,)g(a)g(subt)o(yp)q(e)h(des\ crib)q(es)h(a)e(t)o(yp)q(e)g(that)g(is)h(more)f(sp)q(eci\014c)i(than)e(a)g (sup)q(ert)o(yp)q(e;)i(the)e(subt)o(yp)q(e)37 2412 y(is)j(a)f(sp)q(ecializati\ on)j(of)d(the)g(sup)q(ert)o(yp)q(e)h([53)o(,)f(74)o(].)37 2495 y 750 2 v 89 2522 a fu(5)107 2538 y fp(MS-DOS)e(is)h(a)f(trademark)h(of)e(Microsoft)i(Corp) q(oration.)952 2760 y fl(15)g eop bop 108 42 a fl(Inheritance)15 b(can)e(b)q (e)g(used)h(in)g(sev)o(eral)f(w)o(a)o(ys;)f(some)h(clarify)h(the)f(design)h (of)e(a)h(framew)o(ork)e(while)k(others)37 98 y(can)k(mak)o(e)f(a)h(framew)o (ork)e(more)h(di\016cult)i(to)f(understand.)30 b(One)20 b(use)f(of)f(inherita\ nce)j(is)e(to)f(mo)q(del)h(the)37 154 y(t)o(yp)q(e)f(hierarc)o(h)o(y)f(-)g (that)g(is,)g(represen)o(t)g(the)g(sup)q(ert)o(yp)q(e)h(as)f(a)g(sup)q(erclas\ s)h(and)f(a)g(subt)o(yp)q(e)g(as)g(a)g(sub)q(class.)37 211 y(Ho)o(w)o(ev)o (er,)k(inheritance)h(can)e(b)q(e)h(used)g(in)g(other)f(w)o(a)o(ys.)35 b(Inher\ itance)22 b(is)e(sometimes)h(used)g(to)e(supp)q(ort)37 267 y(programming-b)o (y-di\013erence,)e(where)f(the)g(programmer)f(dev)o(elops)i(a)e(new)h(class)h (b)o(y)e(c)o(ho)q(osing)i(a)e(similar)37 324 y(existing)j(class,)g(inheriting) h(implemen)o(tation)f(from)e(it)h(and)g(implemen)o(ting)i(the)e(di\013erences) h(in)g(the)f(new)37 380 y(sub)q(class.)k(In)15 b(this)g(case,)f(the)g(sub)q (class)i(ma)o(y)d(not)h(b)q(e)h(a)f(sp)q(ecialization)j(of)d(the)g(sup)q(ercl\ ass)i(-)e(the)g(resulting)37 437 y(class)20 b(hierarc)o(h)o(y)f(ma)o(y)g(not) g(mo)q(del)h(an)o(y)e(meaningful)j(concept)e(\(other)g(than)g(exp)q(edien)o (t)i(co)q(de)e(cop)o(ying\))37 493 y(and)d(can)f(b)q(e)h(di\016cult)h(to)d (understand.)108 550 y(Lisk)o(o)o(v)f([74)o(])f(argues)g(that)f(using)i(inher\ itance)h(to)e(mo)q(del)h(the)g(t)o(yp)q(e)f(hierarc)o(h)o(y)h(supp)q(orts)f (data)g(abstrac-)37 606 y(tion,)19 b(whic)o(h)g(can)f(simplify)h(program)e (main)o(tenance.)29 b(Lisk)o(o)o(v)18 b(notes)g(sev)o(eral)g(uses)g(of)f(sup) q(ert)o(yping)i(and)37 663 y(subt)o(yping)d(in)g(ob)s(ject-orien)o(ted)g(syst\ ems,)e(including:)106 756 y fj(\017)22 b fl(de\014ning)17 b(a)d(sup)q(ert)o (yp)q(e)i(to)e(capture)h(the)h(design)f(insigh)o(t)h(that)e(a)h(set)g(of)f (existing)i(t)o(yp)q(es)f(are)g(related)106 850 y fj(\017)22 b fl(incremen)o (tally)d(re\014ning)g(the)f(design)g(of)f(a)h(system)f(b)o(y)g(in)o(tro)q(duc\ ing)i(subt)o(yp)q(e\(s\))f(that)e(are)i(re\014ne-)151 907 y(men)o(ts)d(of)g (a)g(common)f(abstraction.)108 1000 y(Exp)q(erience)f(with)f(ob)s(ject-orien) o(ted)g(application)h(framew)o(orks)d(has)h(suggested)h(that,)f(while)i(subt) o(yping)37 1057 y(is)h(useful)h(for)e(sp)q(ecializing,)j(the)e(class)f(b)q (eing)i(sp)q(ecialized)h(often)e(do)q(es)f(not)g(start)f(out)h(b)q(eing)i(abs\ tract,)d(but)37 1113 y(rather)17 b(is)g(a)f(concrete)h(class)g(that)f(con)o (tains)h(a)g(reusable)g(abstraction.)24 b(A)17 b(class)g(sometimes)g(em)o(b)q (o)q(dies)h(a)37 1170 y(general)d(abstraction)f(and)h fi(sever)n(al)f(di\013e\ r)n(ent)g fl(concrete)g(cases)g(whic)o(h)h(are)f(candidates)i(for)d(sp)q(ecia\ lization.)37 1226 y(Often)g(the)f(b)q(eha)o(vior)g(that)g(distinguishes)i(the) e(concrete)g(examples)h(is)f(enco)q(ded)i(on)d(the)h(state)g(of)f(an)h(ob)s (ject)37 1283 y(as)h(\015ags,)g(tags)g(and)g(conditions.)20 b(As)14 b(Stroust\ up)f(notes)g(in)h([114)o(],)f(represen)o(ting)g(the)h(b)q(eha)o(vior)g(in)g (this)f(w)o(a)o(y)37 1339 y(ma)o(y)h(w)o(ork)g(\014ne)h(for)f(small)h(program\ s)e(written)h(b)o(y)h(a)f(single)i(p)q(erson,)e(but)h(has)f(a)g(fundamen)o (tal)h(w)o(eakness:)37 1396 y(it)j(dep)q(ends)h(on)e(the)h(programmer)e(manip\ ulating)j(the)e(sp)q(ecializations)j(\(t)o(yp)q(es\))d(in)h(a)f(w)o(a)o(y)f (that)h(cannot)37 1452 y(b)q(e)g(c)o(hec)o(k)o(ed)f(b)o(y)f(the)g(compiler.) 22 b(Problems)16 b(arise)g(if)g(the)f(programmer)f(fails)j(to)d(test)h(a)g (t)o(yp)q(e)h(\015ag,)f(or)g(fails)37 1509 y(to)h(include)j(all)e(the)g(t)o (yp)q(es)f(in)h(conditional)h(statemen)o(ts.)23 b(Co)q(de)16 b(that)g(include\ s)j(the)d(explicit)j(conditional)37 1565 y(tests)c(can)g(b)q(e)h(large)g(and) f(di\016cult)i(to)d(read.)108 1621 y(When)e(the)f(functions)h(de\014ned)g(in) g(a)f(class)g(ha)o(v)o(e)g(conditional)i(statemen)o(ts)d(that)g(eac)o(h)h(tes\ t)g(for)g(the)g(same)37 1678 y(set)19 b(of)g(conditions,)h(this)f(ma)o(y)g (suggest)f(that)g(sub)q(classes)i(should)g(b)q(e)f(de\014ned)i(corresp)q(ondi\ ng)e(to)g(those)37 1734 y(conditions.)j(Or,)15 b(stated)g(more)g(precisely)l (,)i(when)e(the)h(functions)g(de\014ned)h(in)f(the)f(class)h(ha)o(v)o(e)f(con\ ditional)37 1791 y(statemen)o(ts)i(that)g(eac)o(h)h(test)f(for)h(the)f(same)h (set)g(of)f(conditions,)i(a)f(set)f(of)h(sub)q(classes)h(could)g(b)q(e)f(de\ \014ned)37 1847 y(eac)o(h)g(of)f(whose)h(corresp)q(onding)g(abstraction)g(imp\ lies)h(an)f(elemen)o(t)g(in)h(the)e(set)h(of)f(conditions.)28 b(In)18 b(eac)o (h)37 1904 y(newly)e(de\014ned)g(sub)q(class,)f(the)f(functions)h(can)g(b)q (e)g(simpli\014ed)i(b)o(y)d(replacing)i(the)f(conditional)h(statemen)o(ts)37 1960 y(with)g(just)f(the)g(co)q(de)h(segmen)o(t)f(for)f(the)i(condition)g(cor\ resp)q(onding)g(to)f(\(implied)i(b)o(y\))e(the)g(sub)q(class.)108 2017 y(Ther\ e)d(are)g(sev)o(eral)g(examples)h(of)f(this)g(t)o(yp)q(e)g(of)g(restructuring) g(that)f(o)q(ccurred)i(in)g(the)f fi(T)m(yp)n(e)n(d)g(Smal)r(ltalk)37 2073 y fl([60])f(pro)s(ject)f(and)i(the)g fi(Choic)n(es)e fl(op)q(erating)i(system)f (pro)s(ject;)g(it)h(w)o(as)f(also)g(useful)i(in)f(con)o(v)o(erting)f(a)h(prog\ ram)37 2130 y(written)k(in)g(the)f(C)g(programming)g(language)g(to)g(C++.)108 2186 y(The)h fi(T)m(yp)n(e)n(d)f(Smal)r(ltalk)g fl(\(TS\))f(pro)s(ject)h(is)h (dev)o(eloping)h(an)e(optimizing)i(compiler)g(for)d(a)i(t)o(yp)q(ed)f(v)o(ers\ ion)37 2242 y(of)i(Smalltalk.)25 b(In)17 b(the)f(TS)h(compiler,)h(instances)f (of)f(the)h ff(Flo)o(wNo)q(de)g fl(class,)f(represen)o(ting)i(a)e(basic)h(blo) q(c)o(k,)37 2299 y(are)g(con)o(tainers)g(of)g(a)f(sequence)i(of)f(straigh)o (t)f(line)j(co)q(de)e(\(assignmen)o(ts\))f(ending)i(with)g(a)e(statemen)o(t)g (that)37 2355 y(alters)h(the)f(\015o)o(w)f(of)h(con)o(trol.)23 b(The)16 b(end\ ing)h(statemen)o(t)e(in)i(the)g(sequence)g(could)g(b)q(e)g(a)f(return)g(state\ men)o(t,)37 2412 y(a)21 b(conditional)h(jump)e(statemen)o(t)g(or)g(an)g(uncon\ ditional)j(jump)e(statemen)o(t.)34 b(As)21 b(the)f(implemen)o(tation)37 2468 y (progressed,)g(sev)o(eral)f(functions)g(needed)h(to)f(test)f(the)h(t)o(yp)q (e)g(of)f(the)h(ending)h(statemen)o(t.)30 b(F)l(or)18 b(example,)37 2525 y (one)h(function)g(tested)g(if)g(the)f(ending)i(statemen)o(t)d(w)o(as)h(a)g (conditional)i(jump;)g(if)f(so,)f(and)h(the)f(condition)37 2581 y(w)o(as)h (an)g(in)o(v)m(arian)o(t)h(for)f(the)g(en)o(tire)h(sequence)g(represen)o(ted) g(b)o(y)f(the)h ff(Flo)o(wNo)q(de)p fl(,)g(the)f(conditional)i(jump)952 2760 y (16)g eop bop 37 42 a fl(could)22 b(b)q(e)f(con)o(v)o(erted)f(to)g(an)g(uncon\ ditional)j(jump.)35 b(Another)21 b(function)g(tested)f(whether)h(the)f(ending) 37 98 y(statemen)o(t)e(w)o(as)g(an)g(unconditional)j(jump)e(to)f(a)g(sequence) i(represen)o(ted)f(b)o(y)f(another)g ff(Flo)o(wNo)q(de)p fl(;)i(if)f(so,)37 154 y(the)d(t)o(w)o(o)e ff(Flo)o(wNo)q(des)h fl(could)i(b)q(e)e(merged)h(and) f(replaced)h(b)o(y)g(a)e(single)j ff(Flo)o(wNo)q(de)p fl(.)108 211 y(In)d(the) g(early)g(designs,)h(it)f(had)g(not)f(b)q(een)i(clear)f(that)f(the)h(t)o(yp)q (e)g(of)f(the)h(ending)h(statemen)o(t)d(w)o(as)h(an)h(im-)37 267 y(p)q(ortan) o(t)g(discriminator)i(among)e ff(Flo)o(wNo)q(des)p fl(.)20 b(Ho)o(w)o(ev)o (er,)14 b(as)g(the)h(design)g(matured,)f(the)h(implemen)o(tation)37 324 y(of) j ff(Flo)o(wNo)q(de)f fl(w)o(as)g(man)o(ually)i(refactored:)24 b ff(Flo)o(wNo) q(de)18 b fl(b)q(ecame)g(an)f(abstract)g(sup)q(erclass)i(and)e(the)h(con-)37 380 y(crete)g(sub)q(classes)h ff(UncondJumpFlo)o(wNo)q(de)p fl(,)f ff(CondJum\ pFlo)o(wNo)q(de)g fl(and)f ff(ReturnFlo)o(wNo)q(de)j fl(w)o(ere)d(added.)37 437 y(The)j(conditional)g(statemen)o(ts)e(w)o(ere)g(simpli\014ed.)34 b(This) 19 b(refactoring)g(made)f(the)h(design)h(easier)f(to)g(read)37 493 y(and)d (mo)q(dify)l(.)108 550 y(A)c(similar)g(refactoring)g(w)o(as)e(applied)k(at)d (sev)o(eral)g(stages)g(in)h(the)g(ev)o(olution)g(of)g(the)f fi(Choic)n(es)g fl (\014le)h(system.)37 606 y(In)i(an)e(early)h(v)o(ersion,)h(the)e ff(MSDOSEntr\ y)i fl(class)f(de\014ned)h(directory)f(en)o(tries)g(in)h(the)f(MSDOS)g(format\ .)k(The)37 663 y fi(mapUnit)e fl(mem)o(b)q(er)f(function)h(included)i(a)d(con\ ditional)i(to)e(handle)h(the)g(case)f(when)h(the)f(\014le)h(w)o(as)f(the)g (ro)q(ot)37 719 y(directory)l(.)32 b(A)19 b(man)o(ual)g(refactoring)f(of)h (the)g(co)q(de)g(included)j(adding)e(a)e(new)h(sub)q(class)h(called)h ff(MSDO\ S-)37 775 y(Ro)q(otEntry)e fl(and)f(streamlining)h(the)e fi(mapUnit)h fl(func\ tion)g(in)h(the)e ff(MSDOSEntry)i fl(and)f ff(MSDOSRo)q(otEntry)37 832 y fl (classes.)j(Later,)14 b(in)h(the)f ff(P)o(ersistentMemo)o(ryObject)g fl(class) h(there)g(w)o(as)e(a)h(conditional)i(that)e(tested)g(whether)37 888 y(or)f (not)f(a)g(con)o(tainer)h(attribute)f(w)o(as)g(n)o(ull.)20 b(T)l(o)12 b(discr\ iminate)j(b)q(et)o(w)o(een)e(the)f(cases,)h(a)f(new)h(sub)q(class)h ff(FileOb\ -)37 945 y(ject)f fl(w)o(as)e(added.)19 b(These)13 b(c)o(hanges)e(made)h(the) g(design)h(of)e(the)h(Choices)g(File)h(System)f(easier)g(to)f(understand.)108 1001 y(Another)17 b(b)q(ene\014t)h(that)f(is)g(sometimes)g(realized)i(b)o(y)e (replacing)h(conditional)h(tests)d(with)i(sub)q(classing)37 1058 y(is)f(that) e(the)h(run)g(time)g(p)q(erformance)g(ma)o(y)f(impro)o(v)o(e,)g(as)h(rep)q (orted)g(b)o(y)f(Russo)i(and)f(Kaplan)g([105)o(].)21 b(They)37 1114 y(p)q(ort\ ed)16 b(a)e(Sc)o(heme)i(in)o(terpreter)f(from)g(the)g(C-language)g(to)f(C++.) 21 b(In)15 b(a)g(traditional)h(C)f(implemen)o(tation,)37 1171 y(the)k(corners\ tones)f(are)g(a)g(discrimination)j(union)f(and)e(a)g(pro)q(cedure)i(b)q(o)q (dy)f(that)f(is)h(essen)o(tially)h(a)e(gian)o(t)37 1227 y(switc)o(h)h(stateme\ n)o(t.)27 b(In)19 b(their)f(C++)h(implemen)o(tation,)g(they)f(distributed)i (the)e(switc)o(h)g(statemen)o(t)f(o)o(v)o(er)37 1284 y(classes)h(represen)o (ting)f(the)g(cases,)g(and)g(found)h(that)e(this)h(made)g(the)g(co)q(de)g(mor\ e)g(mo)q(dular)g(and)g(reduced)37 1340 y(main)o(tenance)f(e\013ort,)e(while)j fi(sp)n(e)n(e)n(ding)d(up)i fl(the)f(in)o(terpreter.)108 1396 y(Th)o(us,)d (sub)q(classing,)i(and)f(reducing)g(the)f(conditional)i(statemen)o(ts,)d(ma)o (y)g(impro)o(v)o(e)h(b)q(oth)g(the)g(clarit)o(y)h(of)37 1453 y(the)f(design)g (and)f(the)g(run-time)h(p)q(erformance.)19 b(While)13 b(this)e(refactoring)g (is)h(useful,)g(there)g(are)f(complexities)37 1509 y(with)16 b(it,)g(as)f(ill\ ustrated)i(in)g(the)e(Figure)h(3.2,)e(based)i(on)g(the)g(ab)q(o)o(v)o(e)f(dis\ cussion)i(of)e ff(Flo)o(wNo)q(des)h fl(in)h(the)e(TS)37 1566 y(compiler.)108 1622 y(In)f(the)f(example,)h(sub)q(classes)g(are)e(added)i(corresp)q(onding)g (to)e(the)h(conditions.)21 b(Put)13 b(another)f(w)o(a)o(y)l(,)g(the)37 1679 y ff(Flo)o(wNo)q(de)g fl(class)g(co)o(v)o(ered)g(a)f(large)h(n)o(um)o(b)q(er)g (of)g(states,)f(and)h(the)f(newly)i(de\014ned)g(sub)q(classes)g(partition)f (that)37 1735 y(state)17 b(space.)26 b(While)19 b(in)f(this)g(example)g(it)f (ma)o(y)g(b)q(e)h(in)o(tuitiv)o(ely)h(ob)o(vious)f(to)e(the)i(programmer)e (ho)o(w)g(the)37 1792 y(optimize)h(function)g(should)g(b)q(e)f(simpli\014ed)j (in)e(eac)o(h)e(sub)q(class,)i(it)f(w)o(ould)g(not)g(b)q(e)g(ob)o(vious)g(to) g(a)f(compiler)37 1848 y(or)20 b(a)f(restructuring)h(to)q(ol.)33 b(In)20 b fi (C++)f fl(there)h(is)g(no)g(easy)f(w)o(a)o(y)g(to)g(describ)q(e)i(the)f(condi\ tion)h(\(i.e.)33 b(set)20 b(of)37 1905 y(states\))f(co)o(v)o(ered)g(b)o(y)g (a)g(class.)33 b(F)l(or)19 b(refactoring,)h(this)g(design)g(information)g(is) g(represen)o(ted)f(as)g(a)h fi(class)37 1961 y(invariant)p fl(,)c(whic)o(h)h (is)g(a)e(predicate)i(kno)o(wn)f(to)f(b)q(e)i(true)f(throughout)g(the)g(lifet\ ime)h(of)f(eac)o(h)g(instance)h(of)f(a)37 2017 y(class.)29 b(In)19 b(refactor\ ing,)f(a)g(class)g(in)o(v)m(arian)o(t)h(is)g(assigned)f(to)g(eac)o(h)g(sub)q (class,)h(and)g(the)f(class)g(in)o(v)m(arian)o(t)h(is)37 2074 y(used)f(to)e (simplify)j(the)e(conditional)h(statemen)o(t.)24 b(In)18 b(general,)f(the)g (problems)g(of)g(determining)h(if)g(a)e(class)37 2130 y(in)o(v)m(arian)o(t)h (holds)f(for)f(a)g(class,)h(and)g(simplifying)i(a)d(conditional)j(statemen)o (t)c(giv)o(en)i(a)g(class)g(in)o(v)m(arian)o(t,)g(are)37 2187 y(undecidable.) 22 b(F)l(ortunately)l(,)13 b(these)g(problems)g(are)f(decidable)j(for)d(man)o (y)g(common)g(cases.)19 b(Chapter)12 b(sev)o(en)37 2243 y(de\014nes)17 b(this) e(refactoring.)37 2386 y fd(3.4)70 b(Capturing)23 b(Aggregations)h(and)g(Comp) r(onen)n(ts)37 2488 y fl(The)19 b(t)o(w)o(o)d(previous)j(sections)f(discussed) i(refactorings)d(that)g(re\014ne)i(an)f(inheritance)h(hierarc)o(h)o(y)l(.)29 b (Inheri-)37 2544 y(tance)16 b(is)g(a)f(p)q(o)o(w)o(erful)h(tec)o(hnique,)h (but)e(in)i(mo)q(deling)g(the)f(relationships)h(among)e(classes)h(it)f(is)h (sometimes)952 2760 y(17)g eop bop 73 0 a 28483502 22365798 5920358 28680847 34403860 51046645 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Helvetica-Bold Courier-Bold %%Pages: 1 %%BoundingBox: 90 436 523 776 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 348 966 ] concat %I [ (BEFORE:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 1 -6 ] concat %I 158 461 158 461 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 195 937 ] concat %I [ (FlowNode:) ( enum {conditional_jump, unconditional_jump,) ( return_statement} final_statement;) ( void optimize\(\) {) ( if \(final_statement == conditional_jump\)) ( ) ( else if \(final_statement == unconditional_jump\)) ( ) ( else if \(final_statement == return_statement\)) ( ) ( }) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 351 794 ] concat %I [ (AFTER:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 348 763 ] concat %I [ (FlowNode) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 114.711 718.229 ] concat %I [ ( CondJumpFlowNode:) () ( \(class invariant:) ( final_statement ==) ( conditional_jump\)) () ( void optimize\(\) {) ( ) ( }) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 332 773 201 741 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -12 -14 ] concat %I 431 774 561 742 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 460 770 460 771 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 9 -4 ] concat %I 460 770 460 771 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 376 763 376 677 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 300.458 653.494 ] concat %I [ ( UncondJumpFlowNode:) () ( \(class invariant:) ( final_statement ==) ( unconditional_jump\)) () ( void optimize\(\) {) ( ) ( }) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 477.53 718.88 ] concat %I [ ( ReturnFlowNode:) () ( \(class invariant:) ( final_statement ==) ( return_statement\)) () ( void optimize\(\) {) ( ) ( }) ] Text End End %I eop showpage %%Trailer end endTexFig 455 1545 a fh(Figure)18 b(3.2)p fl(:)h(Simplifying)f(Mem)o(b)q (er)e(F)l(unction)g fi(optimize)37 1678 y fl(o)o(v)o(erused)22 b(and)g(incorr\ ectly)h(used.)40 b(This)22 b(section)g(considers)h(refactorings)e(to)g(supp)q (ort)h fi(aggr)n(e)n(gations)p fl(,)37 1734 y(whic)o(h)17 b(mo)q(del)f(some)f (whole-part)g(asso)q(ciations)g(b)q(et)o(w)o(een)h(ob)s(jects.)108 1791 y(An) k(aggregate)e(ob)s(ject,)i(sometimes)f(called)i(a)f(comp)q(osite)g(ob)s(ject) f(or)g(a)g(con)o(tainer,)h(is)g(made)g(up)g(of)37 1847 y(comp)q(onen)o(ts.)g (Comp)q(onen)o(ts)15 b(are)g(stored)g(as)f(mem)o(b)q(er)i(v)m(ariables)g(in)g (the)f(aggregate)f(ob)s(ject;)g(ho)o(w)o(ev)o(er,)g(as)37 1904 y(describ)q (ed)k(b)q(elo)o(w,)e(not)g(all)h(mem)o(b)q(er)e(v)m(ariables)j(store)d(comp)q (onen)o(t)h(ob)s(jects.)21 b(One)16 b(imp)q(ortan)o(t)g(qualit)o(y)g(of)37 1960 y(comp)q(onen)o(ts)f(needed)h(in)f(refactoring)f(is)h(that)e(a)h(comp)q (onen)o(t)h(ob)s(ject)f(cannot)g(b)q(e)h(assigned)g(to)f(more)g(than)37 2017 y (one)i(aggregate)e(ob)s(ject)g(at)h(a)g(time.)108 2073 y(Whole-part)20 b(rela\ tionships)g(among)f(ob)s(jects)g(are)g(sometimes)g(not)g(ob)o(vious)h(un)o (til)g(implemen)o(tation)37 2130 y(is)e(underw)o(a)o(y)l(.)24 b(A)17 b(relati\ onship)i(migh)o(t)d(\014rst)h(b)q(e)g(mo)q(deled)i(using)e(inheritance)i(and) e(later)f(is)i(re\014ned)f(in)o(to)37 2186 y(an)g(aggregation.)k(Refactorings) 16 b(can)h(help)g(mak)o(e)f(aggregations)f(more)g(explicit,)j(and)f(mak)o(e)e (comp)q(onen)o(t)37 2243 y(classes)h(more)f(reusable.)108 2299 y(The)c(follo) o(wing)g(sections)h(describ)q(e)g(mo)q(deling)g(whole-part)f(relationships,)i (mo)o(ving)d(mem)o(b)q(ers)h(b)q(et)o(w)o(een)37 2355 y(aggregate)i(and)h(com\ p)q(onen)o(t)g(classes,)g(and)g(con)o(v)o(erting)g(a)f(relationship)j(mo)q (deled)f(using)g(inheritance)g(in)o(to)37 2412 y(an)h(aggregation.)952 2760 y (18)g eop bop 37 42 a fe(3.4.1)56 b(Bac)n(kground:)25 b(Mo)r(deling)17 b(Whol\ e-P)n(art)h(Relationships)37 127 y fl(As)h(Wirfs-Bro)q(c)o(k,)h(Wilk)o(erson) f(and)g(Wiener)h(note)f([126)o(],)g(inheritance)h(is)g(a)e(natural)h(w)o(a)o (y)f(to)g(represen)o(t)37 184 y(some)12 b(but)h(not)f(all)h(in)o(terclass)g (relationships.)20 b(They)13 b(discuss)g(three)f(imp)q(ortan)o(t)g(relationsh\ ips)i(to)e(examine)37 240 y(when)k(structuring)g(an)f(ob)s(ject-orien)o(ted)g (system:)93 347 y(1.)22 b fi(is-kind-of)93 440 y fl(2.)g fi(is-analo)n(gous-t\ o)93 534 y fl(3.)g fi(is-p)n(art-of)108 640 y fl(If)13 b(ob)s(jects)e(of)h (class)g ff(A)h fl(are)f(a)g(kind)h(of)f ff(B)p fl(,)g(this)g(suggests)g(repr\ esen)o(ting)h ff(A)f fl(as)g(a)g(sub)q(class)h(of)f ff(B.)g fl(If)g(ob)s(ject\ s)37 697 y(of)19 b(class)g ff(A)g fl(are)g(analogous)f(to)g(ob)s(jects)g(of)h (class)g ff(B)p fl(,)g(this)g(ma)o(y)f(suggest)g(de\014ning)j(a)d(common)h (abstract)37 753 y(sup)q(erclass)f(that)f(captures)g(their)g(commonalities.) 26 b(Ho)o(w)o(ev)o(er,)16 b(if)i(an)e(ob)s(ject)h(of)f(class)h ff(A)h fl(is)f (a)g(part)f(of)h(an)37 810 y(ob)s(ject)e(of)g(class)g ff(B)p fl(,)h(inheritan\ ce)h(is)e(not)g(a)g(natural)g(w)o(a)o(y)f(to)h(represen)o(t)g(this.)108 866 y (Supp)q(ose,)22 b(for)d(example,)i(a)e(framew)o(ork)f(is)i(b)q(eing)h(designe\ d)g(to)e(sim)o(ulate)h(automobile)h(design)f(and)37 923 y(man)o(ufacture.)42 b (The)23 b(ob)s(jects)f fi(c)n(ar,)i(do)n(or,)i(r)n(o)n(of)c fl(and)h fi(tir)n (e)f fl(are)h(recognized)g(to)f(b)q(e)h(imp)q(ortan)o(t)g(in)g(this)37 979 y (application)18 b(and)d(classes)h(are)f(de\014ned)i(for)d(them.)21 b(These)16 b(ob)s(jects)e(ma)o(y)h(share)g(common)g(c)o(haracteristics)37 1036 y(suc)o (h)20 b(as)e(color)h(and)g(materials)g(used)g(in)g(their)h(man)o(ufacture,)e (but)h(it)g(is)h(unnatural)f(to)f(think)h(of)g(a)f(tire)37 1092 y(or)h(a)g (do)q(or)g(as)f(a)h(sp)q(ecialization)j(of)d(an)g(automobile)h(-)f(rather,)g (they)g(are)g(parts)f(of)h(an)g(automobile.)32 b(A)37 1148 y(mec)o(hanism)16 b (is)g(needed)h(for)d(represen)o(ting)i(this)g(whole/part)f(relationship.)108 1205 y(The)h(whole-part)f(relationship)j(is)d(a)h(sp)q(ecial)h(asso)q(ciation) f(b)q(et)o(w)o(een)f(ob)s(jects,)g(often)g(called)i(an)e fi(aggr)n(e-)37 1261 y(gation)p fl(.)20 b(There)c(are)f(man)o(y)f(examples)i([66)o(,)f(126)o(])g (of)g(aggregations:)106 1368 y fj(\017)22 b fl(a)15 b(car)g(and)g(its)h(autom\ otiv)o(e)e(parts)106 1461 y fj(\017)22 b fl(a)15 b(compan)o(y)g(and)g(its)h (departmen)o(ts)106 1555 y fj(\017)22 b fl(a)15 b(dra)o(wing)g(and)h(its)f (dra)o(wing)g(elemen)o(ts)106 1649 y fj(\017)22 b fl(a)15 b(program)f(and)h (its)h(program)e(fragmen)o(ts)106 1743 y fj(\017)22 b fl(a)15 b(desk)h(lamp)f (and)h(the)f(parts)f(used)i(in)g(its)g(man)o(ufacture.)37 1849 y(Sev)o(eral)g (tests)f(ma)o(y)f(indicate)j(whether)e(an)g(asso)q(ciation)h(b)q(et)o(w)o(een) g(ob)s(jects)e(is)i(an)f(aggregation)f([101)o(]:)106 1955 y fj(\017)22 b fl (Is)16 b(one)f(ob)s(ject)g(part)f(of)h(the)g(other?)106 2049 y fj(\017)22 b fl (Are)15 b(some)g(op)q(erations)h(on)f(the)g(\\whole")g(applied)i(to)e(its)g (\\parts"?)106 2143 y fj(\017)22 b fl(Are)15 b(some)g(attribute)g(v)m(alues)i (propagated)d(from)h(the)g(whole)h(to)e(its)i(parts?)106 2237 y fj(\017)22 b fl(Is)16 b(there)g(an)f(in)o(trinsic)i(asymmetry)e(to)g(the)g(asso)q(ciation,) h(where)g(one)g(ob)s(ject)f(class)g(is)i(sub)q(ordinate)151 2293 y(to)e(the)g (other?)108 2400 y(The)k(aggregate)d(ob)s(ject,)i(sometimes)h(called)g(a)f (comp)q(osite)h(ob)s(ject)f(or)f(a)h(con)o(tainer,)h(is)g(made)f(up)h(of)37 2456 y(comp)q(onen)o(ts.)26 b(The)17 b(aggregate)f(ob)s(ject)g(can)i(b)q(e)f (treated)g(as)g(a)f(unit)i(for)f(man)o(y)f(op)q(erations.)26 b(One)18 b(asym-) 37 2513 y(metric)g(asp)q(ect)g(of)f(an)h(aggregation)e(is)j(that)e(the)g(aggr\ egate)f(ob)s(ject)h(usually)i(needs)g(to)e(kno)o(w)g(ab)q(out)g(its)37 2569 y (comp)q(onen)o(ts,)f(but)h(less)f(often)g(do)q(es)h(a)e(comp)q(onen)o(t)i(nee\ d)g(to)e(kno)o(w)h(either)g(ab)q(out)g(the)g(aggregate)f(ob)s(ject)952 2760 y (19)g eop bop 37 42 a fl(that)12 b(con)o(tains)h(it,)g(or)f(ab)q(out)h(other) f(comp)q(onen)o(ts.)19 b(During)13 b(design,)h(recognizing)g(that)e(an)h(asso) q(ciation)g(b)q(e-)37 98 y(t)o(w)o(een)g(ob)s(jects)g(is)h(an)f(aggregation)f (can)i(help)g(determine)g(where)g(the)f(b)q(eha)o(vior,)h(and)g(the)f(resp)q (onsibilitie)q(s)37 154 y(for)i(main)o(taining)h(information,)f(ough)o(t)g (to)f(b)q(e)i(placed.)108 211 y(The)j(decision)i(to)e(mo)q(del)h(an)f(asso)q (ciation)h(as)e(an)i(aggregation)e(is)h(a)g(matter)f(of)h(judgemen)o(t.)32 b (As)19 b(is)37 267 y(t)o(ypical)d(in)h(mo)q(deling,)f(there)f(are)g(few)g(har\ d)g(and)h(fast)e(rules)i([101)o(].)108 324 y fi(While)e(it)g(is)g(c)n(ommon)g (to)g(r)n(epr)n(esent)f(the)h(c)n(omp)n(onents)f(of)h(an)g(aggr)n(e)n(gate)g (obje)n(ct)f(as)h(memb)n(er)g(variables,)37 380 y(not)e(al)r(l)g(memb)n(er)g (variables)f(ne)n(c)n(essarily)f(r)n(epr)n(esent)h(c)n(omp)n(onents.)17 b fl (F)l(or)10 b(example,)i(mem)o(b)q(er)e(v)m(ariables)i(in)g(an)37 437 y ff(Aut\ omobile)h fl(class)i(migh)o(t)f(represen)o(t)h(its)f(color,)h(age)f(or)g(the) g(n)o(um)o(b)q(er)h(of)f(passengers)g(it)h(w)o(ould)g(accommo-)37 493 y(date.) 27 b(These)18 b(mem)o(b)q(er)f(v)m(ariables)i(represen)o(t)e(attributes)g(of) g(an)h(automobile)g(but)f(are)g(not)g(comp)q(onen)o(ts)37 550 y(of)i(it,)h (in)g(the)g(sense)f(that)g(a)g(tire)g(is)h(a)f(comp)q(onen)o(t)g(of)g(an)g (automobile.)32 b(Other)20 b(asso)q(ciations)f(b)q(et)o(w)o(een)37 606 y(ob)s (jects)14 b(that)f(do)g(not)h(necessarily)h(imply)g(an)f(aggregation)f(are)g (the)h(dep)q(ends-up)q(on)i(and)e(needs-to-kno)o(w-)37 663 y(ab)q(out)g(relat\ ionships.)21 b(F)l(or)13 b(example,)i(in)g(a)e(pro)s(ject)g(managemen)o(t)g (application,)j(an)e(ob)s(ject)f(represen)o(ting)37 719 y(a)i(pro)s(ject)g (task)f(ma)o(y)h(hold)h(p)q(oin)o(ters)f(to)g(other)g(task)f(ob)s(jects)h(tha\ t)f(dep)q(end)j(up)q(on)f(its)f(completion;)h(when)37 775 y(its)h(task)e(comp\ letes)h(it)g(send)h(messages)e(to)g(activ)m(ate)i(those)e(ob)s(jects.)21 b (Other)c(ob)s(jects)e(handling)i(the)f(user)37 832 y(in)o(terface)h(ma)o(y)e (hold)i(p)q(oin)o(ters)g(to)e(the)i(task)e(ob)s(jects,)h(so)f(that)h(they)g (can)g(query)h(the)f(task)f(ob)s(jects)h(when)37 888 y(a)f(status)e(graph)i (is)g(requested)f(b)o(y)h(the)f(user.)20 b(In)15 b(eac)o(h)g(of)f(these)h(cas\ es,)f(the)g(asso)q(ciation)h(b)q(et)o(w)o(een)g(ob)s(jects)37 945 y(is)h(di\ \013eren)o(t)g(from)e(the)h(whole/part)g(relationship.)108 1001 y(There)h(are) g(di\013eren)o(t)g(kinds)g(of)g(comp)q(onen)o(ts.)21 b(A)16 b(k)o(ey)g(distin\ ction)h(is)g(whether)f(a)f(comp)q(onen)o(t)h(ob)s(ject)37 1058 y(m)o(ust)i (b)q(e)h(exclusiv)o(e)h(to)e(one)h(aggregate)e(ob)s(ject,)h(or)g(whether)g (it)h(can)g(b)q(e)g(shared)f(b)o(y)g(sev)o(eral)h(aggregate)37 1114 y(ob)s (jects.)37 b(F)l(or)20 b(example,)j(in)f(a)f(pro)s(ject)f(managemen)o(t)g(app\ lication,)k(tasks)c(and)h(emplo)o(y)o(ees)h(are)e(b)q(oth)37 1171 y(comp)q (onen)o(ts)13 b(of)g(a)f(pro)s(ject.)19 b(While)14 b(a)f(task)f(w)o(ould)h (probably)h(b)q(e)f(exclusiv)o(e)i(to)d(one)h(pro)s(ject,)f(an)h(emplo)o(y)o (ee)37 1227 y(ma)o(y)21 b(b)q(e)i(shared)f(among)f(sev)o(eral)g(pro)s(jects.) 39 b(Refactorings)22 b(in)o(v)o(olving)h(aggregate)d(ob)s(jects)h(and)h(their) 37 1284 y(comp)q(onen)o(ts)16 b(require)g(that)f(a)h(comp)q(onen)o(t)f(ob)s (ject)g(b)q(e)h(exclusiv)o(e)i(to)d(one)g(aggregate)f(ob)s(ject,)h(for)g(reas\ ons)37 1340 y(describ)q(ed)j(b)q(elo)o(w.)37 1460 y fe(3.4.2)56 b(Mo)n(ving) 18 b(Mem)n(b)r(ers)f(Bet)n(w)n(een)i(Aggregate)f(and)h(Comp)r(onen)n(t)f(Clas\ ses)37 1546 y fl(When)d(an)g(aggregation)e(is)i(recognized,)h(it)e(can)h(help) h(in)f(partitioning)h(b)q(eha)o(vior)f(b)q(et)o(w)o(een)f(classes.)21 b(If)14 b(the)37 1602 y(classes)i(are)f(already)h(implemen)o(ted)h(b)q(efore)f(the)f (aggregation)f(is)i(recognized,)g(the)f(design)i(of)e(the)g(system)37 1658 y (ma)o(y)g(b)q(e)h(impro)o(v)o(ed)f(b)o(y)g(mo)o(ving)g(mem)o(b)q(ers)g(b)q (et)o(w)o(een)h(an)f(aggregate)f(ob)s(ject)g(and)h(its)h(comp)q(onen)o(t\(s\)\ .)j(F)l(or)37 1715 y(example,)c(w)o(arran)o(t)o(y)d(information)i(stored)g (in)g(the)g(tire)g(comp)q(onen)o(t)g(ma)o(y)g(more)f(appropriately)i(b)q(elon\ g)g(in)37 1771 y(its)i(aggregate)f(ob)s(ject)g(\(a)g(car\))g(if)i(the)e(resp) q(onsibili)q(t)o(y)j(for)d(managing)g(v)o(ehicle)j(main)o(tenance)f(is)f(assi\ gned)37 1828 y(to)f(the)f(car)h(class.)21 b(If)16 b(the)g(tires)g(are)f(comp) q(onen)o(ts)h(of)f(sev)o(eral)h(di\013eren)o(t)g(\(otherwise)f(unrelated\))i (classes)1880 1811 y fs(6)1900 1828 y fl(,)37 1884 y(mo)o(ving)f(b)q(eha)o (vior)g(out)f(of)g(the)g(tire)h(class)g(ma)o(y)e(in)o(v)o(olv)o(e)i(adding)g (it)g(to)f fi(sever)n(al)f fl(aggregate)g(classes,)i(whic)o(h)37 1941 y(can)g (b)q(e)g(complicated.)108 1997 y(F)l(or)c(example,)h(mo)o(ving)g(a)f(v)m(aria\ ble)i(from)e(an)g(aggregate)f(class)i(to)f(the)g(class)h(of)f(one)h(of)f(its) g(comp)q(onen)o(ts)37 2054 y(is)22 b(b)q(eha)o(vior)f(preserving)g(only)g(whe\ re)g(is)g(a)f(one-to-one)h(relationship)h(b)q(et)o(w)o(een)f(eac)o(h)g(instan\ ce)g(of)f(the)37 2110 y(aggregate)e(class)i(and)g(instances)g(of)f(the)h(clas\ s)g(to)e(whic)o(h)j(the)e(v)m(ariable)i(is)f(b)q(eing)h(mo)o(v)o(ed.)32 b(Oth\ erwise,)37 2167 y(if)23 b(a)e(comp)q(onen)o(t)h(ob)s(ject)f(w)o(ere)g(shared) h(among)f(more)h(than)f(one)h(aggregate)e(ob)s(ject)h(then)h(the)g(single)37 2223 y(new)c(v)m(ariable)i(in)e(the)g(\(shared\))f(comp)q(onen)o(t)h(w)o(ould) g(b)q(e)h(replacing)g(a)e(set)h(of)f(v)m(ariables,)j(one)d(in)i(eac)o(h)f(of) 37 2279 y(the)f(aggregate)e(ob)s(jects)g(that)h(con)o(tained)h(the)g(comp)q (onen)o(t;)f(information)h(could)g(b)q(e)g(lost)f(and)h(hence)g(the)37 2336 y (refactoring)e(w)o(ould)h(not)f(b)q(e)h(b)q(eha)o(vior)f(preserving.)108 2392 y fi(In)c(or)n(der)i(for)f(r)n(efactorings)f(involving)g(aggr)n(e)n(gates)g (and)h(their)h(c)n(omp)n(onents)d(to)j(b)n(e)e(b)n(ehavior)i(pr)n(eserving,) 37 2449 y(e)n(ach)k(c)n(omp)n(onent)f(must)h(b)n(e)f(exclusive)g(to)h(one)g (aggr)n(e)n(gate)f(obje)n(ct.)22 b fl(The)16 b(reasons)f(for)g(this)h(are)f (detailed)j(in)37 2522 y 750 2 v 89 2548 a fu(6)107 2564 y fp(F)m(or)11 b(exa\ mple,)i(tires)f(are)g(used)g(b)q(oth)g(in)g(automobiles)j(and)d(in)g(automati\ c)h(baseball)h(pitc)o(hing)g(mac)o(hines;)f(these)f(t)o(w)o(o)f(uses)37 2610 y (are)j(otherwise)g(unrelated.)952 2760 y fl(20)g eop bop 37 42 a fl(c)o(hapte\ r)16 b(eigh)o(t.)21 b(Before)15 b(a)g(mem)o(b)q(er)h(v)m(ariable)h(can)f(b)q (e)g(designated)g(as)f(a)h(comp)q(onen)o(t,)f(it)h(m)o(ust)f(b)q(e)h(sho)o (wn)37 98 y(that)c(an)o(y)h(instances)g(assigned)g(to)f(it)h(are)g(not)f(sim) o(ultaneously)i(assigned)f(to)f(another)h(v)m(ariable)h(designated)37 154 y (as)h(a)g(comp)q(onen)o(t.)20 b(A)15 b(metho)q(d)h(for)e(c)o(hec)o(king)i(the\ se)g(constrain)o(ts)f(is)g(describ)q(ed)i(in)f(c)o(hapter)f(eigh)o(t.)37 273 y fe(3.4.3)56 b(Con)n(v)n(erting)13 b(Asso)r(ciations)g(Mo)r(deled)f(Using)h (Inheritance)f(In)n(to)i(Aggregations)37 359 y fl(Sometimes)22 b(an)g(aggrega\ tion)e(is)i(not)f(ob)o(vious)g(un)o(til)i(after)e(the)g(implemen)o(tation)i (is)f(underw)o(a)o(y)l(.)38 b(The)37 415 y(\\whole")11 b(ma)o(y)f(b)q(ear)h (some)f(b)q(eha)o(vioral)h(similarities)i(to)d(its)h(parts,)f(and)h(those)f (similarities)j(ma)o(y)d(initially)j(b)q(e)37 472 y(mo)q(deling)k(using)g(inh\ eritance.)22 b(A)15 b(useful)i(refactoring)e(to)g(supp)q(ort)g(framew)o(ork)f (ev)o(olution)j(is)f(con)o(v)o(erting)37 528 y(a)f(sup)q(erclass/sub)q(class) i(relationship)g(in)o(to)f(an)f(aggregation,)e(as)i(sho)o(wn)g(in)h(Figure)f (3.3.)269 583 y 22300017 23089398 8288501 15458713 30588518 38548111 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Helvetica-Bold Courier-Bold %%Pages: 1 %%BoundingBox: 126 235 465 586 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -8.6747 62.8916 ] concat Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -240.723 -247.229 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 564.119 668.105 ] concat %I [ (AFTER:) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 1.08432 27.1084 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 623.751 614.316 ] concat %I [ (MemoryObject) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 143.909 -0.947388 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 298.684 615.263 ] concat %I [ (MemoryObjectContainer) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 206.632 -9.73685 ] concat %I 167 613 167 575 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 206.632 -9.73685 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 337.632 560.263 ] concat %I [ (InodeSystem) ] Text End End %I eop End %I eop Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 290.928 0.325287 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 181.33 553.088 ] concat %I [ (InodeSystem) () ( Protected:) () ( MemoryObject * objectState) ( MemoryObject * objectData) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 283.916 565.738 ] concat %I [ (* * * ) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 194.515 -12.8016 ] concat %I 158 461 158 461 Line End End %I eop End %I eop Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 10.8434 0 ] concat Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -16.2646 -3.25296 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 187.474 667.105 ] concat %I [ (BEFORE:) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 3.25302 24.9397 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 172.474 617.105 ] concat %I [ (MemoryObject) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 46.4737 -7.89471 ] concat %I 167 613 167 575 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 46.4737 -7.89471 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 177.474 562.105 ] concat %I [ (InodeSystem) ] Text End End %I eop End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 441.914 661.925 ] concat %I [ (DURING:) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 170.241 -4.33731 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 181.33 553.088 ] concat %I [ (InodeSystem) () ( Protected:) () ( MemoryObject * objectState) ( MemoryObject * objectData) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 283.916 565.738 ] concat %I [ (* * * ) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 194.515 -12.8016 ] concat %I 158 461 158 461 Line End End %I eop Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 254.06 19.8433 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 172.474 617.105 ] concat %I [ (MemoryObject) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 46.4737 -7.89471 ] concat %I 167 613 167 575 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 46.4737 -7.89471 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 177.474 562.105 ] concat %I [ (InodeSystem) ] Text End End %I eop Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 112.771 120.361 ] concat %I 155 450 212 450 Line End End %I eop Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 122.53 ] concat %I 450 301 397 277 Line End End %I eop End %I eop showpage %%Trailer end endTexFig 480 2174 a fh(Figure)i(3.3)p fl(:)j(Sup)q(erclass)c(Con)o(v)o (erted)f(to)g(Comp)q(onen)o(t)108 2271 y(In)h(the)g fi(Choic)n(es)e fl(\014le) j(system,)e(an)g ff(Ino)q(deSystem)g fl(managed)g(the)g(creation)h(of)f(and)h (access)f(to)g ff(Memo)o(r)o(y-)37 2328 y(Objects)p fl(.)41 b(It)21 b(managed) h(sev)o(eral)f(high-lev)o(el)j(op)q(erations)d(regarding)h(a)f(\014le)h(syste\ m;)i(these)d(op)q(erations)37 2384 y(required)e(lo)o(w)e(lev)o(el)i(supp)q (ort)f(\()p fi(i.e.)26 b fl(read)17 b(and)h(write)f(op)q(erations\))g(for)g (accessing)h(and)g(storing)f(p)q(oin)o(ters)37 2441 y(to)h(its)g ff(Memo)o (r)o(yObjects)p fl(.)28 b(In)18 b(an)g(early)g(v)o(ersion)h(of)e(the)h(\014le) h(system)f(framew)o(ork,)f ff(Ino)q(deSystem)g fl(w)o(as)g(de-)37 2497 y(\014\ ned)k(as)e(a)g(sub)q(class)h(of)f ff(Memo)o(r)o(yObject)p fl(,)g(to)g(inherit) i(lo)o(w)e(lev)o(el)i(op)q(erations)e(suc)o(h)h(as)f(read)g(and)h(write.)37 2554 y(Ho)o(w)o(ev)o(er,)c ff(Ino)q(deSystem)f fl(really)i(represen)o(ted)g (a)f(di\013eren)o(t)g(abstraction)g(from)f(a)h ff(Memo)o(r)o(yObject)p fl(.) 22 b(As)16 b(the)37 2610 y(design)21 b(of)f(the)g(framew)o(ork)e(w)o(as)h(re\ \014ned,)j(comp)q(onen)o(t)e(mem)o(b)q(er)g(v)m(ariables,)i(whic)o(h)f(w)o (ere)e(instances)i(of)952 2760 y(21)g eop bop 37 42 a fl(the)15 b ff(Memo)o (r)o(yObject)f fl(class,)h(w)o(ere)f(added)h(to)f ff(Ino)q(deSystem)g fl(to)g (pro)o(vide)h(the)g(lo)o(w)g(lev)o(el)h(supp)q(ort)f(for)f(its)g(\014le)37 98 y(system)k(op)q(erations.)29 b(The)18 b(high)h(lev)o(el)g(op)q(erations)f(de\ \014ned)i(in)f ff(Ino)q(deSystem)e fl(w)o(ere)h(c)o(hanged)g(to)f(in)o(v)o (ok)o(e)37 154 y(b)q(eha)o(vior)j(in)f(the)f(new)h(comp)q(onen)o(ts.)30 b(It) 18 b(w)o(as)g(no)o(w)g(no)g(longer)h(necessary)g(for)f ff(Ino)q(deSystem)f fl (to)h(inherit)37 211 y(the)d(lo)o(w)g(lev)o(el)h(op)q(erations)f(from)f ff (Memo)o(r)o(yObject)p fl(.)19 b(The)c(sup)q(erclass)h(of)e ff(Ino)q(deSystem) g fl(w)o(as)g(c)o(hanged.)20 b(The)37 267 y(notion)14 b(of)g(a)f ff(Memo)o (r)o(yObjectContainer)h fl(w)o(as)e(in)o(tro)q(duced.)21 b ff(Memo)o(r)o(yObj\ ectContainers)14 b fl(k)o(ept)f(trac)o(k)g(of)h(par-)37 324 y(titioning)20 b (a)e(large)h ff(Memo)n(ryObject)e fl(in)o(to)h(a)g(set)h(of)f(smaller)h ff (Memo)n(ryObjects)e fl(\(i.e.)30 b(a)18 b(disk)h(in)o(to)g(a)f(set)g(of)37 380 y(\014les\).)j ff(Ino)q(deSystem)12 b fl(w)o(as)h(really)i(a)e(sp)q(ecializat\ ion)k(of)c ff(Memo)n(ryObjectContainer)p fl(,)g(and)h(b)q(ecame)g(one)g(of)f (its)37 437 y(sub)q(classes.)108 493 y(Both)k(b)q(efore)h(and)g(after)e(the)i (refactorings)f(w)o(ere)g(applied,)i(the)f ff(Memo)o(r)o(yObject)e fl(class)i (pro)o(vided)g(op-)37 550 y(erations)i(to)e(the)h ff(Ino)q(deSystem)g fl(clas\ s.)32 b(Before)19 b(the)g(refactoring,)g(the)g(services)h(w)o(ere)f(inherited) i(b)o(y)e(the)37 606 y ff(Ino)q(deSystem)c fl(class;)g(later,)g(they)g(w)o (ere)g(pro)o(vided)h(b)o(y)f(its)h(comp)q(onen)o(ts.)108 663 y(F)l(rom)21 b (a)h(soft)o(w)o(are)e(engineering)j(viewp)q(oin)o(t,)i(there)d(are)f(adv)m (an)o(tages)g(in)i(using)g(aggregations)d(and)37 719 y(comp)q(onen)o(ts,)d (as)f(opp)q(osed)h(to)f(inheritance,)i(to)e(accomplish)h(reuse.)24 b(Data)16 b (abstraction)g(supp)q(orts)g(reuse)37 775 y([74].)22 b(An)16 b(aggregate)f (ob)s(ject)g(only)i(sees)g(the)f(public)i(in)o(terface)e(of)g(its)g(comp)q (onen)o(ts,)h(whereas)f(a)f(sub)q(class)37 832 y(sees)h(the)g(in)o(ternals)h (\(i.e.)k(a)15 b(less)i(abstract)d(view\))i(of)f(its)h(sup)q(erclass.)22 b (T)l(o)16 b(use)g(the)g(terminology)f(from)g(the)37 888 y(soft)o(w)o(are)d (testing)i(literature,)559 872 y fs(7)593 888 y fl(inheritance)h(pro)o(vides) f(a)f(white)h(b)q(o)o(x)g(\(or)f(p)q(ossibly)i(a)e(grey)g(b)q(o)o(x\))h(in)o (terface,)37 945 y(whereas)g(the)f(in)o(terface)h(pro)o(vided)g(b)o(y)f(a)g (comp)q(onen)o(t)h(to)e(its)i(aggregate)e(ob)s(ject)g(is)i(more)f(t)o(ypicall\ y)i(a)e(blac)o(k)37 1001 y(b)q(o)o(x)h(in)o(terface.)20 b(Blac)o(k)14 b(b)q (o)o(x)g(in)o(terfaces)g(pro)o(vide)g(b)q(etter)g(encapsulation)h(and)f(abstr\ action)g(than)f(do)h(white)37 1058 y(b)q(o)o(x)i(or)e(grey)h(b)q(o)o(x)g(in)o (terfaces)h([59)o(].)108 1114 y(Th)o(us,)j(while)i(inheritance)f(pla)o(ys)f (an)g(imp)q(ortan)o(t)g(role)g(in)g(an)g(application)i(framew)o(ork,)d(so)g (to)q(o)g(can)37 1171 y(aggregations)d(and)g(comp)q(onen)o(ts.)108 1227 y(The\ re)f(are)f(some)g(complexities)i(in)g(con)o(v)o(erting)e(a)g(sub)q(class/sup) q(erclass)i(relationship)h(to)c(an)i(aggrega-)37 1284 y(tion.)20 b(Chec)o(ks) 13 b(are)g(needed)i(to)e(ensure)g(that)g(t)o(yp)q(e)g(requiremen)o(ts)h(on)f (v)m(ariable)i(assignmen)o(ts)e(and)h(function)37 1340 y(calls)20 b(are)f(sti\ ll)h(satis\014ed.)32 b(Previously)19 b(inherited)i(b)q(eha)o(vior)f(ma)o(y)e (need)h(to)g(b)q(e)g(copied)h(in)o(to)f(one)g(of)f(the)37 1396 y(classes.)j (Chapter)15 b(eigh)o(t)g(describ)q(es)i(sev)o(eral)e(high-lev)o(el)j(op)q(era\ tions)d(in)o(v)o(olving)i(aggregations.)37 1540 y fd(3.5)70 b(Supp)r(orting) 24 b(Refactorings)37 1641 y fl(The)19 b(prior)f(three)g(sections)h(fo)q(cused) g(on)f(the)g(three)g(highest)h(lev)o(el)g(refactorings:)25 b(creating)18 b (an)h(abstract)37 1698 y(sup)q(erclass,)14 b(sub)q(classing)g(and)f(simplifyi\ ng)i(conditions,)e(and)g(creating)f(aggregations)g(and)g(reusable)i(com-)37 1754 y(p)q(onen)o(ts.)22 b(As)15 b(noted)h(in)h(c)o(hapter)e(one,)g(the)h(hig\ h-lev)o(el)i(refactorings)d(are)g(supp)q(orted)i(b)o(y)e(a)g(set)h(of)f(t)o (w)o(en)o(t)o(y)37 1810 y(six)h(lo)o(w-lev)o(el)h(refactorings,)d(whic)o(h)i (are)f(listed)i(b)q(elo)o(w.)108 1867 y(All)j(but)f(the)f(\014nal)i(category) d(of)i(the)f(supp)q(orting)i(refactorings)e(listed)i(b)q(elo)o(w)f(are)f fi (atomic)p fl(;)i(that)e(is,)37 1923 y(they)i(are)f(the)g(most)f(primitiv)o (e)j(refactorings.)32 b(The)19 b(atomic)g(refactorings)g(create,)h(delete)g (c)o(hange)f(and)37 1980 y(mo)o(v)o(e)h(en)o(tities.)36 b(The)20 b(\014nal)h (category)f(of)g(less)g(primitiv)o(e)i(\(comp)q(osite\))e(refactorings)g(supp) q(ort)g(sligh)o(tly)37 2036 y(more)15 b(p)q(o)o(w)o(erful)h(refactoring)f(op) q(erations,)f(suc)o(h)i(as)f(abstracting)g(access)g(to)f(a)h(mem)o(b)q(er)h (v)m(ariable.)93 2143 y(1.)22 b(Creating)15 b(a)g(Program)f(En)o(tit)o(y:)170 2236 y(\(a\))22 b(creating)16 b(an)f(empt)o(y)g(class)168 2309 y(\(b\))22 b (creating)16 b(a)e(mem)o(b)q(er)i(v)m(ariable)173 2383 y(\(c\))22 b(creating) 16 b(a)e(mem)o(b)q(er)i(function.)37 2466 y 750 2 v 89 2493 a fu(7)107 2509 y fp(In)h(the)g(soft)o(w)o(are)g(testing)h(literature,)i(blac)o(k)f(b)q(o)o(x)e (denotes)h(functional)i(testing)e(and)g(white)g(b)q(o)o(x)g(denotes)g(structu\ ral)37 2555 y(testing.)h(The)12 b(t)o(w)o(o)h(t)o(yp)q(es)h(of)e(testing)i (are)f(compared)h(in)g([13].)952 2760 y fl(22)g eop bop 93 42 a fl(2.)22 b (Deleting)16 b(a)f(Program)f(En)o(tit)o(y:)170 135 y(\(a\))22 b(deleting)17 b (an)e(unreferenced)i(class)168 208 y(\(b\))22 b(deleting)17 b(an)e(unreferenc\ ed)i(v)m(ariable)173 281 y(\(c\))22 b(deleting)17 b(a)e(set)g(of)f(mem)o(b)q (er)i(functions.)93 375 y(3.)22 b(Changing)16 b(a)f(Program)e(En)o(tit)o(y:) 170 469 y(\(a\))22 b(c)o(hanging)16 b(a)f(class)g(name)168 542 y(\(b\))22 b (c)o(hanging)16 b(a)f(v)m(ariable)h(name)173 615 y(\(c\))22 b(c)o(hanging)16 b (a)f(mem)o(b)q(er)g(function)h(name)168 688 y(\(d\))22 b(c)o(hanging)16 b(the) f(t)o(yp)q(e)g(of)g(a)g(set)g(of)g(v)m(ariables)h(and)g(functions)173 761 y (\(e\))22 b(c)o(hanging)16 b(access)f(con)o(trol)g(mo)q(de)176 834 y(\(f)t (\))21 b(adding)16 b(a)f(function)h(argumen)o(t)170 907 y(\(g\))22 b(deleting) 17 b(a)e(function)h(argumen)o(t)168 980 y(\(h\))22 b(reordering)16 b(function) g(argumen)o(ts)180 1054 y(\(i\))23 b(adding)16 b(a)f(function)h(b)q(o)q(dy) 179 1127 y(\(j\))22 b(deleting)17 b(a)e(function)h(b)q(o)q(dy)169 1200 y(\(k\ \))22 b(con)o(v)o(ert)15 b(an)g(instance)h(v)m(ariable)g(to)f(a)g(v)m(ariable) h(that)f(p)q(oin)o(ts)g(to)g(an)g(instance)180 1273 y(\(l\))23 b(con)o(v)o (ert)15 b(v)m(ariable)h(references)g(to)f(function)h(calls)155 1346 y(\(m\)) 22 b(replacing)17 b(statemen)o(t)d(list)i(with)f(function)h(call)168 1419 y (\(n\))22 b(inlining)c(\(ie)e(inline)i(expanding\))e(a)f(function)h(call)170 1492 y(\(o\))22 b(c)o(hanging)16 b(the)f(sup)q(erclass)h(of)f(a)g(class)93 1586 y(4.)22 b(Mo)o(ving)15 b(a)g(Mem)o(b)q(er)g(V)l(ariable:)170 1680 y(\(a\ \))22 b(mo)o(ving)15 b(a)g(mem)o(b)q(er)g(v)m(ariable)i(to)e(a)f(sup)q(erclas\ s)168 1753 y(\(b\))22 b(mo)o(ving)15 b(a)g(mem)o(b)q(er)g(v)m(ariable)i(to)e (a)f(sub)q(class.)93 1846 y(5.)22 b(Less)16 b(primitiv)o(e)g(\(comp)q(osite\)) f(refactorings:)170 1940 y(\(a\))22 b(abstract)14 b(access)i(to)e(a)h(mem)o (b)q(er)g(v)m(ariable)168 2013 y(\(b\))22 b(con)o(v)o(ert)15 b(a)f(co)q(de)i (segmen)o(t)f(to)g(a)f(function)173 2086 y(\(c\))22 b(mo)o(ving)15 b(a)g(clas\ s.)37 2193 y(These)h(lo)o(w-lev)o(el)h(refactorings)d(are)h(describ)q(ed)i (in)f(c)o(hapter)f(\014v)o(e.)108 2249 y(This)i(list,)h(com)o(bined)g(with)f (the)f(three)h(high-lev)o(el)i(refactorings,)d(is)i(an)e(elab)q(oration)h(of) g(the)f(original)37 2306 y(list)h(of)d(eigh)o(t)i(refactorings)e(describ)q (ed)k(in)e(section)f(1.2.1)f(\(and)h(in)h([85)o(]\).)j(F)l(rom)c(that)f(origi\ nal)i(list:)106 2399 y fj(\017)22 b fl(the)f(\014rst)g(three)h(refactorings)e (map)h(to)g(the)g(high-lev)o(el)j(refactorings,)e(whic)o(h)g(are)f(implemen)o (ted)151 2456 y(using)16 b(man)o(y)f(of)g(the)g(lo)o(w-lev)o(el)h(refactoring\ s)f(listed)i(ab)q(o)o(v)o(e)106 2550 y fj(\017)22 b fl(the)15 b(fourth)g(refa\ ctoring)g(\(mo)o(ving)g(a)g(class\))g(maps)g(to)f(refactoring)h(5\(e\))952 2760 y(23)g eop bop 106 42 a fj(\017)22 b fl(the)12 b(\014fth)g(refactoring)g (\(mo)o(ving)f(v)m(ariables)j(and)e(functions\))g(maps)g(to)g(refactorings)f (1\(c\),)h(2\(c\),)f(4\(a\),)151 98 y(and)16 b(4\(b\))106 192 y fj(\017)22 b fl(the)13 b(sixth)g(refactoring)f(\(replacing)h(co)q(de)g(segmen)o(t)f(with)h (function)g(call\))g(maps)g(to)e(refactoring)i(3\(m\))106 286 y fj(\017)22 b fl(the)15 b(sev)o(en)o(th)h(refactoring)e(\(c)o(hanging)i(names\))e(maps)h (to)g(refactorings)g(3\(a\),)e(3\(b\))i(and)g(3\(c\))106 379 y fj(\017)22 b fl (the)15 b(eigh)o(th)h(refactoring)f(\(abstracting)f(v)m(ariable)j(access\))e (maps)g(to)f(5\(a\).)108 473 y(It)21 b(is)g(in)o(teresting)h(to)e(note)h(that\ ,)g(while)i(the)e(list)g(of)g(refactorings)f(w)o(as)g(determined)j(mostly)d (from)37 530 y(analyzing)15 b(C++)f(programs,)f(man)o(y)g(should)i(b)q(e)f (applicable)i(for)d(refactoring)g(programs)g(written)g(in)i(other)37 586 y (ob)s(ject-orien)o(ted)k(languages.)30 b(Only)19 b(a)f(small)h(subset)g(app)q (ear)f(to)g(b)q(e)h(C++-sp)q(eci\014c.)1559 570 y fs(8)1611 586 y fl(Applying) h(these)37 643 y(refactorings)15 b(to)g(other)g(ob)s(ject)f(orien)o(ted)i(lan\ guages)f(is)h(an)f(area)g(for)f(future)h(researc)o(h.)37 786 y fd(3.6)70 b (Language)25 b(F)-6 b(eatures)23 b(in)f(Refactoring)37 887 y fl(Belo)o(w)16 b (is)g(a)f(brief)g(summary)g(of)g(the)g(language)g(features)g(up)q(on)h(whic)o (h)g(the)f(refactoring)g(descriptions)i(are)37 944 y(based.)33 b(Chapter)19 b (four)g(discusses)i(the)e(related)h(issues)g(of)f(the)h(domains)f(of)g(refact\ oring)g(and)h(b)q(eha)o(vior)37 1000 y(preserv)m(ation.)108 1057 y(A)12 b(pro\ gram)f(consists)h(of)f(a)h(single)h(global)f(function)h(called)g fi(main)p fl (,)f(and)g(\(p)q(ossibly)h(n)o(ull\))g(sets)f(of)f(classes,)37 1113 y(global) 16 b(en)o(umerated)g(t)o(yp)q(es)f(and)g(global)h(v)m(ariables.)108 1170 y (The)f(scop)q(e)g(of)g(eac)o(h)g(class)g(is)g(the)g(en)o(tire)h(program.)i (A)d(class)g(has)g(at)f(most)g(one)h(direct)h(sup)q(erclass.)k(A)37 1226 y (class)c(consists)g(of)f(a)g(set)g(of)g(mem)o(b)q(er)h(v)m(ariables)h(and)e (set)h(of)f(mem)o(b)q(er)g(functions.)22 b(All)17 b(mem)o(b)q(er)e(v)m(ariabl\ es)37 1282 y(ha)o(v)o(e)i(distinct)i(names,)e(as)g(do)g(all)h(mem)o(b)q(er)g (functions.)26 b(All)19 b(v)m(ariables)g(and)e(functions)h(are)f(t)o(yp)q(ed.) 26 b(The)37 1339 y(t)o(yp)q(e)14 b(of)e(a)h(mem)o(b)q(er)h(v)m(ariable)g(can) f(b)q(e)h(a)f(class,)h(in)g(whic)o(h)g(case)f(an)g(instance)h(of)e(that)h(cla\ ss)g(is)h(em)o(b)q(edded)h(in)37 1395 y(the)g(v)m(ariable's)h(con)o(taining)f (class)g(when)g(that)f(class)h(is)g(compiled.)21 b(The)15 b(t)o(yp)q(e)f(of)g (a)h(mem)o(b)q(er)f(v)m(ariable)i(can)37 1452 y(b)q(e)f(a)f(p)q(oin)o(ter)h (to)e(a)h(class,)g(in)h(whic)o(h)g(case)f(it)h(can)f(b)q(e)h(assigned)f(an)g (instance)h(of)f(that)g(class)g(or)g(an)g(instance)37 1508 y(of)j(one)g(of)g (its)g(sub)q(classes.)27 b(A)17 b(function)h(de\014ned)g(in)g(a)f(sup)q(ercla\ ss)h(can)f(b)q(e)h(rede\014ned)g(in)g(a)f(sub)q(class;)i(all)37 1565 y(functi\ ons)d(that)f(are)g(rede\014ned)h(in)g(sub)q(classes)h(are)e(\(using)g(C++)h (terminology\))f(virtual.)108 1621 y(The)20 b(language)f(features)g(co)o(v)o (ered)g(are)g(a)g(ma)s(jor)e(subset)j(of)e(C++.)33 b(Ho)o(w)o(ev)o(er,)19 b (sev)o(eral)g(features)g(of)37 1678 y(C++)h(and)g(other)f(ob)s(ject-orien)o (ted)g(languages)h(w)o(ere)f(not)f(included)k(here.)33 b(Multiple)21 b(inheri\ tance)g(and)37 1734 y(o)o(v)o(erloaded)15 b(mem)o(b)q(er)g(function)g(names)g (\(where)f(t)o(w)o(o)f(mem)o(b)q(er)i(functions)g(of)f(a)g(class)h(can)g(ha)o (v)o(e)f(the)h(same)37 1791 y(name)23 b(but)f(di\013er)g(in)h(argumen)o(t)e (t)o(yp)q(es\))h(w)o(ere)g(not)g(included.)43 b(They)22 b(w)o(ould)g(ha)o(v)o (e)g(complicated)h(the)37 1847 y(precondition)e(c)o(hec)o(king)f(for)f(refact\ orings,)g(particularly)h(as)f(related)h(to)e(naming)i(con\015icts,)g(and)f (made)37 1903 y(the)f(refactoring)g(descriptions)h(tedious)f(and)g(more)f(di\ \016cult)i(to)e(understand.)28 b(Multiple)20 b(inheritance)f(is)37 1960 y(not) d(a)h(feature)f(in)h(Smalltalk,)g(nor)f(w)o(as)g(it)g(used)h(in)h(the)e(v)o (ersions)g(of)g(the)h fi(Choic)n(es)e fl(\014le)j(system)e(analyzed)37 2016 y (in)21 b(this)g(researc)o(h.)33 b(Ov)o(erloaded)21 b(mem)o(b)q(er)f(function) h(names)e(can)h(b)q(e)h(mapp)q(ed)g(in)o(to)f(distinctly)h(named)37 2073 y (functions)i(b)o(y)e(concatenating)h(function)h(names)e(and)h(argumen)o(ts)f (t)o(yp)q(es,)i(as)e(is)h(done)g(in)h(some)e(C++)37 2129 y(compilers.)38 b (Another)21 b(feature)f(of)h(C++)g(not)f(included)j(here)f(is)f(t)o(yp)q(e)g (casts.)35 b(Explicit)23 b(t)o(yp)q(e)e(casts)f(is)37 2186 y(generally)c(reco\ gnized)g(as)e(p)q(o)q(or)g(co)q(ding)h(practice.)21 b(Handling)15 b(t)o(yp)q (e)g(casts)f(w)o(ould)g(require)i(more)e(complex)37 2242 y(\015o)o(w)20 b(ana\ lysis)g(than)g(is)h(presen)o(ted)f(here)g(and)g(is)h(an)e(area)h(for)f(future) h(researc)o(h.)33 b(Finally)l(,)23 b(C++)d(is)h(an)37 2299 y(ev)o(olving)16 b (language;)f(parameterized)h(classes,)f(a)g(v)o(ery)f(recen)o(tly)i(added)g (feature,)e(is)i(not)e(included)k(in)e(this)37 2355 y(analysis.)37 2436 y 750 2 v 89 2463 a fu(8)107 2479 y fp(Three)f(refactorings)i(that)f(w)o(ould)h(not) f(apply)h(for)e(Smalltalk)k(programs)d(are)g(3\(d\),\(e\),)g(and)g(\(k\).)25 b (These)16 b(refactorings)37 2525 y(c)o(hange)e(t)o(yp)q(e,)g(access)f(con)o (trol)h(mo)q(de,)f(and)h(con)o(v)o(ert)g(an)f(instance)h(v)n(ariable)h(to)e (a)g(v)n(ariable)j(that)d(p)q(oin)o(ts)h(to)f(an)g(instance.)952 2760 y fl (24)g eop bop 37 42 a fd(3.7)70 b(Summary:)31 b(Imp)r(ortance)22 b(&)i(Comple\ xit)n(y)c(of)j(Refactoring)37 143 y fl(Refactoring)d(is)g(imp)q(ortan)o(t.)33 b(As)19 b(noted)h(earlier,)h(in)f(the)g(view)g(of)f(Deutsc)o(h)g([40)o(])h (and)f(others,)h(the)g(k)o(ey)37 199 y(in)o(tellectual)25 b(con)o(ten)o(t)d (of)g(soft)o(w)o(are)f(is)i(captured)f(in)i(the)e(factoring)g(of)g(functions) h(and)g(in)g(the)g(design)37 256 y(of)c(in)o(terfaces.)29 b(Refactoring)19 b (helps)h(in)f(making)g(this)f(in)o(tellectual)j(con)o(ten)o(t)d(more)g(explic\ it)j(and,)e(hence,)37 312 y(helps)i(in)e(designing)i(reusable)e(soft)o(w)o (are.)29 b(Exp)q(erienced)21 b(dev)o(elop)q(ers)f(of)f(ob)s(ject-orien)o(ted) f(systems)h(\014nd)37 369 y(themselv)o(es)g(restructuring)f(their)g(implemen) o(tations,)i(although)e(they)f(ma)o(y)h(not)f(b)q(e)h(consciously)i(a)o(w)o (are)37 425 y(that)15 b(refactoring)g(tasks)f(are)h(part)g(of)f(their)i(dev)o (elopmen)o(t)g(pro)q(cess.)108 482 y(Refactoring)21 b(is)g(complex.)37 b(Muc) o(h)21 b(of)f(the)h(complexit)o(y)g(is)h(due)f(to)f(the)h(in)o(terrelationshi\ ps)h(among)37 538 y(classes.)h(F)l(or)15 b(example,)i(when)f(a)g(class)g(is)g (mo)o(v)o(ed)g(and)g(a)f(sub)q(class/sup)q(erclass)j(relationship)g(is)e(c)o (hanged)37 595 y(to)c(a)f(con)o(tainer/comp)q(onen)o(t)h(relationship,)i(c)o (hec)o(ks)e(and)h(structural)e(c)o(hanges)h(are)g(often)g(needed)h(to)e(retai\ n)37 651 y(inherited)j(b)q(eha)o(vior)e(and)f(satisfy)g(t)o(yp)q(e)h(requirem\ en)o(ts)g(on)f(assignmen)o(ts)g(and)h(function)g(calls.)20 b(As)11 b(a)g(syst\ em)37 708 y(gro)o(ws,)j(doing)i(these)f(tasks)g(b)o(y)g(hand)g(b)q(ecomes)h (more)f(complicated,)h(tedious)g(and)f(error-prone.)108 764 y(The)h(follo)o (wing)f(c)o(hapters)g(describ)q(e)i(a)e(w)o(a)o(y)f(to)h(automate)f(the)h(pro) q(cess)h(of)e(refactoring.)952 2760 y(25)g eop bop 37 353 a fc(Chapter)35 b (4)37 560 y fb(Preserving)42 b(Beha)m(vior)f(During)37 685 y(Refactoring)37 907 y fl(In)o(tuitiv)o(ely)l(,)25 b(refactorings)c(should)h(preserv)o(e)g(the) f(b)q(eha)o(vior)h(of)f(a)g(program.)37 b(This)22 b(c)o(hapter)f(discusses)37 964 y(sev)o(eral)13 b(topics)g(related)f(to)g(b)q(eha)o(vior)h(preserv)m(atio\ n.)20 b(Section)13 b(4.1)e(describ)q(es)j(sev)o(eral)f(program)e(prop)q(ertie\ s)37 1020 y(that)k(are)f(easily)i(violated)f(in)h(refactoring.)j(Section)d (4.2)e(de\014nes)h(the)g(domains)g(of)g(the)f(argumen)o(ts)g(to)g(the)37 1077 y(refactorings.)24 b(Section)18 b(4.3)d(lists)j(the)e(functions)i(used)f(to)f (describ)q(e)i(preconditions)g(of)f(the)f(refactorings;)37 1133 y(the)g(preco\ nditions)g(ensure)g(that)f(b)q(eha)o(vior)g(is)h(preserv)o(ed)g(b)o(y)f(the)g (refactoring.)37 1276 y fd(4.1)70 b(Program)24 b(Prop)r(erties)e(and)i(Beha)n (vior)f(Preserv)l(ation)37 1378 y fl(After)16 b(a)f(refactoring,)g(a)h(progra\ m)f(m)o(ust)g(b)q(e)h(syn)o(tactically)h(correct.)k(F)l(or)15 b(example,)i (the)f(sup)q(erclass)g(of)g(a)37 1434 y(new)c(class)f(m)o(ust)g(b)q(e)h(an)f (existing)h(class.)19 b(Or,)11 b(a)g(function)h(in)g(a)f(sub)q(class)h(that)e (o)o(v)o(errides)h(a)g(function)h(de\014ned)37 1491 y(in)17 b(its)e(sup)q(erc\ lass)h(m)o(ust)f(b)q(e)h(t)o(yp)q(e)f(compatible)h(with)g(the)f(corresp)q(ond\ ing)h(function)g(in)g(the)g(sup)q(erclass.)108 1547 y(A)23 b(compiler)h(could) g(catc)o(h)e(these)h(errors.)42 b(Therefore,)24 b(one)f(w)o(a)o(y)f(to)g(prev) o(en)o(t)g(these)h(errors)f(from)37 1604 y(happ)q(ening)f(w)o(ould)f(b)q(e)f (to)g(sa)o(v)o(e)f(the)h(curren)o(t)g(v)o(ersion)g(of)g(a)f(program)g(b)q(efo\ re)h(eac)o(h)g(refactoring,)h(apply)37 1660 y(the)d(refactoring)f(without)g (regard)g(to)f(these)i(errors,)e(and)h(then)h(recompile)h(the)e(program.)22 b (If)16 b(an)g(error)g(is)37 1717 y(\015agged,)f(fall)h(bac)o(k)f(to)g(the)g (old)h(v)o(ersion.)108 1773 y(Ho)o(w)o(ev)o(er,)e(there)h(are)g(t)o(w)o(o)f (ma)s(jor)g(problems)h(with)h(this)g(approac)o(h:)93 1867 y(1.)22 b(the)11 b (approac)o(h)g(migh)o(t)g(b)q(e)g(unacceptably)i(slo)o(w,)e(esp)q(ecially)i (for)e(higher)g(lev)o(el)i(refactoring)d(op)q(erations)151 1923 y(that)15 b (in)o(v)o(olv)o(e)g(a)g(series)h(of)f(more)g(primitiv)o(e)h(refactorings.)93 2017 y(2.)22 b(more)16 b(imp)q(ortan)o(tly)l(,)i(there)f(are)f(some)g(errors) g(that)h(could)g(c)o(hange)g(the)g(b)q(eha)o(vior)g(of)g(the)g(program)151 2074 y(but)e(w)o(ould)h(not)f(b)q(e)h(pic)o(k)o(ed)g(up)g(b)o(y)f(the)g(compi\ ler.)108 2167 y(Consider)d(the)g(erroneous)f(refactoring)g(sho)o(wn)h(in)g (Figure)g(4.1.)37 b(F)l(unction)12 b fi(F1)f fl(is)i(a)e(protected)g(mem)o (b)q(er)37 2224 y(in)j(class)g fi(Sup)n(er)p fl(,)f(while)h fi(F2)f fl(is)h (de\014ned)g(in)g(class)g fi(Sub1)p fl(,)f(one)g(of)g(its)g(sub)q(classes.)21 b(The)13 b(argumen)o(t)f(and)i(return)37 2280 y(t)o(yp)q(es)k(of)e fi(F2)h fl (are)g(\(coinciden)o(tly\))i(the)e(same)g(as)g(those)g(of)g fi(F1)p fl(.)26 b (In)17 b(class)h fi(Sub1)p fl(,)f(function)h fi(F3)f fl(includes)j(a)37 2337 y (call)d(to)d fi(F1)p fl(,)h(whic)o(h)h(is)g(inherited)h(from)d(the)i(sup)q (erclass.)108 2393 y(A)g(refactoring)f(is)h(applied,)h(in)f(class)g fi(Sub1)p fl(,)f(to)g(rename)g(function)i fi(F2)e fl(to)g fi(F1)p fl(.)20 b(This)c(rena\ ming)g(w)o(ould)37 2450 y(result)h(in)g(a)f(syn)o(tactically)g(correct)g(prog\ ram)f(\(it)h(w)o(ould)g(compile)i(cleanly\).)23 b(Ho)o(w)o(ev)o(er,)15 b(the) h(b)q(eha)o(vior)h(of)37 2506 y(the)g(program)f(has)h(probably)g(c)o(hanged.) 26 b(F)l(unction)17 b fi(F3)g fl(w)o(ould)g(no)o(w)g(call)h(the)f(newly)g(ren\ amed)h(function)37 2563 y(de\014ned)k(in)g(its)e(lo)q(cal)i(class,)g(rather)d (than)i(the)f(function)h(previously)h(inherited)h(from)c(the)i(sup)q(erclass.) 952 2760 y(26)g eop bop 94 0 a 27825685 15787623 5065195 21707980 32890880 37495603 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Helvetica-Bold Courier-Bold %%Pages: 1 %%BoundingBox: 77 330 500 570 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 141 709 ] concat %I [ (BEFORE:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 485 707 ] concat %I [ (AFTER:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t u %I 46 633 46 633 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 155.747 619.024 ] concat %I [ (* * * ) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 154.253 638.759 ] concat %I [ (Sub1) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 97.5422 605.904 ] concat %I [ (Super:) () ( Protected:) () ( void F1\(int x, int y\)) ( { ... }) () (Sub1:) () ( Protected:) () ( void F2\(int x, int y\)) ( { ... }) ( int F3\(int z\)) ( {F1\(z,3\); ... }) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 151.976 685.759 ] concat %I [ (Super) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 3.91566 6.75903 ] concat %I 165 666 165 634 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 496.554 620.434 ] concat %I [ (* * * ) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 495.06 640.169 ] concat %I [ (Sub1) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 492.783 687.169 ] concat %I [ (Super) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 344.723 8.16867 ] concat %I 165 666 165 634 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 435.096 606.229 ] concat %I [ (Super:) () ( Protected:) () ( void F1\(int x, int y\)) ( { ... }) () (Sub1:) () ( Protected:) () ( void F1\(int x, int y\)) ( { ... }) ( int F3\(int z\)) ( {F1\(z,3\); ... }) () ] Text End End %I eop showpage %%Trailer end endTexFig 384 1128 a fh(Figure)18 b(4.1)p fl(:)i(Erroneous)14 b(Renaming) j(Of)e(Mem)o(b)q(er)g(F)l(unction)h(F2)37 1261 y(Assuming)e(that)e(the)h(t)o (w)o(o)f(functions)h(b)q(eha)o(v)o(e)g(di\013eren)o(tly)l(,)h(the)f(b)q(eha)o (vior)h(of)e(function)i fi(F3)e fl(program)g(w)o(ould)37 1318 y(ha)o(v)o(e)j (c)o(hanged.)20 b(A)c(compiler)g(w)o(ould)g(not)f(pic)o(k)h(up)f(this)h(error\ .)108 1374 y(Without)f(rules)i(for)e(c)o(hec)o(king)h(that)f(these)g(program) g(prop)q(erties)h(are)f(not)g(violated,)h(it)g(is)g(p)q(ossible)h(to)37 1431 y (pro)q(duce)k(a)e(program)f(that)h(either)h(is)g(not)f(syn)o(tactically)h(cor\ rect)f(or)g(\(w)o(orse\))f(compiles)j(correctly)e(but)37 1487 y(b)q(eha)o(v)o (es)d(di\013eren)o(tly)g(after)e(the)i(refactoring.)108 1544 y(During)j(the)g (researc)o(h)g(protot)o(yping,)g(a)g(particular)h(set)e(of)h(syn)o(tactic)g (and)g(seman)o(tic)g(prop)q(erties)h(of)37 1600 y(programs)11 b(\(listed)i (b)q(elo)o(w\))g(w)o(as)e(found)h(to)g(b)q(e)h(easily)g(violated)g(if)f(expli\ cit)i(c)o(hec)o(ks)f(w)o(ere)f(not)f(made)h(b)q(efore)h(a)37 1657 y(program)f (w)o(as)h(refactored.)18 b(In)c(the)f(refactoring)g(de\014nitions,)h(b)q(eha) o(vior)g(preserv)m(ation)g(is)f(argued)g(in)h(terms)37 1713 y(of)d(these)g (program)f(prop)q(erties.)586 1696 y fs(1)625 1713 y fl(These)i(prop)q(erties) g(relate)f(to)f(inheritance,)k(scoping,)e(t)o(yp)q(e)f(compatibilit)o(y)37 1769 y(and)h(seman)o(tic)f(equiv)m(alence.)22 b(Recompiling)13 b(the)f(progra\ m)e(after)g(refactoring)h(could)i(\015ag)d(violations)j(of)d(the)37 1826 y (\014rst)k(six)g(prop)q(erties,)g(but)g(violations)h(of)e(the)h(sev)o(en)o (th)f(prop)q(ert)o(y)h(migh)o(t)f(not)g(b)q(e)i(\015agged.)k(The)14 b(prop)q (erties)37 1882 y(are:)93 1976 y(1.)22 b fi(Unique)16 b(Sup)n(er)n(class.)j fl (After)c(refactoring,)f(a)h(class)g(m)o(ust)g(alw)o(a)o(ys)g(ha)o(v)o(e)f(at) h(most)f(one)i(direct)g(sup)q(er-)151 2033 y(class)g(and)f(its)h(sup)q(erclas\ s)g(m)o(ust)f(not)f(also)i(b)q(e)f(one)h(of)f(its)g(sub)q(classes.)21 b(The) 16 b(fo)q(cus)f(of)g(this)h(researc)o(h)151 2089 y(w)o(as)f(up)q(on)g(single) i(inheritance)g(systems,)d(without)h(cycles)i(in)f(the)f(inheritance)i(graph.) 1689 2073 y fs(2)93 2183 y fl(2.)22 b fi(Distinct)d(Class)f(Names.)30 b fl (After)18 b(refactoring,)h(eac)o(h)f(class)h(m)o(ust)f(ha)o(v)o(e)g(a)h(uniqu\ e)h(name.)30 b(In)19 b(this)151 2239 y(researc)o(h,)c(classes)g(are)g(not)g (nested;)g(that)g(is,)g(the)h(scop)q(e)f(of)g(eac)o(h)g(class)h(is)g(the)f (en)o(tire)h(program.)37 2320 y 750 2 v 89 2347 a fu(1)107 2363 y fp(They)h (are)g(similar)j(to)d(the)g(prop)q(erties)i(analyzed)g(in)f([9,)f(31].)29 b (Those)18 b(e\013orts)f(fo)q(cused)h(on)g(restructurings)h(in)o(v)o(olving)37 2409 y(program)c(data,)e(while)i(this)g(researc)o(h)f(considers)h(structural) g(c)o(hanges)g(to)e(b)q(oth)h(functions)h(and)f(data.)19 b(The)14 b(C++)e(lan\ guage)37 2454 y(is)17 b(a)e(seman)o(tically)k(complicated)e(language,)h(supp) q(orting)g(mac)o(hine)f(lev)o(el)g(op)q(erations)g(suc)o(h)f(as)g(p)q(oin)o (ter)h(arithmetic;)h(these)37 2500 y(complexities)e(mak)o(e)e(it)f(di\016cult) i(to)e(more)g(precisely)i(de\014ne)f(what)f(b)q(eha)o(vior)i(preserv)n(ation) g(means)e(for)g(C++)f(programs.)89 2530 y fu(2)107 2546 y fp(Smalltalk)19 b (is)f(a)f(language)i(with)f(these)f(features,)h(and)g(the)f(C++)f(based)i(app\ lication)j(framew)o(ork)c(analyzed)i(in)e(this)37 2591 y(researc)o(h)d(had)g (these)f(features.)952 2760 y fl(27)g eop bop 93 42 a fl(3.)22 b fi(Distinct) 17 b(Memb)n(er)g(Names.)23 b fl(After)16 b(refactoring,)f(all)j(mem)o(b)q(er) e(v)m(ariables)i(and)e(functions)h fi(within)g(a)151 98 y(class)f fl(ha)o(v)o (e)g(distinct)i(names.)24 b(Ho)o(w)o(ev)o(er,)15 b(this)i(do)q(es)g(allo)o (w,)g(for)f(example,)h(a)f(mem)o(b)q(er)h(function)h(in)151 154 y(a)d(sup)q (erclass)h(to)f(b)q(e)h(o)o(v)o(erridden)f(in)h(a)f(sub)q(class.)93 244 y(4.) 22 b fi(Inherite)n(d)12 b(Memb)n(er)f(V)m(ariables)h(Not)g(R)n(e)n(de\014ne)n (d.)17 b fl(A)11 b(mem)o(b)q(er)g(v)m(ariable)h(inherited)h(from)d(a)g(sup)q (erclass)151 301 y(is)16 b(not)f(rede\014ned)h(in)g(an)o(y)f(of)g(its)g(sub)q (classes.)93 391 y(5.)22 b fi(Comp)n(atible)f(Signatur)n(es)f(in)g(Memb)n(er) h(F)m(unction)f(R)n(e)n(de\014nition.)34 b fl(After)20 b(refactoring,)h(if)g (a)f(mem-)151 447 y(b)q(er)e(function)f(de\014ned)i(in)f(a)e(sup)q(erclass)i (is)g(rede\014ned)g(in)g(a)e(sub)q(class,)j(all)e(attributes)g(\(except)g(the) 151 504 y(function)h(b)q(o)q(dy\))f(of)g(the)g(t)o(w)o(o)f(functions)i(m)o (ust)e(b)q(e)i(compatible.)27 b(All)18 b(functions)g(are)e(\(using)i(C++)151 560 y(terminology\))c(virtual,)g(and)g(can)g(b)q(e)h(o)o(v)o(erridden)f(in)h (sub)q(classes.)21 b(Signatures)14 b(of)f(virtual)i(functions)151 616 y(in)h (C++)g(are)f(compatible)h(only)g(if)f(their)h(\(return)f(and)g(argumen)o(t\)) f(t)o(yp)q(es)i(matc)o(h)e(exactly)i([41)o(].)1846 600 y fs(3)151 690 y fl (This)i(allo)o(ws)f(a)f(function)i(de\014ned)h(in)e(a)g(sup)q(erclass)h(to)e (b)q(e)i(o)o(v)o(erridden)f(in)h(a)f(sub)q(class,)h(as)f(long)g(as)151 746 y (the)e(signatures)f(are)g(compatible.)21 b(The)15 b(abilit)o(y)h(to)d(o)o(v)o (erride)i(inherited)h(functions)g(is)f(imp)q(ortan)o(t)f(in)151 802 y(refacto\ ring.)23 b(F)l(or)16 b(example,)h(in)g(de\014ning)h(an)f(abstract)e(class)i (it)g(is)g(sometimes)f(useful)h(to)f(de\014ne)i(a)151 859 y(function)12 b(in) g(the)f(sup)q(erclass)h(that)e(do)q(es)h(not)g(con)o(tain)g(a)f(function)i (b)q(o)q(dy;)h(the)e(function)g(is)h(o)o(v)o(erridden)151 915 y(in)k(sub)q (classes,)g(where)g(the)f(function)h(b)q(o)q(dy)g(is)g(de\014ned.)93 1005 y (6.)22 b fi(T)m(yp)n(e-Safe)d(Assignments.)31 b fl(After)19 b(a)g(refactoring\ ,)g(the)h(t)o(yp)q(e)f(of)g(eac)o(h)h(expression)g(assigned)g(to)f(a)151 1062 y(v)m(ariable)e(m)o(ust)d(b)q(e)i(an)f(instance)h(of)f(the)g(v)m(ariable's)h (de\014ned)h(t)o(yp)q(e,)e(or)f(\(if)i(it)f(is)h(a)f(p)q(oin)o(ter)g(v)m(aria\ ble\))151 1118 y(p)q(ossibly)21 b(an)d(instance)i(of)e(one)h(of)g(its)g(subt) o(yp)q(es.)31 b(\(In)19 b(C++,)h(subt)o(yping)g(is)f(implemen)o(ted)i(using) 151 1175 y(sub)q(classing.\))g(`)15 b(This)h(applies)h(b)q(oth)e(to)g(assignm\ en)o(t)g(statemen)o(ts)f(and)h(function)h(calls.)93 1264 y(7.)22 b fi(Semanti\ c)n(al)r(ly)15 b(Equivalent)h(R)n(efer)n(enc)n(es)e(and)i(Op)n(er)n(ations.)k fl(This)c(topic)f(is)h(discussed)h(b)q(elo)o(w.)37 1384 y fe(4.1.1)56 b(Seman) n(tically)16 b(Equiv)m(alen)n(t)h(References)g(and)i(Op)r(erations.)37 1470 y fl(As)c(noted)f(ab)q(o)o(v)o(e,)f(sa)o(ying)h(that)g(refactorings)f(are)h(b)q (eha)o(vior)h(preserving)g(is)f(more)g(than)g(sa)o(ying)g(that)f(they)37 1527 y(pro)q(duce)k(legal)g(programs.)k(The)c(v)o(ersions)f(of)f(the)h(program)f (b)q(efore)h(and)h(after)e(a)g(refactoring)h(m)o(ust)f(also)37 1583 y(pro)q (duce)f fi(semantic)n(al)r(ly)e(e)n(quivalent)h(r)n(efer)n(enc)n(es)f(and)i (op)n(er)n(ations.)k fl(Seman)o(tic)13 b(equiv)m(alence)i(is)e(de\014ned)h (here)37 1640 y(as)i(follo)o(ws:)22 b(let)17 b(the)g(external)f(in)o(terface) h(to)e(the)i(program)e(b)q(e)i(via)f(the)h(function)g fi(main)p fl(.)23 b(If) 16 b(the)h(function)37 1696 y fi(main)e fl(is)g(called)i(t)o(wice)e(\(once)g (b)q(efore)g(and)g(once)g(after)f(a)g(refactoring\))g(with)i(the)f(same)f(set) h(of)f(inputs,)h(the)37 1752 y(resulting)i(set)e(of)f(output)h(v)m(alues)i (m)o(ust)d(b)q(e)i(the)g(same.)108 1809 y(This)h(de\014nition)g(of)f(seman)o (tic)g(equiv)m(alence)j(allo)o(ws)d(c)o(hanges)g(throughout)f(the)h(program,) f(as)h(long)g(as)37 1865 y(this)d(mapping)g(of)f(input)i(to)d(output)i(v)m (alues)g(remains)g(the)f(same.)19 b(Imagine)13 b(that)f(a)g(circle)i(is)f(dra) o(wn)e(around)37 1922 y(the)i(parts)f(of)h(a)f(program)g(a\013ected)g(b)o(y)h (a)g(refactoring.)18 b(The)13 b(b)q(eha)o(vior)h(as)e(view)o(ed)i(from)e(outs\ ide)h(the)g(circle)37 1978 y(do)q(es)18 b(not)e(c)o(hange.)26 b(F)l(or)16 b (some)h(refactorings,)g(the)g(circle)h(surrounds)g(most)e(or)g(all)i(of)f(the) g(program.)24 b(F)l(or)37 2035 y(example,)14 b(if)e(a)g(v)m(ariable)i(is)f (referenced)g(throughout)e(a)h(program,)f(the)i(refactoring)e(that)h(c)o(hang\ es)g(its)g(name)37 2091 y(will)18 b(a\013ect)d(m)o(uc)o(h)h(of)f(the)h(progra\ m.)21 b(F)l(or)15 b(other)h(refactorings,)f(the)h(circle)h(co)o(v)o(ers)e(a)h (m)o(uc)o(h)g(smaller)g(area;)37 2148 y(for)c(example,)i(only)f(part)f(of)g (one)g(function)h(b)q(o)q(dy)g(is)g(e\013ected)g(when)g(a)f(particular)h(func\ tion)g(call)h(con)o(tained)37 2204 y(in)h(it)f(is)g(inline)i(expanded.)21 b (In)14 b(b)q(oth)g(cases,)f(the)h(k)o(ey)g(idea)g(is)g(that)f(the)h(results)g (\(including)i(side)f(e\013ects\))e(of)37 2261 y(op)q(erations)j(in)o(v)o(ok) o(ed)g(and)g(references)g(made)f(from)g(outside)h(the)g(circle)h(do)e(not)g (c)o(hange,)h(as)f(view)o(ed)h(from)37 2317 y(outside)g(the)g(circle.)37 2448 y(This)g(allo)o(ws)g(for)e(sev)o(eral)i(imp)q(ortan)o(t)e(c)o(hanges)i(that)e (don't)h(a\013ect)f(equiv)m(alence:)37 2522 y 750 2 v 89 2548 a fu(3)107 2564 y fp(Signature)f(compatibili)q(t)o(y)h(has)e(di\013eren)o(t)h(meanings)g(in)f (other)g(ob)r(ject)f(orien)o(ted)i(languages)h(suc)o(h)e(as)f(Ei\013el)1698 2547 y fw(R)1687 2548 y fn(\015)1739 2564 y fp([79].)16 b(Ei\013el)37 2610 y (is)e(a)f(registered)h(trademark)g(of)f(In)o(teractiv)o(e)h(Soft)o(w)o(are)f (Engineering,)j(Inc.)952 2760 y fl(28)g eop bop 106 42 a fj(\017)22 b fl(expr\ essions)f(can)g(b)q(e)g(simpli\014ed)i(and)e(dead)f(co)q(de)h(remo)o(v)o(ed.) 35 b(Conditional)22 b(statemen)o(ts)d(can)i(b)q(e)151 98 y(simpli\014ed)e(bas\ ed)d(on)g(in)o(v)m(arian)o(t)h(conditions)g(kno)o(wn)f(when)h(the)f(condition\ al)i(is)e(encoun)o(tered)h(\(eg.)151 154 y(class)d(in)o(v)m(arian)o(t\).)19 b (V)l(ariables,)c(functions)f(and)g(classes)g(can)f(b)q(e)h(remo)o(v)o(ed)f (if)h(they)f(are)g(unreferenced.)106 248 y fj(\017)22 b fl(similarly)l(,)17 b (v)m(ariables,)f(functions)g(and)f(classes)h(can)f(b)q(e)h(added)g(if)g(they) f(are)g(unreferenced.)106 342 y fj(\017)22 b fl(the)12 b(t)o(yp)q(e)f(of)g (a)g(v)m(ariable)i(can)f(b)q(e)g(c)o(hanged)g(b)o(y)f(a)g(refactoring,)g(as)h (long)f(as)g(eac)o(h)h(op)q(eration)f(referenced)151 399 y(on)k(the)h(v)m(ari\ able)g(is)g(de\014ned)g(equiv)m(alen)o(tly)i(for)d(its)g(new)g(t)o(yp)q(e.) 106 492 y fj(\017)22 b fl(references)d(to)e(a)h(v)m(ariable)i(and)e(function) h(de\014ned)h(in)f(one)f(class)g(can)h(b)q(e)f(replaced)i(b)o(y)e(references) 151 549 y(to)h(an)g(equiv)m(alen)o(t)i(v)m(ariable)g(or)e(function)h(de\014ne\ d)h(in)f(another)f(class.)33 b(One)20 b(implication)i(of)d(this)151 605 y(is) g(that)e(lo)q(cally)j(de\014ned)f(mem)o(b)q(ers)g(can)f(b)q(e)h(replaced)g (b)o(y)f(inherited)i(mem)o(b)q(ers)e(\(and)g(vice-v)o(ersa\))151 662 y(pro)o (vided)13 b(that)f(the)g(mem)o(b)q(er)h(declarations)g(are)f(equiv)m(alen)o (t.)20 b(In)13 b(addition,)h(references)f(to)e(mem)o(b)q(ers)151 718 y(of)17 b (an)h(aggregate)d(ob)s(ject)i(can)h(b)q(e)g(replaced)h(b)o(y)e(references)h (to)f(mem)o(b)q(ers)h(of)f(one)g(of)g(its)h(exclusiv)o(e)151 775 y(comp)q(one\ n)o(t)d(\(and)h(vice-v)o(ersa\).)108 868 y(One)f(v)o(ery)e(restrictiv)o(e)h (w)o(a)o(y)f(to)g(ensure)h(that)f(the)h(program)f(remains)h(seman)o(tically)h (equiv)m(alen)o(t)g(across)37 925 y(a)i(refactoring)f(is)h(to)f(require)i(tha\ t)e(after)g(a)g(refactoring)h(all)g(references)h(are)e(to)g(the)h(same)f(v)m (ariables)i(and)37 981 y(functions)i(de\014ned)g(in)g(the)f(same)f(classes)h (as)g(b)q(efore)g(the)f(refactoring.)30 b(There)19 b(are)g(a)f(few)h(refactor\ ings)37 1038 y(that)d(this)h(w)o(ould)f(p)q(ermit,)h(suc)o(h)f(as)g(adding)h (a)f(new)h(v)m(ariable)g(or)f(renaming)g(an)h(existing)g(one.)23 b(Ho)o(w)o (ev)o(er,)37 1094 y(it)16 b(w)o(ould)g(prev)o(en)o(t)f(man)o(y)f(useful)j(ref\ actoring)d(op)q(erations.)108 1151 y(Beha)o(vior)d(can)f(b)q(e)i(preserv)o (ed)e(under)i(less)f(restrictiv)o(e)g(conditions,)h(when)f(for)f(example)h (a)f(class)h(mem)o(b)q(er)37 1207 y(is)h(mo)o(v)o(ed)f(up)h(or)e(do)o(wn)h (an)g(inheritance)i(hierarc)o(h)o(y)l(,)f(or)f(when)h(a)f(mem)o(b)q(er)g(is)h (mo)o(v)o(ed)e(b)q(et)o(w)o(een)i(an)f(aggregate)37 1264 y(class)20 b(and)f (a)g(comp)q(onen)o(t)g(class.)32 b(When)19 b(a)g(mem)o(b)q(er)g(v)m(ariable)h (is)g(mo)o(v)o(ed)e(from)g(one)i(class)f(to)f(another,)37 1320 y(b)q(eha)o (vior)g(will)g(b)q(e)g(preserv)o(ed)f(if)g(there)g(is)h(a)e(strict)h(one-to-o\ ne)g(relationship)i(b)q(et)o(w)o(een)e(the)g(old)g(v)m(ariable)37 1377 y(and) f(new)f(v)m(ariable:)106 1470 y fj(\017)22 b fl(in)16 b(the)f(new)h(class)f (the)h(v)m(ariable)g(has)f(the)h(same)f(t)o(yp)q(e)g(and)g(lifetime)i(as)e (b)q(efore,)106 1564 y fj(\017)22 b fl(all)16 b(references)g(to)f(the)g(old)h (v)m(ariable)g(are)f(c)o(hanged)h(to)e(refer)h(to)g(the)g(new)h(v)m(ariable,) 106 1658 y fj(\017)22 b fl(the)15 b(new)h(v)m(ariable)g(is)g(not)f(otherwise) g(referenced.)108 1752 y(These)h(preconditions)h(are)e(more)h(easily)g(c)o (hec)o(k)o(ed)g(for)f(refactorings)g(in)o(v)o(olving)i(inheritance)h(than)d (for)37 1808 y(refactorings)g(in)o(v)o(olving)i(aggregates)c(and)j(comp)q(one\ n)o(ts,)f(as)f(is)i(detailed)h(in)f(the)f(later)g(c)o(hapters.)108 1865 y(Som\ e)20 b(refactorings)g(c)o(hange)h(the)f(size)h(of)f(ob)s(jects)g(or)f(c)o(han\ ge)i(the)f(relativ)o(e)h(ph)o(ysical)h(p)q(ositions)f(of)37 1921 y(v)m(ariabl\ es)f(within)g(an)e(ob)s(ject.)29 b(These)19 b(refactorings)f(are)g(b)q(eha)o (vior)h(preserving)g(only)g(for)f(w)o(ell)h(b)q(eha)o(v)o(ed)37 1978 y(C++)13 b(programs.)k(Consider)c(the)e(ph)o(ysical)i(la)o(y)o(out)f(of)f(a)g(class)h (in)h(C++,)g(in)f(whic)o(h)h(the)f(v)m(ariables)h(inherited)37 2034 y(from)h (a)g(sup)q(erclass)h(precede)g(v)m(ariables)h(lo)q(cally)g(de\014ned.)21 b (The)14 b(refactoring)g(that)f(mo)o(v)o(es)h(a)g(v)m(ariable)h(from)37 2090 y (a)i(sub)q(class)h(to)e(sup)q(erclass)i(is)f(b)q(eha)o(vior)h(preserving)f (as)g(long)g(as)f(the)h(program)f(is)h(not)f(dep)q(enden)o(t)j(up)q(on)37 2147 y(the)j(ph)o(ysical)g(ordering)g(of)e(v)m(ariables.)39 b(If)22 b(a)f(program) f(then)h(p)q(erforms)g(in)o(teger)g(arithmetic)h(with)f(the)37 2203 y(address) 15 b(of)e(a)h(mem)o(b)q(er)h(v)m(ariable,)g(then)g(the)f(b)q(eha)o(vior)g(of) g(the)g(program)f(ma)o(y)h(c)o(hange)g(when)h(the)f(v)m(ariable)37 2260 y(is) j(mo)o(v)o(ed.)23 b(Similarly)l(,)c(consider)e(the)f(refactoring)g(that)g(mo) o(v)o(es)f(a)h(v)m(ariable)i(from)d(an)i(aggregate)d(class)j(to)37 2316 y(a)f (comp)q(onen)o(t)f(class.)21 b(In)16 b(this)g(case,)f(the)h(size)g(of)f(eac)o (h)h(class)g(c)o(hanges.)21 b(If)15 b(a)g(program)g(tests)g(the)g(ph)o(ysical) 37 2373 y(size)i(of)d(an)i(ob)s(ject,)e(the)h(b)q(eha)o(vior)h(of)f(the)g(pro\ gram)f(ma)o(y)g(c)o(hange)i(when)f(the)h(v)m(ariable)g(is)g(mo)o(v)o(ed.)108 2429 y(The)f(refactoring)f(approac)o(h)g(de\014ned)i(in)f(this)g(thesis)g(do) q(es)g(not)f(apply)i(to)e(programs)f(that)h(are)g(dep)q(en-)37 2486 y(den)o (t)i(up)q(on)g(the)f(ph)o(ysical)i(la)o(y)o(out)e(and)h(size)g(of)f(ob)s(ject\ s.)k(F)l(ortunately)l(,)d(most)e(ob)s(ject)h(orien)o(ted)h(programs)37 2542 y (are)g(not)f(dep)q(enden)o(t)i(up)q(on)f(these)g(features.)21 b(A)15 b(ma)s (jor)g(attractiv)o(eness)f(of)i(ob)s(ject-orien)o(ted)f(languages)h(is)37 2599 y(that)d(they)g(pro)o(vide)g(a)g(lev)o(el)h(of)e(abstraction)h(that)f(shields) j(the)d(user)i(from)e(the)h(underlying)h(represen)o(tation)952 2760 y(29)g eop bop 37 42 a fl(of)13 b(ob)s(jects;)f(it)h(is)g(generally)h(considered)g(bad)f (st)o(yle)g(to)f(write)g(programs)g(that)g(dep)q(end)i(on)e(this)i(underlying) 37 98 y(represen)o(tation.)22 b(Refactorings)15 b(that)g(can)h(c)o(hange)g (the)g(ph)o(ysical)g(size)h(and)f(la)o(y)o(out)f(of)g(ob)s(jects)g(are)g(note\ d)37 154 y(as)g(suc)o(h)h(in)g(later)f(c)o(hapters)g(of)g(the)g(thesis.)37 273 y fe(4.1.2)56 b(Summary:)22 b(Program)17 b(Prop)r(erties)g(and)j(Beha)n(vior) e(Preserv)m(ation)37 358 y fl(In)h(summary)l(,)g(refactorings)f(preserv)o(e)g (the)h(b)q(eha)o(vior)g(of)f(a)g(program.)28 b(This)19 b(implies)h(that)e(ref\ actorings)37 415 y(alw)o(a)o(ys)13 b(result)h(in)g(legal)g(programs)f(that)f (p)q(erform)h(op)q(erations)h(equiv)m(alen)o(t)h(to)e(b)q(efore)h(the)f(refac\ toring.)19 b(In)37 471 y(this)d(thesis,)f(b)q(eha)o(vior)g(preserv)m(ation)h (is)f(argued)g(in)h(terms)e(of)h(the)g(sev)o(en)g(program)f(prop)q(erties)i (describ)q(ed)37 528 y(ab)q(o)o(v)o(e.)30 b(These)19 b(prop)q(erties)h(are)e (the)h(ones)f(found)h(to)f(b)q(e)h(most)f(frequen)o(tly)h(violated)h(when)f (refactoring)37 584 y(programs.)108 641 y(Chapter)h(\014v)o(e)f(describ)q(es) j(the)e(lo)o(w-lev)o(el)h(refactorings.)33 b(There,)21 b(b)q(eha)o(vior)f(pre\ serv)m(ation)g(is)h(argued)37 697 y(in)e(terms)e(of)g(the)g(program)g(prop)q (erties)h(describ)q(ed)h(ab)q(o)o(v)o(e.)26 b(Chapters)18 b(six)f(through)h (eigh)o(t)f(describ)q(e)i(the)37 754 y(high-lev)o(el)h(refactorings.)27 b(Beh\ a)o(vior)18 b(preserv)m(ation)g(of)f(those)g(refactorings)g(is)i(mainly)f(arg\ ued)g(in)g(terms)37 810 y(of)d(the)h(lo)o(w)o(er)e(lev)o(el)j(refactorings)e (used)g(to)g(comp)q(ose)g(it.)37 950 y fd(4.2)70 b(Domains)22 b(of)h(Refactor\ ings)37 1051 y fl(The)16 b(argumen)o(ts)e(to)h(refactorings)g(are)f(t)o(yp)q (ed;)i(the)f(t)o(yp)q(es)g(and)g(their)h(attributes)f(are)g(de\014ned)i(b)q (elo)o(w.)108 1108 y(Asso)q(ciated)g(with)h(eac)o(h)f(v)m(ariable)h(and)f(fun\ ction)h(is)f(an)g(attribute)f(that)h(indicates)h(its)f(scop)q(e.)25 b(There) 37 1164 y(are)12 b(four)g(kinds)h(of)e(v)m(ariables)i(in)g(C++:)19 b(global) 13 b(v)m(ariables,)g(class)f(mem)o(b)q(er)g(v)m(ariables,)i(argumen)o(t)d(v)m (ariables)37 1221 y(in)k(a)e(function,)h(and)f(v)m(ariables)i(lo)q(cal)f(to)f (a)g(statemen)o(t)f(list)i(of)f(a)g(function.)20 b(Tw)o(o)13 b(kinds)h(of)f (C++)h(functions)37 1277 y(are)h(considered)i(in)f(this)g(researc)o(h:)j(a)c (single)i(global)f(function)g fi(main\(\))e fl(and)h(class)h(mem)o(b)q(er)f (functions.)108 1333 y(When)d(adding)h(a)e(new)h(v)m(ariable,)i(a)d(name)h (collision)i(o)q(ccurs)e(if,)g(within)h(the)f(scop)q(e)g(of)g(the)f(new)h(v)m (ariable,)37 1390 y(there)18 b(is)h(a)e(reference)i(to)e(a)h(v)m(ariable)h (with)f(the)g(same)g(name)g(de\014ned)h(in)g(an)e(enclosing)j(scop)q(e.)28 b (F)l(or)17 b(the)37 1446 y(purp)q(oses)d(of)f(c)o(hec)o(king)i(name)e(collisi\ ons,)j(the)d(scop)q(e)h(of)f(a)g(v)m(ariable)i(is)f(as)f(follo)o(ws.)19 b(The) 14 b(scop)q(e)g(of)f(a)g(global)37 1503 y(v)m(ariable)k(is)f(the)f(en)o(tire) h(program)e fi(Pr)n(o)n(gr)n(am)p fl(.)19 b(The)d(scop)q(e)f(of)g(a)g(class)h (mem)o(b)q(er)f(v)m(ariable)i(is)e(the)h(class)f(that)37 1559 y(con)o(tains)i (it,)g(if)g(the)f(v)m(ariable's)i(accessCon)o(trolMo)q(de)e(is)h(priv)m(ate;) g(otherwise,)g(the)f(con)o(taining)h(class)g(and)37 1616 y(its)g(sub)q(classe\ s.)313 1599 y fs(4)358 1616 y fl(The)g(scop)q(e)g(of)g(an)f(argumen)o(t)g(v)m (ariable)i(is)f(the)g(function)g(that)f(con)o(tains)h(it.)25 b(Similarly)l (,)37 1672 y(the)16 b(scop)q(e)g(of)e(a)h(lo)q(cal)h(v)m(ariable)h(is)f(its)f (con)o(taining)h(blo)q(c)o(k.)108 1729 y(F)l(unctions)e(are)f(restricted)h (to)f(a)g(single)i(global)f(function)g fi(main\(\))f fl(and)h(a)f(set)g(a)g (mem)o(b)q(er)h(functions)g(for)37 1785 y(eac)o(h)h(class.)243 1769 y fs(5) 283 1785 y fl(F)l(unctions)g(de\014ned)g(in)g(a)f(sup)q(erclass)i(can)e(b)q (e)h(o)o(v)o(erridden)g(in)g(a)f(sub)q(class,)h(as)f(long)h(as)f(either)37 1842 y(the)j(sup)q(erclass)h(function)g(is)f(not)g(referenced)h(within)g(the) f(scop)q(e)g(of)f(the)h(class)g(that)f(will)j(o)o(v)o(erride)e(it,)g(or)37 1898 y(the)f(new)f(function)h(is)g(equiv)m(alen)o(t)h(with)e(the)h(function)g (it)f(replaces.)108 1954 y(A)o(ttributes)g(are)g(listed)h(with)g(their)g(allo) o(w)o(able)g(t)o(yp)q(e\(s\))e(follo)o(w)o(ed)i(b)o(y)f(their)h(name:)106 2030 y fj(\017)22 b fl(program:)202 2116 y fh({)h fl(\(set)15 b(of)g(class\))g(cla\ sses)202 2182 y fh({)23 b fl(function)16 b(globalF)l(unctionMain)823 2165 y fs (6)37 2248 y 750 2 v 89 2274 a fu(4)107 2290 y fp(In)f(cases)g(where)g(the)g (v)n(ariable's)i(accessCon)o(trolMo)q(de)h(is)d(public,)j(the)d(v)n(ariable)i (can)e(b)q(e)h(referenced)f(elsewhere)h(in)g(the)37 2336 y(program,)c(but,)g (outside)h(the)e(v)n(ariable's)i(con)o(taining)h(class)e(and)g(its)g(sub)q (classes,)h(references)f(to)f(the)h(v)n(ariable)h(will)g(b)q(e)e(pre\014xed) 37 2382 y(with)j(the)f(name)h(of)e(the)h(ob)r(ject)h(con)o(taining)h(the)e (mem)o(b)q(er)h(v)n(ariable.)89 2411 y fu(5)107 2427 y fp(This)d(restriction) i(to)e(a)g fm(single)e fp(global)k(function)g(w)o(as)e(made)g(to)g(a)o(v)o (oid)h(complicating)i(the)e(notation)g(of)f(some)g(refactorings.)37 2473 y (A)i(straigh)o(tforw)o(ard)h(extension)h(could)g(allo)o(w)f(m)o(ultiple)h(glo\ bal)g(functions.)89 2503 y fu(6)107 2519 y fp(C++)e(allo)o(ws)j(m)o(ultiple)h (global)g(functions.)23 b(Here,)15 b(a)f(program)i(consists)g(of)e(a)g(single) j(global)g(function)f fm(main)p fp(,)d(whic)o(h)j(is)37 2564 y(not)f(renamabl\ e.)21 b(This)15 b(restriction,)g(whic)o(h)g(is)f(not)h(signi\014can)o(t,)h (w)o(as)e(made)g(to)g(a)o(v)o(oid)h(complicating)i(the)d(notation)h(of)f(some) 37 2610 y(refactorings.)19 b(A)12 b(straigh)o(tforw)o(ard)j(extension)g(could) f(allo)o(w)g(m)o(ultiple)i(global)f(functions.)952 2760 y fl(30)g eop bop 202 42 a fh({)23 b fl(\(set)15 b(of)h(v)m(ariable\))g(globalV)l(ariables)i(of)d (their)h(argumen)o(ts;)f(the)h(functions)g(are)f(argumen)o(t)g(do-)251 98 y (mains)h(are)f(de\014ned)h(here.)202 170 y fh({)23 b fl(\(set)15 b(of)g(en)o (umeratedT)o(yp)q(e\))g(globalEn)o(umeratedT)o(yp)q(es)106 262 y fj(\017)22 b fl(class:)202 354 y fh({)h fl(class)16 b(sup)q(erclass)202 426 y fh({)23 b fl (string)15 b(name)202 498 y fh({)23 b fl(\(set)15 b(of)g(function\))g(lo)q (callyDe\014nedMem)o(b)q(erF)l(unc)q(tions)202 569 y fh({)23 b fl(\(set)15 b (of)g(v)m(ariable\))h(lo)q(callyDe\014nedMem)o(b)q(erV)l(ariabl)q(es)202 641 y fh({)23 b fl(\(set)15 b(of)g(v)m(ariable\))h(SetOfComp)q(onen)o(ts)202 713 y fh({)23 b fl(predicate)16 b(classIn)o(v)m(arian)o(t)106 805 y fj(\017)22 b fl (en)o(umeratedT)o(yp)q(e:)202 898 y fh({)h fl(string)15 b(name)202 969 y fh ({)23 b fl(\(set)15 b(of)g(string\))f(en)o(umeratedV)l(alues)106 1062 y fj (\017)22 b fl(function:)202 1154 y fh({)h fl(\(class)15 b(+)h(program\))e(o)o (wner)202 1226 y fh({)23 b fl(string)15 b(name)202 1297 y fh({)23 b fl(t)o (yp)q(e)15 b(returnT)o(yp)q(e)202 1369 y fh({)23 b fl(\(list)16 b(of)f(v)m (ariable\))h(argumen)o(ts)202 1441 y fh({)23 b fl(statemen)o(t)14 b(b)q(o)q (dy)l(.)202 1512 y fh({)23 b fl(\(nil)16 b(+)g(priv)m(ate)g(+)f(protected)h (+)f(public\))i(accessCon)o(trolMo)q(de)106 1605 y fj(\017)22 b fl(v)m(ariabl\ e:)202 1697 y fh({)h fl(\(statemen)o(t)14 b(+)h(function)h(+)g(class)g(+)f (program\))f(o)o(wner)202 1769 y fh({)23 b fl(string)15 b(name)202 1841 y fh ({)23 b fl(t)o(yp)q(e)15 b(t)o(yp)q(e)202 1912 y fh({)23 b fl(\(set)15 b(of)g (constan)o(t\))f(initializationArgumen)o(ts)202 1984 y fh({)23 b fl(\(nil)16 b (+)g(priv)m(ate)g(+)f(protected)h(+)f(public\))i(accessCon)o(trolMo)q(de)106 2076 y fj(\017)22 b fl(t)o(yp)q(e:)e(program.classes)14 b(+)i(Primitiv)o(eT)o (yp)q(es.)202 2169 y fh({)23 b fl(string)15 b(name)106 2261 y fj(\017)22 b fl (statemen)o(t:)202 2354 y fh({)h fl(\(statemen)o(t)14 b(+)h(function\))h(o)o (wner)202 2425 y fh({)23 b fl(\(list)16 b(of)f(\(statemen)o(t)e(+)j(expressio\ n\)\))f(comp)q(onen)o(ts)106 2518 y fj(\017)22 b fl(expression:)f(assignmen)o (t)15 b(+)g(v)m(ariableRef)j(+)d(functionCall)i(+)e(dynamicOb)s(jectExpressio\ n)106 2610 y fj(\017)22 b fl(assignmen)o(t:)952 2760 y(31)g eop bop 202 42 a fh({)23 b fl(\(expression)16 b(+)f(statemen)o(t\))f(o)o(wner)202 115 y fh({) 23 b fl(v)m(ariable)17 b(destination)202 188 y fh({)23 b fl(expression)16 b (source)202 261 y fh({)23 b fl(t)o(yp)q(e)15 b(t)o(yp)q(e)106 355 y fj(\017) 22 b fl(dynamicOb)s(jectExpression:)202 448 y fh({)h fl(class)16 b(instan)o (tiatedClass)202 521 y fh({)23 b fl(\(list)16 b(of)f(expression\))g(parameter\ s)106 615 y fj(\017)22 b fl(functionCall:)202 709 y fh({)h fl(\(expression)16 b(+)f(statemen)o(t\))f(o)o(wner)202 782 y fh({)23 b fl(function)16 b(calledF) l(unction)202 855 y fh({)23 b fl(\(list)16 b(of)f(expression\))g(parameters) 202 928 y fh({)23 b fl(t)o(yp)q(e)15 b(t)o(yp)q(e)202 1001 y fh({)23 b fl(exp\ ression)16 b(pre\014x.)595 985 y fs(7)106 1095 y fj(\017)22 b fl(v)m(ariableR\ ef:)202 1189 y fh({)h fl(\(expression)16 b(+)f(statemen)o(t\))f(o)o(wner)202 1262 y fh({)23 b fl(v)m(ariable)17 b(refdV)l(ariable)202 1335 y fh({)23 b fl (expression)16 b(pre\014x.)595 1318 y fs(8)106 1429 y fj(\017)22 b fl(predica\ te:)f(used)16 b(in)g(de\014ning)g(class)g(in)o(v)m(arian)o(ts;)f(de\014ned)i (in)f(c)o(hapter)f(six.)108 1523 y(In)k(the)f(refactoring)g(de\014nitions,)j (domain)e(attributes)f(are)g(referenced)h(using)g(a)f fi(dot)h fl(notation.) 29 b(F)l(or)37 1579 y(example,)16 b(the)f(return)h(t)o(yp)q(e)f(of)g(mem)o (b)q(er)g(function)h fi(F)f fl(w)o(ould)g(b)q(e)h(referenced)g(b)o(y)g fi(F.r) n(eturnT)m(yp)n(e)p fl(.)37 1722 y fd(4.3)70 b(F)-6 b(unctions)23 b(F)-6 b (or)24 b(Describing)d(Preconditions)37 1824 y fl(Most)16 b(refactorings)g(are) g(only)i(b)q(eha)o(vior)f(preserving)g(under)g(certain)g(preconditions.)26 b (F)l(or)16 b(example,)h(the)37 1880 y(t)o(yp)q(e)e(of)e(a)h(v)m(ariable)i(can) e(b)q(e)h(c)o(hanged)f(only)h(if)f(assignmen)o(ts)g(in)o(v)o(olving)i(the)e (v)m(ariable)h(w)o(ould)g(remain)f(t)o(yp)q(e)37 1937 y(safe.)108 1993 y(Refa\ ctorings)f(ha)o(v)o(e)f(their)h(preconditions)h(describ)q(ed)g(in)g(terms)e (of)g(a)g(set)g(of)g(functions.)20 b(The)13 b(functions)37 2050 y(is)19 b(de\ \014ned)g(b)q(elo)o(w.)28 b(There)18 b(is)g(a)g(small)g(set)g(of)f(primitiv)o (e)j(functions,)e(follo)o(w)o(ed)g(b)o(y)g(a)g(larger)f(set)h(of)f(non-)37 2106 y(primitiv)o(e)g(functions.)k(F)l(or)14 b(the)i(non-b)q(o)q(olean)g(func\ tions,)g(the)f(return)g(t)o(yp)q(e)g(is)h(listed)h(b)q(efore)e(the)g(name.) 108 2162 y(In)22 b(the)f(preconditions)h(of)f(eac)o(h)g(refactoring,)h(the)f (function)h(names)f(and)g(argumen)o(ts)f(are)h(usually)37 2219 y(descriptiv)o (e.)i(The)16 b(de\014nitions)h(in)g(this)f(section,)g(included)i(for)d(comple\ teness,)i(pro)o(vide)f(a)f(lev)o(el)i(of)e(detail)37 2275 y(b)q(ey)o(ond)h (what)f(ma)o(y)f(b)q(e)i(of)f(in)o(terest)g(to)g(some)g(readers.)20 b(This)15 b(section)h(can)g(b)q(e)f(skipp)q(ed)i(without)f(missing)37 2332 y(the)g(in)o (ten)o(t)f(of)g(the)g(refactorings.)37 2413 y 750 2 v 89 2440 a fu(7)107 2456 y fp(If)f(calledF)m(unction)19 b(is)c(called)i(through)f(the)f(public)j(in)o (terface)e(of)e(an)i(ob)r(ject,)f(this)h(attribute)g(con)o(tains)h(the)e(expr\ ession)37 2501 y(that)f(iden)o(ti\014es)h(that)e(ob)r(ject;)g(otherwise,)h (this)g(attribute)g(is)f(nil.)89 2531 y fu(8)107 2547 y fp(If)k(refdV)m(ariab\ le)j(is)e(a)g(mem)o(b)q(er)g(v)n(ariable)i(referenced)f(through)g(the)f(publi\ c)i(in)o(terface)f(of)f(an)g(ob)r(ject,)h(this)g(attribute)37 2593 y(con)o (tains)c(the)e(expression)i(that)f(iden)o(ti\014es)h(that)e(ob)r(ject;)g(othe\ rwise,)h(this)f(attribute)i(is)e(nil.)952 2760 y fl(32)g eop bop 37 42 a fe (4.3.1)56 b(Bo)r(olean)17 b(Primitiv)n(e)f(F)-5 b(unctions)93 127 y fl(1.)22 b (compilesP)17 b(\(function)e(F,)g(\(class)g(+)h(program\))d(Scop)q(e\))j fj (\021)226 184 y fl(F)f(compiles)i(within)f(its)f(Scop)q(e.)787 167 y fs(9)93 276 y fl(2.)22 b(con)o(v)o(ertibleT)l(oF)l(unctionP)17 b(\(statemen)o(t)d(S\)) h fj(\021)226 332 y fl(S)h(can)f(b)q(e)h(con)o(v)o(erted)f(to)f(a)h(legal)h (function)g(\(in)g(con)o(tainingClass\(S\)\).)1467 316 y fs(10)93 424 y fl (3.)22 b(quali\014esAsComp)q(onen)o(tP)17 b(\(v)m(ariable)f(V\))f fj(\021)226 480 y fl(V)g(quali\014es)i(as)e(a)g(comp)q(onen)o(t)g(mem)o(b)q(er)h(v)m(aria\ ble)g(of)f(its)g(con)o(taining)h(class.)1562 464 y fs(11)93 572 y fl(4.)22 b (noSideE\013ectsP)16 b(\(expression)g(E\))f fj(\021)226 629 y fl(E)g(is)h(kno) o(wn)f(to)f(ha)o(v)o(e)h(no)g(side)i(e\013ects.)93 721 y(5.)22 b(satis\014esC\ lassIn)o(v)m(arian)o(tP)16 b(\(expression)g(E,)e(class)i(C\))f fj(\021)226 777 y fl(instances)h(created)f(b)o(y)g(E)h(satisfy)e(the)i(class)f(in)o(v)m(arian) o(t)h(for)f(C.)1323 761 y fs(12)93 869 y fl(6.)22 b(seman)o(ticallyEquiv)m (alen)o(tP)c(\(\(function)d(or)g(statemen)o(t\))f(F1,)g(\(function)i(or)e(sta\ temen)o(t\))g(F2\))g fj(\021)226 925 y fl(F1)h(is)g(seman)o(tically)i(equiv)m (alen)o(t)g(to)d(F2.)93 1017 y(7.)22 b(subt)o(yp)q(eP\(t)o(yp)q(e)16 b(T1,)e (t)o(yp)q(e)h(T2\))g fj(\021)226 1074 y fl(T1)g(is)h(a)e(subt)o(yp)q(e)i(of)f (T2.)93 1166 y(8.)22 b(unrefdOnInstancesP\(function)c(F,)c(class)i(C\))e fj (\021)226 1222 y fl(function)i(F)f(is)h(not)f(referenced)h(on)f(instances)h (of)f(class)g(C.)37 1343 y fe(4.3.2)56 b(Other)18 b(Primitiv)n(e)e(F)-5 b(unc\ tions)93 1429 y fl(1.)22 b(\014rstConditionImpliedByI)q(n)o(v)m(arian)o(t)c (\(statemen)o(t)c(S)h(\(a)g(conditional\),)h(predicate)g(P\))226 1485 y(retur\ ns)f(the)g(\014rst)g(condition)i(in)f(S)f(implied)j(b)o(y)d(P)l(.)1113 1469 y fs(13)37 1606 y fe(4.3.3)56 b(Non-primitiv)m(e)16 b(Bo)r(olean)h(F)-5 b(uncti\ ons)93 1692 y fl(1.)22 b(inheritedMem)o(b)q(erF)l(unctionNamedP\(cl)q(ass)17 b (C,)e(string)g(S\))g fj(\021)226 1748 y(9)h fl(mem)o(b)q(er)f fj(2)g fl(inher\ itedMem)o(b)q(ers\(C\))i fj(^)301 1805 y fl(mem)o(b)q(er.name)e(=)h(S.)93 1896 y(2.)22 b(matc)o(hingA)o(ttributesP\(v)m(ariable)16 b(V1,)f(v)m(ariable)i(V2\ \))d fj(\021)226 1953 y fl(\(V1.name)g(=)i(V2.name\))e fj(^)226 2009 y fl(\(V\ 1.t)o(yp)q(e)h(=)g(V2.t)o(yp)q(e\))f fj(^)226 2066 y fl(\(V1.initializationAr\ gumen)o(ts)j(=)e(V2.initializationArgumen)o(ts\))i fj(^)226 2122 y fl(\(V1.ac\ cessCon)o(trolMo)q(de)d(=)i(V2.accessCon)o(trolMo)q(de\))37 2202 y 750 2 v 89 2229 a fu(9)107 2245 y fp(This)d(is)h(c)o(hec)o(k)o(ed)g(when)f(adding)i(a)e (new)g(function,)h(or)f(adding)i(a)e(function)h(b)q(o)q(dy)g(to)f(a)g(functio\ n)h(de\014nition.)74 2274 y fu(10)107 2290 y fp(S)f(m)o(ust)h(not)g(de\014ne) g(lo)q(cal)h(v)n(ariables)h(that)e(are)f(referenced)i(outside)g(S.)e(There)g (m)o(ust)h(b)q(e)g(no)g(branc)o(hes)h(from)e(S)g(to)h(other)37 2336 y(parts)e (of)g(its)g(curren)o(t)g(function;)h(nor)f(ma)o(y)g(there)g(b)q(e)f(an)o(y)i (branc)o(hes)f(in)o(to)h(the)f(middle)h(of)e(S)h(\(if)g(S)f(is)i(a)e(comp)q (ound)i(statemen)o(t\).)37 2382 y(F)m(unctions)k(and)e(v)n(ariables)h(visible) h(to)d(S)h(will)h(b)q(e)e(visible)j(to)e(the)f(new)g(function,)i(since)g(func\ tions)f(and)g(non-lo)q(cal)i(v)n(ariables)37 2427 y(visible)g(to)d(S)g(w)o (ould)h(b)q(e)f(visible)j(to)d(the)g(new)f(function)j(since)f(it)f(is)h(de\ \014ned)g(in)g(the)f(same)g(class;)h(referenced)f(v)n(ariables)j(lo)q(cal)37 2473 y(to)c(the)h(function)g(but)f(not)h(lo)q(cal)g(to)f(S)g(w)o(ould)h(b)q (e)g(passed)g(as)f(argumen)o(ts.)74 2503 y fu(11)107 2519 y fp(This)g(w)o(oul\ d)h(b)q(e)g(determined)g(using)h(the)e(algorithms)i(de\014ned)f(in)g(section) g(8.2.)74 2548 y fu(12)107 2564 y fp(This)f(w)o(ould)h(b)q(e)g(determined)g (using)h(the)e(algorithm)i(de\014ned)f(in)g(section)g(7.8.)74 2594 y fu(13) 107 2610 y fp(This)f(w)o(ould)h(b)q(e)g(determined)g(using)h(the)e(algorithm) i(de\014ned)f(in)g(section)g(7.6.)952 2760 y fl(33)g eop bop 93 42 a fl(3.)22 b(matc)o(hingA)o(ttributesP\(function)16 b(F1,)e(function)i(F2\))e fj(\021) 226 98 y fl(matc)o(hingSignatureP\(F1,)h(F2\))f fj(^)226 154 y fl(\(F1.b)q (o)q(dy)h(=)g(F2.b)q(o)q(dy\).)93 248 y(4.)22 b(matc)o(hingSignatureP\(functi\ on)16 b(F1,)f(function)h(F2\))e fj(\021)226 305 y fl(\(F1.name)g(=)i(F2.name\ \))d fj(^)226 361 y fl(\(F1.returnT)o(yp)q(e)h(=)i(F2.returnT)o(yp)q(e\))e fj (^)226 418 y fl(\(F1.accessCon)o(trolMo)q(de)g(=)h(F2.accessCon)o(trolMo)q (de\))f fj(^)226 474 y fl(length)i(of)f(F1.argumen)o(ts)e(=)j(length)g(of)e (F2.argumen)o(ts)g fj(^)226 531 y fl(for)h(i)g(=)h(1)f(to)f(\(length)i(of)f (F1.argumen)o(ts\),)301 587 y(F1.argumen)o(ts[i].t)o(yp)q(e)e(=)j(F2.argumen) o(ts[i].t)o(yp)q(e.)93 681 y(5.)22 b(mem)o(b)q(erF)l(unctionNamedP\(class)17 b (C,)d(string)h(S\))g fj(\021)226 737 y(9)h fl(F)e fj(2)301 794 y fl(\(C.lo)q (callyDe\014nedMem)o(b)q(erF)l(unctions)k fj([)d fl(inheritedMem)o(b)q(erF)l (unctions\(C\)\))i fj(^)226 850 y fl(F.name)e(=)g(N.)93 944 y(6.)22 b(redunda\ n)o(tIfAddedP\(function)c(F,)c(class)i(C\))e fj(\021)226 1000 y(9)i fl(F2)e fj (2)i fl(\(C.sup)q(erclass\).lo)q(callyDe\014nedMem)o(b)q(erF)l(unctions)i fj ([)301 1057 y fl(inheritedMem)o(b)q(erF)l(unctions\(C.sup)q(ercl)q(ass\)\))f fj(^)226 1113 y fl(F.name)e(=)g(F2.name)f fj(^)226 1170 y fl(matc)o(hingA)o (ttributesP\(F,)g(F2\).)93 1264 y(7.)22 b(v)m(arNameCollisionP\(string)17 b (S,)e(\(class)g(+)h(function)g(+)f(statemen)o(t\))f(Scop)q(e\))i fj(\021)226 1320 y(9)g fl(collidingV)l(ar)h fj(2)f fl(Program)d fj(^)226 1377 y fl(collid\ ingV)l(ar.name)k(=)f(S)f fj(^)226 1433 y fl(Scop)q(e)h fj(\032)g fl(scop)q (eOf\(collidingV)l(ar\).)37 1555 y fe(4.3.4)56 b(Other)18 b(Non-primitiv)m (e)e(functions)93 1640 y fl(1.)22 b(\(set)15 b(of)g(function\))g(allF)l(uncti\ ons\(program)h(P\))f fj(\021)213 1743 y fk(P)q(:g)r(l)q(obal)q(F)6 b(unctionM) f(ain)689 1702 y fa([)733 1743 y fl(\()p fj([)781 1750 y fr(class)p fq(2)p fr (P)q(:classes)1028 1743 y fk(cl)q(ass:l)q(ocal)q(l)q(y)r(D)q(ef)g(inedM)g(emb\ er)q(F)h(unctions)p fl(\))93 1863 y(2.)22 b(\(set)15 b(of)g(function\))g(allV) l(ariables\(program)h(P\))f fj(\021)226 1920 y fl(returns)g(the)g(set)g(of)g (all)h(v)m(ariables)h(declared)f(in)g(P)l(.)93 2014 y(3.)22 b(\(set)15 b(of)g (functionCall\))h(callsT)l(o\(function)h(F1\))d fj(\021)451 2075 y fa([)251 2169 y fr(F)5 b fs(2)p fq(2)p fr(allF)g(unctions)p fs(\()p fr(P)g(r)q(og)q (r)q(am)p fs(\))698 2116 y fj(f)p fk(F)h(C)15 b fj(j)e fk(F)6 b(C)16 b fj(2)c fk(F)6 b fl(2)p fk(:statement)13 b fj(^)d fk(F)c(C)q(:cal)q(l)q(edF)g(unction) 11 b fl(=)i fk(F)6 b fl(1)p fj(g)93 2285 y fl(4.)22 b(\(set)15 b(of)g(class\)) g(classesIn)o(ternallyReferencin)q(g\(\(function)j(+)d(v)m(ariable\))i(X\))e fj(\021)302 2387 y(f)p fk(containing)r(C)s(l)q(ass)p fl(\()p fk(r)q(ef)5 b fl (\))12 b fj(j)g fl(\()p fk(r)q(ef)17 b fj(2)c fk(r)q(ef)5 b(er)q(encesT)h(o)p fl(\()p fk(X)t fl(\)\))j fj(^)h fl(\()p fk(r)q(ef)r(:pr)q(ef)5 b(ix)13 b fl (=)f fk(nil)q fl(\))p fj(g)151 2489 y fl(\(ie)k(the)f(set)g(of)g(classes)h (in)o(ternally)g(referencing)g(X.\))952 2760 y(34)g eop bop 93 42 a fl(5.)22 b (\(set)15 b(of)g(class\))g(classesPubliclyRe)q(ferenci)q(ng\(\(function)j(+)e (v)m(ariable\))g(X\))f fj(\021)302 140 y(f)p fk(containing)r(C)s(l)q(ass)p fl (\()p fk(r)q(ef)5 b fl(\))12 b fj(j)g fl(\()p fk(r)q(ef)17 b fj(2)c fk(r)q (ef)5 b(er)q(encesT)h(o)p fl(\()p fk(X)t fl(\)\))j fj(^)h fl(\()p fk(r)q(ef)r (:pr)q(ef)5 b(ix)13 b fj(6)p fl(=)f fk(nil)q fl(\))p fj(g)151 238 y fl(\(ie)h (the)g(set)g(of)f(classes)i(referencing)g(X)f(through)f(the)h(public)i(in)o (terface)e(of)g(its)g(con)o(taining)g(class\(es\).\))93 330 y(6.)22 b(\(set) 15 b(of)g(class\))g(classesReferencing\(class)i(X\))e fj(\021)529 428 y(f)p fk (containing)r(C)s(l)q(ass)p fl(\()p fk(r)q(ef)5 b fl(\))12 b fj(j)g fk(r)q (ef)18 b fj(2)12 b fk(r)q(ef)5 b(er)q(encesT)h(o)p fl(\()p fk(X)t fl(\))p fj (g)151 527 y fl(\(ie)16 b(the)f(set)g(of)g(classes)h(con)o(taining)f(referenc\ es)h(to)f(class)g(X.\))93 619 y(7.)22 b(\(set)15 b(of)g(class\))g(classesRefe\ rencing\(\(function)j(+)d(v)m(ariable\))h(X\))f fj(\021)226 676 y fl(classesI\ n)o(ternallyReferenci)q(ng\(X\))i fj([)f fl(classesPublicallyR)q(eferenci)q (ng\(X\).)151 732 y(\(ie)g(the)f(set)g(of)g(classes)h(con)o(taining)f(referen\ ces)h(to)f(X.\))93 825 y(8.)22 b(function)16 b(collidingF)l(uncti)q(on)i(\(cl\ ass)d(C,)g(function)h(F\))e fj(\021)226 881 y fl(returns)h(the)g(function)i (whose)e(name)g(w)o(ould)g(collide)j(with)d(F)g(if)h(it)f(w)o(ere)g(added)h (to)f(C.)93 973 y(9.)22 b(\(nil)16 b(+)g(class\))f(con)o(tainingClass\()226 1030 y(\(v)m(ariable)h(+)g(function)g(+)f(\(set)g(of)g(statemen)o(t\))f(+)h (expression\))h(con)o(tainedItem\))g fj(\021)301 1086 y fl(if)g(\(\(con)o(tai\ nedItem.o)o(wner)e fj(2)i fl(Program.classes\))d fj(_)376 1143 y fl(\(con)o (tainedItem.o)o(wner)i(=)g(nil\)\),)h(/*)f(global)h(function)g(*/)451 1199 y (con)o(tainedItem.o)o(wner,)301 1256 y(else)g(con)o(tainedClass\(con)o(tained\ Item.o)o(wner\).)70 1348 y(10.)22 b(\(nil)16 b(+)g(function\))g(con)o(taining\ F)l(unction\()226 1405 y(\(\(set)e(of)h(statemen)o(t\))f(+)i(expression\))f (con)o(tainedItem\))h fj(\021)301 1461 y fl(if)g(\(\(con)o(tainedItem.o)o(wne\ r)e fj(2)i fl(allF)l(unctions\(Program\)\),)376 1518 y(con)o(tainedItem.o)o (wner,)301 1574 y(else)g(con)o(tainingF)l(unction\(con)o(tainedItem.o)o(wner\ \).)70 1667 y(11.)22 b(\(set)15 b(of)g(class\))g(directSub)q(classesOf\(class) j(C\))c fj(\021)524 1765 y(f)p fk(subC)s(l)q(ass)e fj(2)h fk(P)q(:cl)q(asses) g fj(j)f fk(subC)s(l)q(ass:super)q(cl)q(ass)g fl(=)h fk(C)s fj(g)70 1881 y fl (12.)22 b(directSup)q(erclassOf\(class)c(C\))c fj(\021)i fl(C.sup)q(erclass) 70 1973 y(13.)22 b(\(set)15 b(of)g(v)m(ariable\))h(expressionsAssignedT)l(o\(\ v)m(ariable)i(V\))d fj(\021)226 2030 y fl(\()p fj(8)g fl(assignmen)o(t)g(expr\ ession)h fj(2)g fl(scop)q(eOf\(V\),)301 2086 y(where)g(destination)g(=)f(V,)g (return)g(source\))g fj([)226 2143 y fl(\()p fj(8)g fl(function)h(call)h fj (2)e fl(scop)q(eOf\(V\),)301 2199 y(if)h(V)f(is)h(an)f(argumen)o(t)f(v)m(aria\ ble)j(of)e(that)f(function,)376 2256 y(return)h(corresp)q(onding)h(v)m(alue)h (passed)e(as)g(a)g(parameter\).)70 2348 y(14.)22 b(\(set)15 b(of)g(expression\ \))g(expressionsAssignedT)l(oArgumen)o(t\(v)m(ariable)j(argV)l(ar\))226 2405 y fj(8)e fl(functionCall)g fj(2)g fl(callsT)l(o\(argV)l(ar.o)o(wner\),)301 2461 y(return)f(the)h(expression)g(in)g(the)f(p)q(osition)h(corresp)q(onding)g(to) f(the)g(argumen)o(t.)70 2554 y(15.)22 b(\(set)15 b(of)g(function\))g(function\ sCalledBy\(function)j(F\))d fj(\021)226 2610 y fl(the)g(set)g(of)g(all)h(func\ tion)g(calls)h(in)f(F.statemen)o(t.)952 2760 y(35)g eop bop 70 42 a fl(16.)22 b(\(set)15 b(of)g(function\))g(functionsThatOv)o(erride)i(\(function)e(F\))g fj(\021)176 128 y(f)p fk(F)6 b fl(2)12 b fj(2)h fk(al)q(l)q(F)6 b(unctions)p fl(\()p fk(P)g fl(\))13 b fj(j)f fk(F)6 b fl(2)p fk(:ow)q(ner)14 b fj(2)f fk (subcl)q(assesO)q(f)5 b fl(\()p fk(F)q(:ow)q(ner)q fl(\))k fj(^)i fk(F)q(:nam\ e)i fl(=)g fk(F)6 b fl(2)p fk(:name)p fj(g)70 230 y fl(17.)22 b(\(set)15 b (of)g(\(v)m(ariable)h(+)f(function\)\))h(inheritedMem)o(b)q(ers\(class)h(C\)) d fj(\021)226 287 y fl(inheritedMem)o(b)q(erF)l(unctions\(C\))j fj([)f fl(inh\ eritedMem)o(b)q(erV)l(ariables\(C\).)70 375 y(18.)22 b(\(set)15 b(of)g(functi\ on\))g(inheritedMem)o(b)q(erF)l(unctions\(class)j(C\))d fj(\021)226 432 y fl (if)h(C.sup)q(erclass=nil,)h(return)e(nil)226 488 y(else)h(return)f(F)g fj (2)301 544 y fl(\(inheritedMem)o(b)q(erF)l(unctions\(C.sup)q(erclass\))j fj ([)301 601 y fl(C.sup)q(erclass.lo)q(callyDe\014nedMem)o(b)q(erF)l(unc)q(tion\ s\),)226 657 y(where)e(\(F.accessCon)o(trolMo)q(de)d fj(6)p fl(=)j(priv)m(ate\ \))f fj(^)h(\030)p fl(lo)q(calMem)o(b)q(erF)l(unctionNamed\(F,C\).)70 746 y (19.)22 b(\(set)15 b(of)g(v)m(ariable\))h(inheritedMem)o(b)q(erV)l(ariables\(\ class)i(C\))d fj(\021)226 802 y fl(if)h(C.sup)q(erclass=nil,)h(return)e(nil) 226 859 y(else)h(return)f(V)h fj(2)301 915 y fl(\(inheritedMem)o(b)q(erV)l (ariables\(C.sup)q(ercl)q(ass\))h fj([)301 972 y fl(C.sup)q(erclass.lo)q(call\ yDe\014nedMem)o(b)q(erV)l(ariabl)q(es\),)226 1028 y(where)f(\(V.accessCon)o (trolMo)q(de)e fj(6)p fl(=)h(priv)m(ate\))h fj(^)f(\030)p fl(lo)q(calMem)o (b)q(erV)l(ariableNamed\(V,C\).)70 1117 y(20.)22 b(\(set)15 b(of)g(\(function) g(+)h(v)m(ariable\)\))g(lo)q(callyDe\014nedMem)o(b)q(ersOf\(class)i(C\))c fj (\021)226 1173 y fl(\(C.lo)q(callyDe\014nedMem)o(b)q(erF)l(unctions)k fj([) 301 1230 y fl(C.lo)q(callyDe\014nedMem)o(b)q(erV)l(ariable)q(s\))70 1318 y (21.)k(\(set)15 b(of)g(v)m(ariable\))h(lo)q(calV)l(ariablesIn\(function)j(F\)) 14 b fj(\021)226 1375 y fl(the)h(set)g(of)g(all)h(lo)q(cal)h(v)m(ariables)f (in)g(F.statemen)o(t.)70 1463 y(22.)22 b(\(function)16 b(+)f(nil\))i(mem)o (b)q(erF)l(unctionNamed\(class)f(C,)f(string)g(S\))g fj(\021)226 1520 y fl (F,)g(where)g(F)g fj(2)g fl(\(inheritedMem)o(b)q(erF)l(unctions\(C\))i fj([)e fl(C.lo)q(callyDe\014nedMem)o(b)q(erF)l(unctions\))301 1576 y fj(^)h fl(F.nam\ e)e(=)i(S.)70 1665 y(23.)22 b(\(function)16 b(+)f(nil\))i(mem)o(b)q(erV)l(ari\ ableNamed\(class)g(C,)d(string)h(S\))g fj(\021)226 1721 y fl(V,)g(where)g(V)h fj(2)f fl(\(inheritedMem)o(b)q(erV)l(ariables\(C\))i fj([)f fl(C.lo)q(callyDe\ \014nedMem)o(b)q(erV)l(ariables\))301 1778 y fj(^)g fl(V.name)f(=)g(S.)70 1866 y(24.)22 b(\(set)15 b(of\(v)m(ariable)h(+)f(function\)\))h(mem)o(b)q(ersOf\(c\ lass)f(C\))g fj(\021)226 1923 y fl(inheritedMem)o(b)q(erF)l(unctions\(C\))i fj ([)f fl(inheritedMem)o(b)q(erV)l(ariables\(C\))h fj([)301 1979 y fl(C.lo)q (callyDe\014nedMem)o(b)q(erF)l(unctions)h fj([)e fl(C.lo)q(callyDe\014nedMem) o(b)q(erV)l(ariables.)70 2068 y(25.)22 b(\(set)15 b(of)g(\(expression)g(+)h (v)m(ariable\)\))g(referencesT)l(o\(class)f(C\))g fj(\021)226 2124 y fl(insta\ ncesOf\(C\))h fj([)508 2210 y(f)p fk(V)22 b fj(j)12 b fl(\()p fk(V)22 b fj (2)13 b fk(al)q(l)q(V)c(ar)q(iabl)q(es)p fl(\()p fk(P)d(r)q(og)r(r)q(am)p fl (\)\))h fj(^)k fl(\()p fk(V)s(:cl)q(ass)f fl(=)j fk(C)s fl(\))p fj(g)70 2313 y fl(26.)22 b(\(set)15 b(of)g(functionCall\))h(referencesT)l(o\(function)g(F\)) f fj(\021)226 2369 y fl(callsT)l(o\(F\))70 2458 y(27.)22 b(\(set)15 b(of)g (v)m(ariableRef)t(\))h(referencesT)l(o\(v)m(ariable)h(V\))e fj(\021)479 2503 y fa([)283 2598 y fr(V)8 b fs(2)p fq(2)p fr(allV)e(ar)q(iables)p fs(\()p fr(P)f (r)q(og)q(r)q(am)p fs(\))721 2544 y fj(f)p fk(V)k(R)j fj(j)h fk(V)c(R)k fj (2)g fk(F)6 b fl(2)p fk(:statement)12 b fj(^)e fk(V)g(R:r)q(ef)5 b(dV)k(ar)q (iabl)q(e)i fl(=)i fk(V)c fj(g)952 2760 y fl(36)g eop bop 70 42 a fl(28.)22 b (\(statemen)o(t)14 b(+)h(function)h(+)g(class)g(+)f(program\))f(scop)q(eOf\(\ \(v)m(ariable)j(+)e(function\))h(item1\))f fj(\021)226 98 y fl(if)h(item1.o)o (wner)e fj(62)i fl(Program.classes,)d(/*)i(Global,)g(lo)q(cal)i(or)d(argumen) o(t)h(v)m(ariable)h(*/)301 154 y(item1.o)o(wner,)226 211 y(else)g(if)g(item1.\ accessCon)o(trolMo)q(de)e(=)i(priv)m(ate,)301 267 y(item1.o)o(wner,)226 324 y (else)g(\(item1.o)o(wner)e fj([)i fl(sub)q(classesOf\(item1.o)o(wner\)\).)70 416 y(29.)22 b(\(set)15 b(of)g(v)m(ariable\))h(setOfComp)q(onen)o(tV)l(ariabl\ es\(class)g(C\))f fj(\021)516 472 y fa([)355 564 y fr(class)p fq(2)p fr(P)5 b (r)q(og)q(r)q(am:classes)723 513 y fj(f)p fk(V)22 b fj(j)12 b fk(V)22 b fj (2)13 b fk(cl)q(ass:S)s(etO)q(f)5 b(C)s(omponents)11 b fj(^)f fk(V)s(:ty)r (pe)i fl(=)h fk(C)s fj(g)70 671 y fl(30.)22 b(\(set)15 b(of)g(class\))g(sub)q (classesOf\(class)i(C\))d fj(\021)226 728 y fl(the)h(transitiv)o(e)h(closure) g(of)e(directSub)q(classesOf\(C\).)70 820 y(31.)22 b(\(set)15 b(of)g(class\)) g(sup)q(erclassesOf\(class)i(C\))d fj(\021)226 876 y fl(the)h(transitiv)o(e)h (closure)g(of)e(directSup)q(erclassOf\(C\).)70 968 y(32.)22 b(\(set)15 b(of)g (v)m(ariable\))h(v)m(ariablesAssigned\(function)i(F\))c fj(\021)226 1025 y fl (\()p fj(8)h fl(assignmen)o(t)g(expression)h fj(2)g fl(scop)q(eOf\(F\),)301 1081 y(where)g(source)f(=)g(a)g(call)i(to)d(F,)h(return)g(destination\))g fj ([)226 1138 y fl(\()p fj(8)g fl(function)h(call)h fj(2)e fl(scop)q(eOf\(V\),) 301 1194 y(if)h(a)f(call)h(to)f(F)f(is)i(passed)g(as)e(a)h(parameter,)376 1251 y(return)g(corresp)q(onding)h(function)g(argumen)o(t)f(v)m(ariable\).)70 1343 y(33.)22 b(\(set)15 b(of)g(v)m(ariable\))h(v)m(ariablesAssigned\(v)m(ariable) i(V\))d fj(\021)226 1399 y fl(\()p fj(8)g fl(assignmen)o(t)g(expression)h fj (2)g fl(scop)q(eOf\(V\),)301 1456 y(where)g(source)f(=)g(V,)g(return)g(destin\ ation\))h fj([)226 1512 y fl(\()p fj(8)f fl(function)h(call)h fj(2)e fl(scop) q(eOf\(V\),)301 1568 y(if)h(V)f(is)h(passed)f(as)g(a)g(parameter,)376 1625 y (return)g(corresp)q(onding)h(function)g(argumen)o(t)f(v)m(ariable\).)70 1717 y (34.)22 b(\(set)15 b(of)g(v)m(ariable\))h(v)m(ariablesAssigned\(dynamicOb)s (jectExpressi)q(on)i(E\))c fj(\021)226 1773 y fl(\()p fj(8)h fl(assignmen)o (t)g(expression)h fj(2)g fl(Program,)301 1830 y(where)g(source)f(=)g(E,)g(ret\ urn)g(destination\))h fj([)226 1886 y fl(\()p fj(8)f fl(function)h(call)h fj (2)e fl(Program,)301 1943 y(if)h(E)f(is)h(passed)f(as)g(a)g(parameter,)376 1999 y(return)g(corresp)q(onding)h(function)g(argumen)o(t)f(v)m(ariable\).)70 2091 y(35.)22 b(\(set)15 b(of)g(v)m(ariable\))h(v)m(ariablesReferencedBy\(fun\ cti)q(on)i(F\))c fj(\021)761 2188 y(f)p fk(V)9 b(R:r)q(ef)c(dV)k(ar)14 b fj (j)e fl(\()p fk(V)d(R)k fj(2)g fk(F)6 b fl(\))p fj(g)37 2330 y fd(4.4)70 b (Summary)37 2432 y fl(In)o(tuitiv)o(ely)l(,)18 b(refactorings)d(should)h(pres\ erv)o(e)f(the)h(b)q(eha)o(vior)g(of)f(a)g(program.)k(This)d(c)o(hapter)g(disc\ usses)g(the)37 2488 y(program)21 b(prop)q(erties)h(that)e(w)o(ere)h(found)h (to)e(b)q(e)i(easily)g(violated)g(in)g(refactoring.)38 b(Also)21 b(de\014ned) i(here)37 2545 y(are)17 b(the)g(domains)g(of)g(the)g(argumen)o(ts)f(to)g(the) h(refactorings,)f(and)i(the)f(functions)g(used)h(for)e(de\014ning)i(the)37 2601 y(preconditions)f(of)e(the)g(refactorings.)952 2760 y(37)g eop bop 37 353 a fc(Chapter)35 b(5)37 560 y fb(Lo)m(w-Lev)m(el)42 b(Refactorings)37 783 y fl (This)16 b(c)o(hapter)f(de\014nes)h(t)o(w)o(en)o(t)o(y)d(six)j(lo)o(w-lev)o (el)g(refactorings.)j(They)c(supp)q(ort)g(the)g(three)g(high-lev)o(el)j(refac\ -)37 839 y(torings,)e(describ)q(ed)h(in)g(c)o(hapters)e(six)i(through)e(eigh) o(t.)22 b(These)16 b(refactorings)f(are)h(designed)h(to)e(b)q(e)h(simple,)37 896 y(so)j(that)g(in)h(most)f(cases)g(it)g(is)h(trivial)g(to)f(sho)o(w)g(that) f(they)i(are)f(b)q(eha)o(vior-preserving.)33 b(The)20 b(b)q(eha)o(vior-)37 952 y(preserving)c(nature)g(of)e(the)i(high-lev)o(el)h(refactorings)e(is)h(argued) f(in)h(terms)e(of)h(these)g(refactorings.)108 1009 y(F)l(or)21 b(completeness\ ,)j(the)d(de\014nition)i(of)f(eac)o(h)f(refactoring)g(details)i(its)e(precond\ itions)i(and)f(argues)37 1065 y(that)16 b(it)h(is)f(b)q(eha)o(vior)h(preservi\ ng.)24 b(This)17 b(information,)f(included)j(for)c(completeness)j(at)d(the)i (end)g(of)e(eac)o(h)37 1122 y(refactoring,)i(pro)o(vides)g(a)f(lev)o(el)i(of) e(detail)i(b)q(ey)o(ond)f(what)f(ma)o(y)g(b)q(e)h(of)g(in)o(terest)f(to)g(som\ e)h(readers.)24 b(It)16 b(can)37 1178 y(b)q(e)g(skipp)q(ed)h(without)e(missin\ g)i(the)e(in)o(ten)o(t)g(of)g(the)g(refactoring.)37 1310 y(The)h(refactorings) f(de\014ned)h(in)g(this)g(c)o(hapter)f(are:)93 1403 y(1.)22 b(Creating)15 b (a)g(Program)f(En)o(tit)o(y:)170 1497 y(\(a\))22 b fi(cr)n(e)n(ate)s 14 2 v 13 w(empty)s 14 2 v 15 w(class)168 1570 y fl(\(b\))g fi(cr)n(e)n(ate)s 14 2 v 13 w(memb)n(er)s 14 2 v 14 w(variable)173 1643 y fl(\(c\))g fi(cr)n(e)n(ate)s 14 2 v 13 w(memb)n(er)s 14 2 v 14 w(function.)93 1737 y fl(2.)g(Deleting)16 b (a)f(program)f(en)o(tit)o(y:)170 1831 y(\(a\))22 b fi(delete)s 14 2 v 14 w (unr)n(efer)n(enc)n(e)n(d)s 14 2 v 12 w(class)168 1904 y fl(\(b\))g fi(delete) s 14 2 v 14 w(unr)n(efer)n(enc)n(e)n(d)s 14 2 v 12 w(variable)173 1977 y fl (\(c\))g fi(delete)s 14 2 v 14 w(memb)n(er)s 14 2 v 13 w(functions)93 2071 y fl(3.)g(Changing)16 b(a)f(program)f(en)o(tit)o(y:)170 2165 y(\(a\))22 b fi (change)s 14 2 v 14 w(class)s 14 2 v 12 w(name)168 2238 y fl(\(b\))g fi(chang\ e)s 14 2 v 14 w(variable)s 14 2 v 13 w(name)173 2311 y fl(\(c\))g fi(change)s 14 2 v 14 w(memb)n(er)s 14 2 v 13 w(function)s 14 2 v 14 w(name)168 2384 y fl (\(d\))g fi(change)s 14 2 v 14 w(typ)n(e)173 2457 y fl(\(e\))g fi(change)s 14 2 v 14 w(ac)n(c)n(ess)s 14 2 v 12 w(c)n(ontr)n(ol)s 14 2 v 13 w(mo)n(de)176 2530 y fl(\(f)t(\))f fi(add)s 14 2 v 15 w(function)s 14 2 v 13 w(ar)n(gument) 170 2603 y fl(\(g\))h fi(delete)s 14 2 v 14 w(function)s 14 2 v 13 w(ar)n(gum\ ent)952 2760 y fl(38)g eop bop 168 42 a fl(\(h\))22 b fi(r)n(e)n(or)n(der)s 14 2 v 14 w(function)s 14 2 v 13 w(ar)n(guments)180 115 y fl(\(i\))h fi(add)s 14 2 v 15 w(function)s 14 2 v 13 w(b)n(o)n(dy)179 188 y fl(\(j\))f fi(delete)s 14 2 v 14 w(function)s 14 2 v 13 w(b)n(o)n(dy)169 261 y fl(\(k\))g fi(c)n(onvert) s 14 2 v 13 w(instanc)n(e)s 14 2 v 13 w(variable)s 14 2 v 13 w(to)s 14 2 v 14 w(p)n(ointer.)180 334 y fl(\(l\))h fi(c)n(onvert)s 14 2 v 13 w(variable)s 14 2 v 14 w(r)n(efer)n(enc)n(es)s 14 2 v 12 w(to)s 14 2 v 14 w(function)s 14 2 v 13 w(c)n(al)r(ls)155 407 y fl(\(m\))f fi(r)n(eplac)n(e)s 14 2 v 13 w(statement)s 14 2 v 14 w(list)s 14 2 v 13 w(with)s 14 2 v 14 w(function)s 14 2 v 13 w(c)n (al)r(l)168 480 y fl(\(n\))g fi(inline)s 14 2 v 12 w(function)s 14 2 v 14 w (c)n(al)r(l)170 553 y fl(\(o\))g fi(change)s 14 2 v 14 w(sup)n(er)n(class)93 647 y fl(4.)g(Mo)o(ving)15 b(a)g(mem)o(b)q(er)g(v)m(ariable:)170 741 y(\(a\)) 22 b fi(move)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)s 14 2 v 13 w(to) s 14 2 v 14 w(sup)n(er)n(class)168 814 y fl(\(b\))g fi(move)s 14 2 v 14 w(mem\ b)n(er)s 14 2 v 14 w(variable)s 14 2 v 13 w(to)s 14 2 v 14 w(sub)n(classes)93 907 y fl(5.)g(In)o(termediate)16 b(lev)o(el)g(\(comp)q(osite\))f(refactorings\ :)170 1001 y(\(a\))22 b fi(abstr)n(act)s 14 2 v 14 w(ac)n(c)n(ess)s 14 2 v 12 w(to)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)168 1074 y fl(\(b\))g fi (c)n(onvert)s 14 2 v 13 w(c)n(o)n(de)s 14 2 v 14 w(se)n(gment)s 14 2 v 12 w (to)s 14 2 v 14 w(function)173 1147 y fl(\(c\))g fi(move)s 14 2 v 14 w(class) 37 1291 y fd(5.1)70 b(Creating)22 b(a)i(Program)g(En)n(tit)n(y)37 1392 y fl (These)d(refactorings)f(create)g(a)g(new)g(class)h(or)f(a)g(new)g(class)h(mem) o(b)q(er.)35 b(Eac)o(h)20 b(refactoring)g(is)h(b)q(eha)o(vior)37 1449 y(prese\ rving)16 b(b)q(ecause)g(the)f(en)o(tit)o(y)g(\(class)g(or)f(class)h(mem)o(b)q (er\))g(it)g(adds)g(either)h(is)f(unreferenced)h(or)f(replaces)37 1505 y(an)h (iden)o(tically)h(de\014ned,)g(inherited)g(mem)o(b)q(er.)37 1599 y fh(A.)22 b fi(cr)n(e)n(ate)s 14 2 v 14 w(empty)s 14 2 v 14 w(class)151 1674 y fl(De\014n\ e)e(a)e(new)h(class,)h(with)f(no)g(lo)q(cally)h(de\014ned)g(mem)o(b)q(ers.)31 b(If)19 b(a)g(sup)q(erclass)h(is)f(sp)q(eci\014ed)i(as)e(an)151 1730 y(argume\ n)o(t,)14 b(the)h(new)h(class)f(b)q(ecomes)h(its)g(direct)g(sub)q(class.)151 1805 y(Argumen)o(ts:)k(string)15 b(newClassName,)g(\(optional\))g(class)g(sup) q(erclass.)151 1881 y(Preconditions:)193 1974 y(1.)22 b fj(8)16 b fl(class)f fj(2)h fl(Program.classes,)326 2031 y(class.name)f fj(6)p fl(=)h(newClassName\ .)251 2087 y(\(the)f(name)g(do)q(es)h(not)f(clash)h(with)f(an)g(already)h(exi\ sting)g(class\))151 2181 y(The)e(argumen)o(ts)g(to)f(the)h(refactoring)g(sp)q (ecify)i(that)d(the)h(new)h(class)f(will)i(ha)o(v)o(e)e(0)f(or)h(1)g(direct)h (sup)q(er-)151 2238 y(class,)f(satisfying)h(the)f(unique)i(sup)q(erclass)f (prop)q(ert)o(y)f(\(prop)q(ert)o(y)f(one\).)20 b(The)14 b(precondition)i(ensu\ res)151 2294 y(distinct)h(class)e(names)g(\(prop)q(ert)o(y)g(t)o(w)o(o\).)j (Other)d(program)f(prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)151 2369 y (When)i(a)f(new)h(class)g(is)g(created,)g(there)g(are)f(no)g(instances)i(of)e (it,)h(nor)f(are)g(there)h(an)o(y)f(sub)q(classes)151 2426 y(that)f(inherit)i (from)d(it.)27 b(Therefore,)17 b(the)h(b)q(eha)o(vior)g(of)f(the)g(program)f (do)q(es)i(not)f(c)o(hange)g(when)h(the)151 2482 y(new)e(class)f(is)h(added.) 952 2760 y(39)g eop bop 37 42 a fh(B.)23 b fi(cr)n(e)n(ate)s 14 2 v 13 w(memb) n(er)s 14 2 v 14 w(variable)151 117 y fl(Add)16 b(an)f(unreferenced)i(lo)q (cally)g(de\014ned)f(mem)o(b)q(er)g(v)m(ariable)g(to)f(a)g(class.)151 192 y (Argumen)o(ts:)20 b(v)m(ariable)c(V,)f(class)h(C.)151 267 y(Preconditions:) 193 361 y(1.)22 b fj(\030)p fl(v)m(arNameCollisionP\(V.name,)17 b(C\))251 417 y(\(the)j(name)g(of)g(the)g(new)h(v)m(ariable)g(do)q(es)g(not)e(clash)i(with) g(an)f(existing)h(mem)o(b)q(er)f(or)g(global)251 474 y(v)m(ariable\).)151 567 y(The)g(precondition)h(ensures)f(that)f(the)g(new)h(v)m(ariable)h(do)q(esn't) e(collide)j(with)e(existing)h(v)m(ariables,)151 624 y(satisfying)g(program)f (prop)q(erties)i(three)f(\(distinct)h(mem)o(b)q(er)f(names\),)g(four)g(\(inhe\ rited)h(Mem)o(b)q(er)151 680 y(V)l(ariables)14 b(Not)e(Rede\014ned\))j(and)e (eigh)o(t)g(\(seman)o(tically)h(Equiv)m(alen)o(t)g(References)g(and)f(Op)q (erations\).)151 737 y(Other)j(program)e(prop)q(erties)i(trivially)g(preserv) o(ed.)151 812 y(Adding)g(a)f(new,)g(unreferenced)i(v)m(ariable)g(do)q(es)e (not)g(c)o(hange)g(the)h(b)q(eha)o(vior)f(of)g(a)g(program.)1761 795 y fs(1) 37 906 y fh(C.)22 b fi(cr)n(e)n(ate)s 14 2 v 14 w(memb)n(er)s 14 2 v 13 w(fun\ ction.)151 981 y fl(Add)13 b(a)g(lo)q(cally)h(de\014ned)g(mem)o(b)q(er)f(func\ tion)g(to)f(a)h(class)g(that)f(either)h(is)g(unreferenced)h(or)e(is)i(iden)o (tical)151 1037 y(to)h(an)g(already)g(inherited)i(function.)151 1112 y(Argume\ n)o(ts:)j(function)c(F,)e(class)i(C.)151 1188 y(Preconditions:)193 1281 y(1.) 22 b fj(8)16 b fl(mem)o(b)q(erF)l(unction)g fj(2)f fl(C.lo)q(callyDe\014nedMe\ m)o(b)q(erF)l(unctions,)326 1338 y(mem)o(b)q(erF)l(unction.name)h fj(6)p fl (=)g(F.name.)251 1394 y(\(the)f(function)h(is)g(not)f(already)g(de\014ned)i (lo)q(cally\))193 1467 y(2.)22 b fj(8)16 b fl(F2)e fj(2)i fl(inheritedMem)o (b)q(erF)l(unctions\(C\),)326 1524 y(\(F2.name)e(=)i(F.name\))e fj(\))401 1580 y fl(matc)o(hingSignatureP)i(\(F,)e(F2\).)251 1637 y(\(the)h(signature)g(matc) o(hes)g(that)g(of)f(an)o(y)h(inherited)i(function)f(with)g(the)f(same)g(name\ \))193 1710 y(3.)22 b fj(8)16 b fl(F3)e fj(2)i fl(functionsThatOv)o(erride\(F\ \),)326 1766 y(matc)o(hingSignatureP\(F,)f(F3\).)251 1823 y(\(the)g(signature\ s)g(of)g(corresp)q(onding)h(functions)g(in)g(sub)q(classes)h(matc)o(h)d(it\)) 193 1896 y(4.)22 b fj(8)16 b fl(F2)e fj(2)i fl(inheritedMem)o(b)q(erF)l(uncti\ ons\(C\),)326 1952 y(\(F2.name)e(=)i(F.name\))e fj(\))401 2009 y fl(\()p fj (8)h fl(class)h fj(2)f fl(C)g fj([)h fl(sub)q(classesOf\(C\),)476 2065 y(unre\ fdOnInstancesP\(F2,)g(class\)\))f fj(_)401 2122 y fl(\(seman)o(ticallyEquiv)m (alan)o(tP)i(F,)e(F2\).)251 2178 y(\(if)21 b(there)h(is)f(an)g(inherited)i (function)f(with)g(the)f(same)g(name,)h(either)g(the)f(inherited)i(func-)251 2235 y(tion)c(is)g(unreferenced)h(on)e(instances)i(of)e(C)g(\(and)h(its)f(sub) q(classes\),)i(or)e(the)h(new)g(function)g(is)251 2291 y(seman)o(tically)d (equiv)m(alen)o(t)h(to)e(the)g(function)h(it)g(replaces\))193 2364 y(5.)22 b (compilesP\(F,)16 b(C\).)251 2421 y(\(F)f(will)h(compile)h(as)e(a)g(mem)o(b)q (er)g(of)g(C.\))37 2504 y 750 2 v 89 2531 a fu(1)107 2547 y fp(This)f(refacto\ ring)g(increases)h(the)e(ph)o(ysical)j(size)e(of)f(instances)i(of)e(the)h(cla\ ss.)19 b(Programs)14 b(that)f(test)g(the)h(ph)o(ysical)i(size)e(of)37 2593 y (ob)r(jects)g(could)g(see)f(their)h(b)q(eha)o(vior)h(c)o(hange)f(\(see)f(the) g(discussion)j(in)e(section)g(4.1.2\).)952 2760 y fl(40)g eop bop 151 42 a fl (Precondition)17 b(one)f(ensures)g(that)f(mem)o(b)q(er)g(names)h(are)f(distin\ ct)i(\(prop)q(ert)o(y)e(one\).)20 b(Preconditions)151 98 y(t)o(w)o(o)g(and)h (three)g(ensure)h(that)f(the)g(mem)o(b)q(er)g(function)h(has)f(a)g(signature) g(iden)o(tical)i(to)e(an)o(y)g(cor-)151 154 y(resp)q(onding)h(sup)q(erclass)f (or)f(sub)q(class)i(function.)37 b(By)20 b(precondition)i(four,)f(if)g(the)g (new)g(function)151 211 y(collides)g(with)e(an)f(existing)i(function,)f(its)g (function)g(b)q(o)q(dy)g(m)o(ust)f(matc)o(h)g(the)h(b)q(o)q(dy)g(of)f(the)h (func-)151 267 y(tion)d(it)h(is)f(replacing,)i(ensuring)f(seman)o(tically)g (consisten)o(t)f(references)h(and)f(op)q(erations)g(\(prop)q(ert)o(y)151 324 y (sev)o(en\).)k(Other)15 b(program)f(prop)q(erties)i(are)f(trivially)i(preserv) o(ed.)151 396 y(The)12 b(b)q(eha)o(vior)g(of)g(a)f(class)h(is)h(not)e(c)o(han\ ged)h(when)g(a)g(function)g(is)h(added)f(that)f(either)i(is)f(unreferenced) 151 453 y(or)j(replaces)h(an)f(iden)o(tically)j(de\014ned,)e(inherited)h(func\ tion.)1198 436 y fs(2)37 594 y fd(5.2)70 b(Deleting)20 b(a)k(Program)g(En)n (tit)n(y)37 695 y fl(These)c(refactorings)f(delete)h(an)f(unreferenced)h(clas\ s)g(or)e(delete)j(an)e(unreferenced)h(or)f(redundan)o(t)g(class)37 752 y(mem) o(b)q(er.)j(Eac)o(h)15 b(refactoring)g(is)h(b)q(eha)o(vior)g(preserving)h(b)q (ecause)f(the)g(en)o(tit)o(y)f(\(class)h(or)f(class)h(mem)o(b)q(er\))f(it)37 808 y(deletes)20 b(is)g(either)f(unreferenced)h(or)f(redundan)o(t.)31 b(A)19 b (mem)o(b)q(er)g(function)g(is)g(redundan)o(t)h(if)f(an)g(iden)o(tical)37 865 y (mem)o(b)q(er)d(function)g(w)o(ould)f(b)q(e)h(inherited)h(from)e(a)g(sup)q (erclass)h(if)g(it)f(w)o(ere)g(deleted.)37 954 y fh(A.)22 b fi(delete)s 14 2 v 14 w(unr)n(efer)n(enc)n(e)n(d)s 14 2 v 12 w(class)151 1027 y fl(Delete)16 b (an)f(unreferenced)i(class.)151 1099 y(Argumen)o(ts:)j(class)15 b(C.)151 1172 y(Preconditions:)193 1261 y(1.)22 b(referencesT)l(o\(C\))15 b(=)g fj(;)g(^)h fl(sub)q(classesOf\(C\))g(=)f fj(;)p fl(.)251 1317 y(\(the)g(class)h(b)q(eing) g(deleted)h(is)e(unreferenced)i(and)e(has)h(no)f(sub)q(classes\).)151 1406 y (The)j(class)g(b)q(eing)h(deleted)h(from)d(the)g(program)g(is)h(unreferenced;) j(th)o(us,)c(all)i(program)e(prop)q(erties)151 1463 y(are)e(trivially)i(prese\ rv)o(ed.)37 1552 y fh(B.)23 b fi(delete)s 14 2 v 13 w(unr)n(efer)n(enc)n(e)n (d)s 14 2 v 12 w(variable)151 1624 y fl(Delete)16 b(an)f(unreferenced)i(v)m (ariable.)151 1697 y(Argumen)o(ts:)j(v)m(ariable)c(V.)151 1770 y(Precondition\ s:)193 1859 y(1.)22 b(referencesT)l(o\(V\))15 b(=)h fj(;)p fl(.)251 1915 y (\(the)f(v)m(ariable)i(b)q(eing)f(deleted)h(is)e(unreferenced\))151 2004 y (The)k(v)m(ariable)h(b)q(eing)g(deleted)g(from)e(the)h(class)g(is)g(unreferen\ ced;)j(th)o(us,)d(all)g(program)f(prop)q(erties)151 2061 y(are)d(trivially)i (preserv)o(ed.)599 2044 y fs(3)37 2150 y fh(C.)22 b fi(delete)s 14 2 v 14 w (memb)n(er)s 14 2 v 14 w(functions)151 2222 y fl(Delete)16 b(a)f(set)g(of)g (mem)o(b)q(er)g(functions)h(from)e(their)i(class.)151 2295 y(Argumen)o(ts:)k (setOf\(function\))15 b(functionsT)l(oDelete.)151 2368 y(Preconditions:)37 2430 y 750 2 v 89 2457 a fu(2)107 2473 y fp(This)f(refactoring)g(increases)h (the)e(ph)o(ysical)j(size)e(of)f(instances)i(of)e(the)h(class.)19 b(Programs) 14 b(that)f(test)g(the)h(ph)o(ysical)i(size)e(of)37 2519 y(ob)r(jects)g(could) g(see)f(their)h(b)q(eha)o(vior)h(c)o(hange)f(\(see)f(the)g(discussion)j(in)e (section)g(4.1.2\).)89 2548 y fu(3)107 2564 y fp(This)f(refactoring)h(decreas\ es)g(the)f(ph)o(ysical)j(size)e(of)e(instances)j(of)e(the)g(class.)18 b(Progr\ ams)13 b(that)h(test)e(the)h(ph)o(ysical)j(size)e(of)37 2610 y(ob)r(jects)g (could)g(see)f(their)h(b)q(eha)o(vior)h(c)o(hange)f(\(see)f(the)g(discussion) j(in)e(section)g(4.1.2\).)952 2760 y fl(41)g eop bop 193 42 a fl(1.)22 b fj (8)16 b fl(F)e fj(2)i fl(functionsT)l(oDelete:)326 98 y(\()p fj(8)f fl(ref)g fj(2)h fl(referencesT)l(o\(F\):)401 154 y(con)o(tainingF)l(unction\(ref)t(\)) g fj(2)476 211 y fl(functionsT)l(oDelete\))g fj(_)326 267 y(9)g fl(F2)e fj (2)401 324 y fl(\(F.o)o(wner.sup)q(erclass\).lo)q(callyDe\014nedMem)o(b)q(erF) l(unctions)j fj(_)476 380 y fl(inheritedMem)o(b)q(erF)l(unctions\(F.o)o(wner.\ sup)q(erclass\))401 437 y fj(^)f fl(F2.accessCon)o(trolMo)q(de)d fj(6)p fl (=)j(priv)m(ate)401 493 y fj(^)g fl(matc)o(hingA)o(ttributesP\(F,)e(F2\).)251 550 y(\(either)j(eac)o(h)f(function)g(b)q(eing)i(deleted)f(is)f(redundan)o (t,)h(or)e(the)h(only)h(references)f(to)g(it)g(are)g(b)o(y)251 606 y(other)f (functions)h(that)e(are)h(also)g(b)q(eing)i(deleted\))151 700 y(By)23 b(the)h (precondition,)i(eac)o(h)d(function)h(is)g(either)f(redundan)o(t)h(and)f(ther\ efore)g(can)g(b)q(e)h(deleted)151 756 y(without)19 b(c)o(hanging)h(the)f(b)q (eha)o(vior)h(of)e(the)h(program,)g(or)g(is)g(unreferenced)i(after)d(the)h (set)g(of)g(oth-)151 813 y(er)c(functions)g(are)g(deleted.)21 b(This)15 b(pre\ serv)o(es)f(program)g(prop)q(ert)o(y)g(sev)o(en)h(\(seman)o(tically)h(equiv)m (alen)o(t)151 869 y(references)g(and)f(op)q(erations\).)20 b(Other)15 b(progr\ am)g(prop)q(erties)g(are)g(trivially)i(preserv)o(ed.)37 1012 y fd(5.3)70 b (Changing)23 b(a)h(Program)g(En)n(tit)n(y)37 1114 y fl(These)14 b(refactoring\ s)e(c)o(hange)h(the)g(name)g(of)g(a)g(class)g(or)f(c)o(hange)i(the)f(attribut\ es)f(of)h(a)g(class)g(mem)o(b)q(er.)19 b(They)37 1170 y(c)o(hange)i(a)f(class) h(mem)o(b)q(er)g(b)o(y)f(c)o(hanging)h(its)f(name,)i(access)e(con)o(trol)h (mo)q(de)f(or)g(t)o(yp)q(e.)36 b(Other)20 b(c)o(hanges)37 1227 y(include:)25 b (con)o(v)o(erting)16 b(an)h(instance)g(v)m(ariable)h(to)d(a)h(v)m(ariable)i (that)e(p)q(oin)o(ts)g(to)g(an)g(instance,)i(con)o(v)o(erting)e(a)37 1283 y (v)m(ariable)h(reference)f(to)f(a)f(function)i(call,)g(and)g(adding)g(or)e (reordering)i(function)g(argumen)o(ts.)37 1390 y fh(A.)22 b fi(change)s 14 2 v 14 w(class)s 14 2 v 12 w(name)151 1465 y fl(Change)15 b(the)h(name)f(of)g(a)f (class.)151 1540 y(Argumen)o(ts:)20 b(class)15 b(C,)g(string)g(S.)151 1615 y (This)20 b(name)f(c)o(hange)g(is)h(re\015ected)g(throughout)e(the)i(program)e (\(i.e.)32 b(in)20 b(class)f(and)g(sub)q(class)i(dec-)151 1671 y(larations,)d (constructor)e(and)i(destructor)f(functions,)h(and)g(the)f(declarations)h(of) f(instances)h(of)f(the)151 1728 y(class\).)151 1803 y(Preconditions:)193 1897 y(1.)22 b fj(8)16 b fl(class)f fj(2)h fl(Program.classes,)326 1953 y(class.na\ me)f fj(6)p fl(=)h(S.)251 2010 y(\(the)f(new)h(name)f(do)q(esn't)g(clash)h (with)f(an)g(already)h(existing)g(class\))151 2104 y(The)e(precondition)g(ens\ ures)g(distinct)h(class)e(names)h(\(satisfying)f(program)f(prop)q(ert)o(y)h (t)o(w)o(o\).)18 b(Chang-)151 2160 y(ing)d(the)f(name)g(of)f(a)h(class)g(do)q (es)g(not)g(c)o(hange)g(its)g(b)q(eha)o(vior)h(\(satisfying)e(program)g(prop) q(ert)o(y)h(sev)o(en\).)151 2216 y(Other)i(program)e(prop)q(erties)i(are)e (trivially)j(preserv)o(ed.)37 2310 y fh(B.)23 b fi(change)s 14 2 v 13 w(varia\ ble)s 14 2 v 14 w(name)151 2385 y fl(Change)15 b(the)h(name)f(of)g(a)f(v)m (ariable.)151 2461 y(The)d(name)g(c)o(hange)g(is)g(re\015ected)g(throughout)f (its)h(scop)q(e.)19 b(The)11 b(v)m(ariable)h(could)g(b)q(e)g(a)e(global)h(v)m (ariable,)151 2517 y(mem)o(b)q(er)17 b(v)m(ariable,)h(temp)q(orary)d(v)m(aria\ ble)j(or)e(b)q(e)h(an)f(argumen)o(t)g(to)g(a)g(function.)24 b(The)17 b(rules) g(of)f(the)151 2573 y(language)g(determine)g(where)f(a)g(v)m(ariable)i(is)e (visible.)952 2760 y(42)g eop bop 151 42 a fl(Argumen)o(ts:)20 b(v)m(ariable) c(V,)f(string)g(newName.)151 117 y(Preconditions:)193 210 y(1.)22 b fj(\030)p fl(v)m(arNameCollisionP\(newName,)17 b(scop)q(eOf\(V\)\))251 267 y(\(newName) e(do)q(es)h(not)e(clash)i(with)g(an)f(existing)h(mem)o(b)q(er)g(or)e(global)i (v)m(ariable\).)151 361 y(The)k(precondition)h(ensures)f(that)f(the)g(new)h (v)m(ariable)h(do)q(esn't)e(collide)j(with)e(existing)h(v)m(ariables,)151 417 y(satisfying)14 b(program)f(prop)q(erties)h(three)g(\(distinct)g(mem)o(b)q (er)g(names\),)f(four)h(\(v)m(ariable)g(scoping\))g(and)151 474 y(\014v)o(e)h (\(mem)o(b)q(er)h(v)m(ariable)g(rede\014nition\).)21 b(Other)16 b(program)e (prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)151 549 y(The)d(new)f(v)m (ariable)i(name)e(do)q(es)g(not)g(collide)i(with)f(a)f(referenced)h(or)f(inhe\ rited)i(v)m(ariable.)20 b(Changing)151 605 y(the)13 b(name)f(of)g(the)h(v)m (ariable)h(do)q(es)f(not)f(c)o(hange)g(its)h(b)q(eha)o(vior,)g(as)f(long)h (as)f(references)i(to)d(the)i(v)m(ariable)151 662 y(remain)j(the)f(same.)37 756 y fh(C.)22 b fi(change)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(function)s 14 2 v 13 w(name)151 831 y fl(Change)13 b(the)h(name)f(of)g(a)g(mem)o(b)q(er)h (function)g(and)f(an)o(y)g(corresp)q(onding)i(mem)o(b)q(er)e(functions)h(de\ \014ned)151 887 y(in)i(sub)q(classes)h(\(and)e(callers\).)151 962 y(Argumen)o (ts:)20 b(function)c(F,)e(string)h(newName.)151 1037 y(Preconditions:)193 1131 y(1.)22 b fj(8)16 b fl(mem)o(b)q(er)f fj(2)g fl(F.o)o(wner.lo)q(callyDe\014ne\ dMem)o(b)q(erF)l(unctions,)326 1188 y(mem)o(b)q(er.name)g fj(6)p fl(=)h(newNa\ me.)251 1244 y(\(a)f(function)h(with)f(the)h(same)e(name)i(is)f(not)g(already) h(de\014ned)g(lo)q(cally\))193 1317 y(2.)22 b(if)16 b(F.accessCon)o(trolMo)q (de)e fj(6)p fl(=)h(priv)m(ate,)326 1374 y fj(8)h fl(subClass)f fj(2)h fl(sub) q(classesOf\(F.o)o(wner\),)401 1430 y fj(8)g fl(mem)o(b)q(er)f fj(2)g fl(subC\ lass.lo)q(callyDe\014nedMem)o(b)q(erF)l(un)q(ctions,)326 1487 y(mem)o(b)q(er.\ name)g fj(6)p fl(=)h(newName.)251 1543 y(\(if)i(F)g(is)h(not)e(priv)m(ate,)j (a)d(function)i(with)g(same)f(name)g(is)g(not)g(already)g(de\014ned)i(lo)q (cally)g(in)f(a)251 1599 y(sub)q(class\))193 1672 y(3.)j fj(8)16 b fl(F2)e fj (2)i fl(inheritedMem)o(b)q(erF)l(unctions\(con)o(tainingClass\(F\)\),)326 1729 y(\(F2.name)e(=)i(F.name\))e fj(\))401 1785 y fl(matc)o(hingSignatureP)i(\(F,) e(F2\).)251 1842 y(\(the)h(signature)g(matc)o(hes)g(that)g(of)f(an)o(y)h(inhe\ rited)i(function)f(with)g(the)f(same)g(name\))193 1915 y(4.)22 b fj(8)16 b fl (F2)e fj(2)i fl(inheritedMem)o(b)q(erF)l(unctions\(con)o(tainingClass\(F\)\),) 326 1971 y(\(F2.name)e(=)i(F.name\))e fj(\))401 2028 y fl(\()p fj(8)h fl(clas\ s)h fj(2)f fl(con)o(tainingClass\(F\))g fj([)h fl(sub)q(classesOf\(con)o(tain\ ingClass\(F\)\),)476 2084 y(unrefdOnInstancesP\(F2,)g(class\)\))f fj(_)401 2141 y fl(\(seman)o(ticallyEquiv)m(alan)o(tP)i(F,)e(F2\).)251 2197 y(\(if)i (there)f(is)h(an)f(inherited)i(function)g(with)e(the)h(same)f(name,)g(either) h(the)f(inherited)j(function)251 2254 y(is)f(unreferenced)h(on)e(instances)h (of)e(con)o(tainingClass\(F\))i(\(and)f(its)g(sub)q(classes\),)h(or)f(the)g (new)251 2310 y(function)f(is)g(seman)o(tically)g(equiv)m(alen)o(t)h(to)e(the) g(function)h(it)f(replaces\))193 2383 y(5.)22 b fj(8)16 b fl(F2)e fj(2)i fl (inheritedMem)o(b)q(erF)l(unctions\(con)o(tainingClass\(F\)\),)326 2440 y(F2.\ name)e(=)i(F.name)e fj(\))401 2496 y fl(matc)o(hingSignatureP)i(\(F,)e(F2\))g fj(^)401 2553 y fl(\()p fj(8)h fl(ref)g fj(2)h fl(referencesT)l(o\(F2\),)476 2609 y(con)o(tainingClass\(ref)t(\))f(=)g(con)o(tainingClass\(F2\)\))g fj(_) 952 2760 y fl(43)g eop bop 401 42 a fl(\()p fj(8)15 b fl(class)h fj(2)f fl (\(con)o(tainingClass\(F\)\))g fj([)g fl(sub)q(classesOf\(\(con)o(tainingClas\ s\(F\)\)\),)476 98 y(instancesOf\(\(con)o(tainingClass\(F\)\)\))g(=)g fj(;)p fl(\))g fj(_)401 154 y fl(\(seman)o(ticallyEquiv)m(alan)o(tP)i(F,)e(F2\).)251 211 y(\(if)e(there)h(is)f(an)h(inherited)h(mem)o(b)q(er)e(function)h(with)f (the)h(same)f(name,)g(the)g(signatures)g(matc)o(h.)251 267 y(Also,)23 b(eithe\ r)g(the)e(inherited)j(function)e(is)g(unreferenced)h(on)f(instances)g(of)f (the)h(class)g(that)251 324 y(con)o(tains)15 b(F)g(\(or)f(its)h(sub)q(classes\ \),)h(or)e(the)h(renamed)h(function)g(is)f(seman)o(tically)h(equiv)m(alen)o (t)h(to)251 380 y(the)e(function)h(it)g(replaces.\))151 474 y(The)23 b(\014rs\ t)f(three)h(preconditions)h(ensure)f(that)f(mem)o(b)q(er)h(names)f(are)g(dist\ inct)i(\(prop)q(ert)o(y)e(one\).)151 531 y(Precondition)d(three)e(ensures)g (compatible)i(signatures)e(\(prop)q(ert)o(y)f(six;)j(mem)o(b)q(er)e(function) h(redef-)151 587 y(inition\).)39 b(By)21 b(precondition)i(four,)f(if)f(there) g(is)h(an)f(inherited)i(function)f(with)f(the)g(same)g(name,)151 643 y(either) e(the)g(inherited)h(function)f(is)g(unreferenced)h(on)e(instances)h(of)f(con) o(tainingClass\(F\))h(and)f(its)151 700 y(sub)q(classes,)f(or)e(the)g(new)h (function)g(is)g(seman)o(tically)h(equiv)m(alen)o(t)g(to)e(the)h(function)g (it)g(replaces,)g(en-)151 756 y(suring)d(seman)o(tically)g(consisten)o(t)g (references)g(and)f(op)q(erations)h(\(prop)q(ert)o(y)e(sev)o(en\).)19 b(Other) 13 b(program)151 813 y(prop)q(erties)j(are)f(trivially)i(preserv)o(ed.)37 907 y fh(D.)23 b fi(change)s 14 2 v 13 w(typ)n(e)151 982 y fl(Change)14 b(the)g (t)o(yp)q(e)g(of)f(a)h(set)g(of)f(\(p)q(oin)o(ter\))h(v)m(ariables)h(and)f (functions)h(\(i.e.)k(c)o(hange)14 b(the)g(t)o(yp)q(es)g(of)f(the)151 1038 y (v)m(ariables)k(and)e(the)g(return)g(t)o(yp)q(es)h(of)e(the)i(functions\).) 151 1113 y(Argumen)o(ts:)k(setOf\(v)m(ariable\))c(v)m(arsT)l(oChange,)e(setOf\ \(function\))h(functionsT)l(oChange,)526 1170 y(t)o(yp)q(e)g(newT)o(yp)q(e.) 151 1245 y(Preconditions:)193 1339 y(1.)22 b fj(8)16 b fl(V)l(ar)f fj(2)g fl (v)m(arsT)l(oChange,)326 1395 y fj(8)h fl(expression)g fj(2)f fl(expressionsA\ ssignedT)l(o\(v)m(ariableT)l(oChange\):)401 1452 y(subt)o(yp)q(eP\(expression\ .t)o(yp)q(e)h(newT)o(yp)q(e\))g fj(_)401 1508 y fl(expression)g fj(2)g fl(\(v) m(arsT)l(oChange)e fj([)i fl(functionsT)l(oChange\).)251 1565 y(\(eac)o(h)j (assignmen)o(t)h fi(to)f fl(a)g(v)m(ariable)i(w)o(ould)f(remain)g(t)o(yp)q (e)f(safe)g(if)h(its)f(t)o(yp)q(e)h(w)o(as)e(c)o(hanged)i(to)251 1621 y(newT) o(yp)q(e\).)193 1694 y(2.)i fj(8)16 b fl(I)f fj(2)h fl(\(v)m(arsT)l(oChange)e fj([)i fl(functionsT)l(oChange\),)326 1751 y fj(8)g fl(expression)g fj(2)f fl (v)m(ariablesAssigned\(item\):)401 1807 y(subt)o(yp)q(eP\(newT)o(yp)q(e,)h (expression.t)o(yp)q(e\))f fj(_)401 1863 y fl(expression)h fj(2)g fl(v)m(arsT) l(oChange.)251 1920 y(\(eac)o(h)11 b(assignmen)o(t)f fi(of)h fl(item)g(w)o (ould)h(remain)f(t)o(yp)q(e)g(safe)f(if)i(its)f(t)o(yp)q(e)f(w)o(as)g(c)o(han\ ged)h(to)g(newT)o(yp)q(e\).)151 2014 y(Preconditions)18 b(one)g(and)f(t)o(w)o (o)f(ensure)h(t)o(yp)q(e)g(safe)g(assignmen)o(ts)g(\(prop)q(ert)o(y)g(six\).) 25 b(Other)18 b(program)151 2070 y(prop)q(erties)e(are)f(trivially)i(preserv) o(ed.)37 2164 y fh(E.)23 b fi(change)s 14 2 v 14 w(ac)n(c)n(ess)s 14 2 v 12 w (c)n(ontr)n(ol)s 14 2 v 13 w(mo)n(de)151 2239 y fl(Change)15 b(the)h(access)f (con)o(trol)g(mo)q(de)g(of)g(a)g(mem)o(b)q(er)g(v)m(ariable)i(or)e(function.) 151 2314 y(Argumen)o(ts:)20 b(\(v)m(ariable)c(+)f(function\))h(mem)o(b)q(er,) 226 2371 y(\(`priv)m(ate')f(OR)h(`protected')e(OR)i(`public'\))h(newAcMo)q (de.)151 2446 y(Preconditions:)193 2540 y(1.)22 b(if)16 b(\(newAcMo)q(de)f (=)h(priv)m(ate\))f fj(^)h fl(\(mem)o(b)q(er.accessCon)o(trolMo)q(de)e fj(6)p fl(=)i(priv)m(ate\),)326 2596 y(classesIn)o(ternallyReferenci)q(ng\(mem)o(b)q (er\))i(=)d fj(f)p fk(containing)r(C)s(l)q(ass)p fl(\()p fk(member)q fl(\))p fj(g)e(^)952 2760 y fl(44)g eop bop 326 42 a fl(classesPubliclyR)q(eferenci)q (ng\(mem)o(b)q(er\))18 b(=)d fj(;)p fl(.)251 98 y(\(if)h(the)g(new)g(mo)q(de) g(is)g(priv)m(ate,)g(the)g(mem)o(b)q(er)g(is)g(only)g(\(in)o(ternally\))g(ref\ erenced,)h(in)f(the)g(class)251 154 y(where)g(it)f(is)h(de\014ned\))193 225 y (2.)22 b(if)16 b(\(newAcMo)q(de)f fj(6)p fl(=)h(priv)m(ate\))f fj(^)h fl(\(me\ m)o(b)q(er.accessCon)o(trolMo)q(de)e(=)i(priv)m(ate\))255 295 y(\(a\))22 b (if)16 b(mem)o(b)q(er)f(is)h(a)f(v)m(ariable:)411 351 y(\()p fj(8)g fl(sub)q (class)h fj(2)g fl(sub)q(classesOf\(mem)o(b)q(er.o)o(wner\),)486 408 y fj(8)g fl(V)l(ar)f fj(2)g fl(sub)q(class.lo)q(callyDe\014nedMem)o(b)q(e)q(rV)l(ariab\ le)q(s,)561 464 y(V)l(ar.name)g fj(6)p fl(=)g(mem)o(b)q(er.name\).)336 521 y (\(a)22 b(mem)o(b)q(er)g(v)m(ariable)i(to)d(b)q(e)i(declared)h(protected)e (or)f(public)k(m)o(ust)c(not)h(already)h(b)q(e)336 577 y(de\014ned)17 b(in)f (a)f(sub)q(class\))253 641 y(\(b\))22 b(if)16 b(mem)o(b)q(er)f(is)h(a)f(funct\ ion:)365 704 y(i.)23 b fj(8)16 b fl(F2)e fj(2)i fl(inheritedMem)o(b)q(erF)l (unctions\(C\),)488 761 y(\(F2.name)e(=)i(F.name\))e fj(\))563 817 y fl(\()p fj(8)h fl(class)h fj(2)g fl(C)e fj([)i fl(sub)q(classesOf\(C\),)638 873 y(unr\ efdOnInstancesP\(F2,)g(class\)\))f fj(_)563 930 y fl(\(seman)o(ticallyEquiv)m (alan)o(tP)i(F,)e(F2\).)413 986 y(\(if)j(there)g(is)g(an)g(inherited)i(functi\ on)e(with)g(the)g(same)f(name,)h(either)h(the)f(inherited)413 1043 y(function) j(is)f(unreferenced)i(on)e(instances)g(of)g(C)f(\(or)g(its)h(sub)q(classes\),) i(or)d(the)h(new)413 1099 y(function)c(is)g(seman)o(tically)h(equiv)m(alen)o (t)f(to)f(the)g(function)h(it)g(replaces\))353 1163 y(ii.)23 b fj(8)16 b fl (sub)q(class)g fj(2)g fl(sub)q(classesOf\(mem)o(b)q(er.o)o(wner\),)488 1219 y fj(9)g fl(F)f fj(2)g fl(sub)q(class.lo)q(callyDe\014ned)q(Mem)o(b)q(erF)l(unc\ tions)j fj(^)563 1276 y fl(F.name)d(=)g(mem)o(b)q(er.name)g fj(\))638 1332 y fl(matc)o(hingSignatureP\(F,)g(mem)o(b)q(er\).)413 1388 y(\(the)h(signature)f (of)h(the)f(new)h(function)g(matc)o(hes)f(the)h(signatures)g(of)f(functions)h (that)413 1445 y(w)o(ould)g(o)o(v)o(erride)f(it)h(in)g(sub)q(classes\))193 1515 y(3.)22 b(if)16 b(\(newAcMo)q(de)f(=)h(protected\))f fj(^)g fl(\(mem)o (b)q(er.accessCon)o(trolMo)q(de)f(=)i(public\),)326 1572 y(classesPubliclyR)q (eferenci)q(ng\(mem)o(b)q(er\))i(=)d fj(;)p fl(.)251 1628 y(\(a)h(mem)o(b)q (er)g(curren)o(tly)h(declared)g(public)h(but)f(ab)q(out)f(to)f(b)q(e)i(declar\ ed)g(protected)f(m)o(ust)g(only)251 1685 y(b)q(e)g(\(in)o(ternally\))g(refere\ nced,)g(in)g(the)f(class)h(that)e(con)o(tains)h(it)h(or)f(in)h(one)f(of)g(its) g(sub)q(classes\).)151 1776 y(All)h(references)f(to)f(the)g(mem)o(b)q(er)h (b)q(efore)f(the)h(refactoring)f(are)g(either)h(within)g(the)g(mem)o(b)q(er's) f(scop)q(e)151 1832 y(after)i(the)g(refactoring,)g(or)f(\(if)i(a)e(function\)) i(ma)o(y)f(b)q(e)h(replaced)g(b)o(y)f(a)g(reference)h(to)e(a)h(seman)o(ticall\ y)151 1889 y(equiv)m(alen)o(t)j(function,)f(preserving)g(seman)o(tically)h (equiv)m(alen)o(t)g(references)f(and)f(op)q(erations)h(\(prop-)151 1945 y(ert) o(y)d(sev)o(en\).)20 b(Other)15 b(program)f(prop)q(erties)i(are)f(trivially)i (preserv)o(ed.)37 2036 y fh(F.)23 b fi(add)s 14 2 v 14 w(function)s 14 2 v 13 w(ar)n(gument)151 2110 y fl(Add)17 b(a)f(new)h(argumen)o(t)e(to)h(the)g(de\ \014nition)i(of)e(a)g(function)h(in)h(its)e(con)o(taining)h(class)g(\(and)f (to)g(func-)151 2166 y(tions)i(that)f(o)o(v)o(erride)h(it)g(in)g(sub)q(classe\ s\).)29 b(In)18 b(eac)o(h)g(function)g(call,)h(add)f(an)g(argumen)o(t)f(whic) o(h)i(is)f(a)151 2223 y(dynamically)f(created)e(instance)h(of)f(the)g(t)o(yp) q(e)h(of)f(newArg.)151 2297 y(This)e(refactoring)g(is)g(used,)g(for)g(example\ ,)g(when)g(making)g(the)g(signatures)g(of)f(functions)i(in)f(di\013eren)o(t) 151 2353 y(sub)q(classes)k(matc)o(h.)151 2427 y(Argumen)o(ts:)j(function)c (F,)e(v)m(ariable)j(newArg,)d(newArg.t)o(yp)q(e)h(defaultV)l(alue)1503 2410 y fs(4)1525 2427 y fl(.)151 2501 y(Preconditions:)37 2567 y 750 2 v 89 2594 a fu (4)107 2610 y fp(This)e(argumen)o(t)h(can)g(b)q(e)f(omitted)h(if)f(there)g (are)g(no)h(calls)g(to)f(F.)952 2760 y fl(45)g eop bop 193 42 a fl(1.)22 b fj (8)16 b fl(F)l(unc)f fj(2)h fl(\(F)e fj([)i fl(functionsThatOv)o(erride\(F\)\ \),)326 98 y fj(\030)p fl(v)m(arNameCollisionP\(newArg.name)h(con)o(tainingCl\ ass\(F)l(unc\)\).)251 154 y(\(the)e(name)g(of)g(newArg)g(do)q(esn't)g(collide) j(with)d(another)g(v)m(ariable)i(in)f(an)f(enclosing)h(scop)q(e\))193 227 y (2.)22 b fj(8)16 b fl(F)l(unc)f fj(2)h fl(mem)o(b)q(erF)l(unctions\(F.o)o(wne\ r.sup)q(erclass\),)326 284 y(F)l(unc.name)g fj(6)p fl(=)f(F.name.)251 340 y (\(a)g(mem)o(b)q(er)g(function)h(with)g(the)f(same)g(name)g(is)h(not)f(de\014\ ned)h(in)g(a)f(sup)q(erclass\).)193 413 y(3.)22 b(classesReferencing\(F\))17 b fj(\032)e fl(scop)q(eOf\(defaultV)l(alue\).)251 470 y(\(defaultV)l(alue)i(is) e(visible)j(in)e(all)g(places)g(where)g(F)e(is)i(called\).)151 564 y(By)e(the) g(precondition)h(1,)f(there)f(are)h(no)g(name)f(collisions)j(with)f(the)e(new) h(v)m(ariable)i(in)e(F,)f(nor)h(in)g(the)151 620 y(corresp)q(onding)k(functio\ ns)g(de\014ned)h(in)f(sub)q(classes.)28 b(By)17 b(preconditions)i(2,)e(this)h (co)o(v)o(ers)e(all)j(corre-)151 677 y(sp)q(onding)h(functions.)30 b(The)19 b (argumen)o(t)e(is)i(unreferenced,)h(hence)g(prop)q(ert)o(y)e(sev)o(en)h(\(sem\ an)o(tically)151 733 y(equiv)m(alen)o(t)14 b(references)f(and)g(op)q(erations\ \))f(is)h(preserv)o(ed.)20 b(The)12 b(other)h(program)e(prop)q(erties)i(are)f (triv-)151 790 y(ially)19 b(preserv)o(ed.)28 b(Adding)19 b(an)f(unreferenced) h(argumen)o(t)e(do)q(es)h(not)f(c)o(hange)h(the)g(b)q(eha)o(vior)g(of)f(the) 151 846 y(program.)37 940 y fh(G.)23 b fi(delete)s 14 2 v 13 w(function)s 14 2 v 14 w(ar)n(gument)151 1015 y fl(Delete)15 b(an)g(argumen)o(t)e(from)h(the)g (de\014nition)j(of)d(a)g(function)h(in)g(its)g(con)o(taining)g(class)g(and,)g (unless)g(it)151 1071 y(is)g(priv)m(ate,)f(from)g(all)h(sub)q(classes)g(where) g(it)f(is)h(rede\014ned.)20 b(In)15 b(eac)o(h)f(function)h(call,)g(the)g(argu\ men)o(t)e(is)151 1128 y(remo)o(v)o(ed.)151 1203 y(Argumen)o(ts:)20 b(v)m(aria\ ble)c(Arg)151 1278 y(Preconditions:)193 1372 y(1.)22 b(referencesT)l(o\(Arg\)) 15 b(=)g(0.)251 1428 y(\(the)g(argumen)o(t)g(is)g(unreferenced.\))193 1501 y (2.)22 b fj(8)16 b fl(F)e fj(2)i fl(\(functionsThatOv)o(erride\(Arg.o)o(wner\ \)\),)401 1558 y(referencesT)l(o\(argumen)o(t)f(in)h(corresp)q(onding)g(p)q (osition\))g(=)f(0.)251 1614 y(\(the)g(corresp)q(onding)h(argumen)o(t)f(in)h (eac)o(h)f(o)o(v)o(erriding)h(function)g(is)f(unreferenced\).)193 1687 y(3.) 22 b fj(8)16 b fl(F)l(unc)f fj(2)h fl(mem)o(b)q(erF)l(unctions\(Arg.o)o(wner.\ o)o(wner.sup)q(erclass\),)326 1744 y(F)l(unc.name)g fj(6)p fl(=)f(Arg.o)o(wne\ r.name.)251 1800 y(\(the)g(mem)o(b)q(er)g(function)h(con)o(taining)g(Arg)f (is)h(not)f(de\014ned)h(in)g(a)f(sup)q(erclass\).)193 1873 y(4.)22 b fj(8)16 b fl(argExpr)e(assigned)i(to)e(Arg)h(\(or)f(to)h(the)g(corresp)q(onding)h(argum\ en)o(t)f(in)h(eac)o(h)326 1930 y(o)o(v)o(erriding)g(function\),)401 1986 y (noSideE\013ectsP\(argExpr\).)251 2043 y(\(the)d(expressions)g(passed)g(to)g (Arg)f(\(or)g(to)g(corresp)q(onding)i(argumen)o(t)e(v)m(ariables)i(in)g(o)o (v)o(erriding)251 2099 y(functions\))i(do)f(not)g(ha)o(v)o(e)g(side)h(e\013ec\ ts\).)151 2193 y(By)d(the)g(preconditions,)h(Arg)f(is)g(not)f(referenced,)i (nor)f(is)g(the)g(corresp)q(onding)h(argumen)o(t)d(referenced)151 2249 y(in) 19 b(o)o(v)o(erriding)g(functions)g(de\014ned)g(in)g(sub)q(classes.)30 b(Expr\ essions)18 b(passed)h(to)e(Arg)h(\(in)h(calls)g(to)e(its)151 2306 y(con)o(tai\ ning)12 b(function\))f(ha)o(v)o(e)f(no)h(side)g(e\013ects.)19 b(Therefore,)11 b(program)e(prop)q(ert)o(y)i(sev)o(en)g(\(seman)o(tically)151 2362 y(equiv)m (alen)o(t)23 b(references)f(and)g(op)q(erations\))f(is)h(preserv)o(ed.)39 b (The)21 b(other)g(program)g(prop)q(erties)h(are)151 2419 y(trivially)d(preser\ v)o(ed.)25 b(Deleting)17 b(an)g(unreferenced)h(argumen)o(t)e(do)q(es)h(not)g (c)o(hange)g(the)g(b)q(eha)o(vior)g(of)151 2475 y(the)e(program.)37 2569 y fh (H.)23 b fi(r)n(e)n(or)n(der)s 14 2 v 13 w(function)s 14 2 v 14 w(ar)n(gument\ s)952 2760 y fl(46)g eop bop 151 42 a fl(Reorder)17 b(the)f(argumen)o(ts)g (in)h(a)f(mem)o(b)q(er)g(function)h(de\014nition)i(\(in)d(the)h(sp)q(eci\014e\ d)h(class)f(and)f(in)i(all)151 98 y(sub)q(classes\))e(and)g(in)g(all)g(calls) g(to)f(that)f(function.)151 172 y(Argumen)o(ts:)20 b(function)c(F,)e(\(list)i (of)e(v)m(ariable\))j(newArgOrdering.)151 247 y(Preconditions:)193 339 y(1.) 22 b fj(8)16 b fl(function)g fj(2)f fl(\(F)g fj([)g fl(functionsThatOv)o(erri\ de\(F\)\),)326 395 y fj(8)h fl(argumen)o(t)e fj(2)h fl(function.argumen)o(ts) 401 452 y fj(8)h fl(expression)g fj(2)f fl(argumen)o(tExpressionsInF)l(unctio\ nCalls\(argumen)o(t,)h(F\):)476 508 y(noSideE\013ectsP\(expression\).)251 565 y(\(the)f(expressions)h(assigned)g(to)e(the)i(argumen)o(t)e(v)m(ariables)j (ha)o(v)o(e)d(no)i(side)g(e\013ects\))1690 548 y fs(5)193 636 y fl(2.)22 b (corresp)q(ondingSup)q(erclassMem)o(b)q(erF)l(unctions\(F\))c(=)d fj(;)p fl (.)251 693 y(\(a)g(corresp)q(onding)h(mem)o(b)q(er)f(function)h(is)g(not)f (de\014ned)h(in)g(a)f(sup)q(erclass\).)151 785 y(The)i(function)g(argumen)o (ts)e(\(b)o(y)h(precondition\))h(do)f(not)g(ha)o(v)o(e)g(an)o(y)g(side)h(e\ \013ects;)f(reordering)g(them)151 842 y(do)q(es)c(not)f(c)o(hange)h(the)g(b)q (eha)o(vior)g(of)f(the)h(function,)g(since)h(the)f(ordering)g(of)f(argumen)o (ts)g(in)h(all)g(calls)h(to)151 898 y(the)h(function)g(are)g(similarly)h(reor\ dered.)20 b(Th)o(us,)14 b(program)e(prop)q(ert)o(y)i(sev)o(en)g(\(seman)o(tic\ ally)g(equiv)m(a-)151 954 y(len)o(t)i(references)f(and)h(op)q(erations\))e (preserv)o(ed)i(b)o(y)f(the)g(preconditions;)h(other)f(program)f(prop)q(ertie\ s)151 1011 y(are)h(trivially)i(preserv)o(ed.)37 1103 y fh(I.)23 b fi(add)s 14 2 v 14 w(function)s 14 2 v 13 w(b)n(o)n(dy)151 1178 y fl(Add)16 b(a)f(functio\ n)h(b)q(o)q(dy)g(to)e(an)h(existing)i(mem)o(b)q(er)e(function)h(\(signature\)\ .)151 1252 y(Argumen)o(ts:)k(function)c(F,)e(statemen)o(t)g(newF)l(unctionBo) q(dy)l(.)151 1326 y(Preconditions:)193 1419 y(1.)22 b(compilesP)17 b(\(F,)d (where)h(F.b)q(o)q(dy)g(=)h(newF)l(unctionBo)q(dy\),)g(con)o(tainingClass\(F\ \)\))251 1475 y(\(the)f(new)h(function)g(b)q(o)q(dy)f(compiles\).)151 1567 y (By)e(precondition)h(one,)f(the)f(function)i(b)q(o)q(dy)f(compiles)h(cleanly) l(.)21 b(Since)14 b(the)f(function)g(is)g(a)f(signature)151 1624 y(only)l(,)i (it)g(is)f(nev)o(er)h(called)h(directly;)g(adding)f(a)f(function)h(b)q(o)q (dy)g(to)e(it)i(do)q(es)f(not)g(c)o(hange)h(the)f(b)q(eha)o(vior)151 1680 y (of)19 b(the)h(program.)32 b(Therefore)19 b(program)g(prop)q(ert)o(y)g(sev)o (en)h(\(seman)o(tically)g(equiv)m(alen)o(t)i(references)151 1737 y(and)16 b (op)q(erations\))f(is)g(preserv)o(ed,)g(as)g(are)g(\(trivially\))h(the)g(othe\ r)e(program)g(prop)q(erties.)37 1829 y fh(J.)23 b fi(delete)s 14 2 v 13 w(fun\ ction)s 14 2 v 14 w(b)n(o)n(dy)151 1903 y fl(Delete)16 b(a)f(function)h(b)q (o)q(dy)g(from)e(an)h(existing)h(mem)o(b)q(er)g(function)g(\(making)f(it)g (a)g(signature)h(only\).)151 1978 y(Argumen)o(ts:)k(function)c(F.)151 2052 y (Preconditions:)193 2144 y(1.)22 b(callsT)l(o\(F\))15 b(=)h fj(;)p fl(.)151 2237 y(By)11 b(the)g(precondition,)i(F)e(is)g(nev)o(er)g(called)h(in)g(the)f (program,)f(therefore)h(b)q(eha)o(vior)g(is)h(preserv)o(ed)f(when)151 2293 y (its)i(function)g(b)q(o)q(dy)g(is)g(remo)o(v)o(ed.)18 b(Therefore,)13 b(progr\ am)e(prop)q(ert)o(y)h(sev)o(en)h(\(seman)o(tically)g(equiv)m(alen)o(t)151 2350 y(references)j(and)f(op)q(erations\))g(preserv)o(ed,)h(as)e(are)h(\(trivially\ \))h(the)g(other)f(program)f(prop)q(erties.)37 2430 y 750 2 v 89 2457 a fu (5)107 2473 y fp(If)h(t)o(w)o(o)g(argumen)o(t)i(expressions)h(in)f(a)f(functi\ on)h(call)h(ha)o(v)o(e)e(side)h(e\013ects,)g(and)f(the)g(side)h(e\013ects)g (are)f(not)g(indep)q(enden)o(t,)37 2519 y(program)11 b(b)q(eha)o(vior)h(could) f(c)o(hange)g(if)g(the)f(argumen)o(ts)h(w)o(ere)e(reordered.)17 b(This)11 b (precondition)i(prev)o(en)o(ts)d(this)h(from)f(happ)q(ening.)37 2564 y(The)j (precondition)i(could)f(b)q(e)e(relaxed)i(to)e(p)q(ermit)i(only)f(one)g(argum\ en)o(t)g(expression)h(with)f(side)h(e\013ects)e(p)q(er)h(function)h(call,)f (or)37 2610 y(m)o(ultiple)j(argumen)o(t)e(expressions)h(with)e(side)h(e\013ec\ ts)g(as)f(long)h(as)f(the)h(side)g(e\013ects)f(are)g(indep)q(enden)o(t)j(of)d (eac)o(h)g(other.)952 2760 y fl(47)g eop bop 37 42 a fh(K.)23 b fi(c)n(onvert) s 14 2 v 13 w(instanc)n(e)s 14 2 v 12 w(variable)s 14 2 v 14 w(to)s 14 2 v 14 w(p)n(ointer.)151 117 y fl(This)d(refactoring)f(is)g(sp)q(eci\014c)i(to)e(C++\ .)32 b(C++)19 b(has)g(t)o(w)o(o)f(w)o(a)o(ys)g(in)i(whic)o(h)g(a)f(v)m(ariabl\ e)h fi(V)m(ar1)f fl(can)151 173 y(\\con)o(tain")d(an)h(instance)g(of)g(a)f (class)h ff(Class1)p fl(.)24 b(The)17 b(v)m(ariable)h(declaration)g(\\)p ff (Class1)e fi(V)m(ar1)p fl(")h(declares)151 230 y fi(V)m(ar1)e fl(to)g(b)q(e)h (a)f(particular)h(instance)h(of)e ff(Class1)g fl(throughout)g(program)f(execu\ tion.)22 b(Space)16 b(is)g(stati-)151 286 y(cally)f(allo)q(cated)g(for)f(it)g (at)g(compile)h(time.)20 b fi(V)m(ar1)14 b fl(can)h(b)q(e)f(reassigned,)h(but) f(can)g(only)h(b)q(e)g(reassigned)151 342 y(an)g(instance)h(of)f ff(Class1)p fl(.)151 418 y(By)e(con)o(trast,)e(the)i(v)m(ariable)h(declaration)g(\\)p ff (Class1*)e fi(V)m(ar1)p fl(")g(allo)o(ws)h fi(V)m(ar1)f fl(to)g(p)q(oin)o(t)i (to)e(\(i.e.)19 b(con)o(tain\))151 474 y(an)i(instance)h(of)f ff(Class1)g fl (or)f(an)h(instance)h(of)f(an)o(y)f(of)h(its)g(sub)q(classes.)39 b(This)21 b (allo)o(ws)h(expressions)151 531 y(assigned)16 b(to)e(it)i(to)f(b)q(e)g(sp)q (ecialized)k(while)d(main)o(taining)h(t)o(yp)q(e)e(compatibilit)o(y)l(.)151 606 y(This)20 b(refactoring)f(con)o(v)o(erts)g(a)g(v)m(ariable)i(from)d(its)i (curren)o(t)f(t)o(yp)q(e)h(to)e(b)q(ecome)i(a)g(p)q(oin)o(ter)f(to)g(that)151 662 y(t)o(yp)q(e,)c(and)g(assigns)h(to)e(the)i(v)m(ariable)g(an)f(instance)h (of)f(its)g(curren)o(t)g(t)o(yp)q(e.)151 737 y(If)h(the)g(v)m(ariable)h(is)f (a)f(mem)o(b)q(er)h(v)m(ariable,)h(with)f(a)f(declaration)i(of)e(the)h(form)f (\\)p ff(Class1)g fi(V)m(ar1\(ar)n(gs\))p fl(",)151 794 y(this)20 b(refactori\ ng)f(c)o(hanges)g(the)h(declaration)g(to)f(\\)p ff(Class1*)g fi(V)m(ar1)p fl (",)h(adds)f(to)g(the)h(class)f(construc-)151 850 y(tor)h(the)h(assignmen)o (t:)30 b(\\)p fi(V)m(ar1)21 b fl(=)h fi(new)e ff(Class1)p fi(\(ar)n(gs\))p fl (",)h(and)g(adds)f(to)g(the)h(class)g(destructor)f(the)151 907 y(statemen)o (t:)f(\\)p fi(delete)d(V)m(ar1)p fl(".)151 982 y(If)21 b(the)f(v)m(ariable)i (is)f(a)f(lo)q(cal)h(v)m(ariable,)i(with)e(a)f(declaration)h(of)f(the)g(form) g(\\)p ff(Class1)g fi(V)m(ar1\(ar)n(gs\))p fl(",)151 1038 y(this)15 b(refacto\ ring)f(c)o(hanges)g(the)h(declaration)g(to)f(\\)p ff(Class1*)g fi(V)m(ar1)p fl (")g(and)g(immediately)i(follo)o(wing)f(the)151 1095 y(v)m(ariable)i(declarat\ ion)f(adds)f(the)g(assignmen)o(t:)20 b(\\)p fi(V)m(ar1)c fl(=)h fi(new)d ff (Class1)p fi(\(ar)n(gs\))p fl(".)151 1170 y(Expressions)d(of)g(the)g(form)f fi (&V)m(ar1)g fl(are)h(c)o(hanged)g(to)f fi(V)m(ar1)p fl(.)18 b(Expressions)11 b (of)g(the)g(form)f fi(V)m(ar1.memb)n(er)151 1226 y fl(are)15 b(c)o(hanged)h (to)e fi(V)m(ar1)p fj(\000)f fk(>)p fi(memb)n(er)p fl(.)151 1301 y(Argumen)o (ts:)20 b(v)m(ariable)c(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable.)151 1377 y (Preconditions:)193 1470 y(1.)22 b(none.)151 1564 y(Program)e(prop)q(ert)o (y)i(six)g(\(t)o(yp)q(e)f(safe)h(assignmen)o(ts\))f(is)h(preserv)o(ed)g(b)o (y)g(construction.)39 b(Also,)24 b(b)o(y)151 1621 y(construction)17 b(eac)o (h)f(reference)i(to)d(the)i(v)m(ariable)h(is)f(replaced)g(b)o(y)g(a)f(seman)o (tically)h(equiv)m(alen)o(t)i(\(but)151 1677 y(not)14 b(iden)o(tical)397 1661 y fs(6)419 1677 y fl(\))g(reference)h(to)f(a)h(p)q(oin)o(ter)g(v)m(ariable,)g (preserving)h(prop)q(ert)o(y)e(sev)o(en.)20 b(Other)15 b(program)151 1734 y (prop)q(erties)h(are)f(trivially)i(preserv)o(ed.)813 1717 y fs(7)37 1827 y fh (L.)23 b fi(c)n(onvert)s 14 2 v 13 w(variable)s 14 2 v 14 w(r)n(efer)n(enc)n (es)s 14 2 v 12 w(to)s 14 2 v 14 w(function)s 14 2 v 13 w(c)n(al)r(ls)151 1902 y fl(Argumen)o(ts:)d(v)m(ariable)c(V.)151 1978 y(Con)o(v)o(ert)e(all)i(refere\ nces)g(to)e(V)h(to)g(calls)h(to)e(its)i(accessing)g(functions.)k(Con)o(v)o (ert)14 b(all)i(assignmen)o(ts)f(to)151 2034 y(V)g(to)g(calls)h(to)f(its)g (up)q(dating)h(function.)151 2109 y(Preconditions:)193 2203 y(1.)22 b(lo)q (callyDe\014nedMem)o(b)q(erNamedP\(get)s 14 2 v 16 w fk(<)13 b(V)22 b(>)p fl (,)15 b(V.o)o(wner\))f fj(^)251 2259 y fl(lo)q(callyDe\014nedMem)o(b)q(erName\ dP\(address)s 14 2 v 16 w(of)s 14 2 v 13 w fk(<)f(V)22 b(>)p fl(,)15 b(V.o)o (wner\))f fj(^)251 2316 y fl(lo)q(callyDe\014nedMem)o(b)q(erNamedP\(set)s 14 2 v 16 w fk(<)f(V)22 b(>)p fl(,)15 b(V.o)o(wner\).)251 2372 y(\(the)g(access)g (and)h(up)q(date)g(functions)g(are)e(already)i(de\014ned\).)37 2456 y 750 2 v 89 2483 a fu(6)107 2499 y fp(See)c(section)h(8.5.3)f(for)g(a)g(discussion)j (of)d(ho)o(w)g(v)n(ariable)j(references)d(can)h(b)q(e)f(seman)o(tically)j(equ\ iv)n(alen)o(t)g(but)e(not)f(iden)o(tical.)89 2528 y fu(7)107 2544 y fp(This)h (refactoring)g(can)g(decrease)g(the)f(ph)o(ysical)j(size)e(of)f(instances)i (of)e(the)g(class.)18 b(Programs)13 b(that)f(test)g(the)h(ph)o(ysical)i(size) 37 2590 y(of)e(ob)r(jects)h(could)g(see)f(their)h(b)q(eha)o(vior)h(c)o(hange) f(\(see)f(the)g(discussion)j(in)e(section)g(4.1.2\).)952 2760 y fl(48)g eop bop 151 42 a fl(The)21 b(access)f(and)g(up)q(date)h(functions,)h(b)o(y)e(cons\ truction,)h(b)q(eha)o(v)o(e)f(the)h(same)f(as)f(direct)i(accesses)151 98 y (and)14 b(up)q(dates)h(to)e(the)h(v)m(ariable.)21 b(Therefore,)13 b(replacing) i(the)f(v)m(ariable)i(accesses)e(with)g(calls)h(to)e(these)151 154 y(function\ s)20 b(preserv)o(es)g(prop)q(ert)o(y)f(sev)o(en)h(\(seman)o(tically)h(equiv)m (alen)o(t)g(references)f(and)g(op)q(erations\).)151 211 y(Other)c(program)e (prop)q(erties)i(are)e(trivially)j(preserv)o(ed.)37 305 y fh(M.)22 b fi(r)n (eplac)n(e)s 14 2 v 13 w(statement)s 14 2 v 14 w(list)s 14 2 v 13 w(with)s 14 2 v 14 w(function)s 14 2 v 13 w(c)n(al)r(l)151 380 y fl(Argumen)o(ts:)e(funct\ ion)c(F,)e(list)i(statemen)o(tList,)e(functionCall)j(F)o(C.)151 455 y(Replace) g(statemen)o(tList)e(in)h(F)f(with)g(the)g(function)h(call)h(F)o(C.)151 530 y (Preconditions:)193 624 y(1.)22 b(classCon)o(taining\(F\))15 b fj(\032)h fl (scop)q(eOf\(F)o(C.calledF)l(unction\))251 680 y(\(the)f(called)i(function)f (is)g(visible)h(from)d(the)i(calling)h(function\).)193 753 y(2.)22 b(seman)o (ticallyEquiv)m(alen)o(tP\(statemen)o(tList,)17 b(F)o(C\).)251 810 y(\(the)h (function)i(call)g(is)f(seman)o(tically)h(equiv)m(alen)o(t)g(to)e(the)g(state\ men)o(t)g(list)h(it)g(replaces.)31 b(The)251 866 y(abstract)14 b(syn)o(tax)h (trees)g(m)o(ust)f(b)q(e)i(the)f(same,)g(up)h(to)e(v)m(ariable)j(renaming.\)) 151 960 y(The)j(function)g(call,)h(b)o(y)f(precondition,)i(b)q(eha)o(v)o(es)d (the)h(same)f(as)g(the)h(statemen)o(t)e(list)i(it)g(replaces.)151 1017 y(Prog\ ram)c(prop)q(ert)o(y)g(sev)o(en)h(\(seman)o(tically)h(equiv)m(alen)o(t)g(refe\ rences)g(and)f(op)q(erations\))f(is)i(therefore)151 1073 y(preserv)o(ed;)d (other)g(program)f(prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)37 1167 y fh(N.)23 b fi(inline)s 14 2 v 12 w(function)s 14 2 v 13 w(c)n(al)r(l)151 1242 y fl(Replace)17 b(a)e(function)h(call)g(with)g(the)f(b)q(o)q(dy)h(of)f(the)g (called)i(function.)1351 1226 y fs(8)151 1317 y fl(Argumen)o(ts:)j(functionCa\ ll)c(F)o(C.)151 1392 y(Preconditions:)193 1486 y(1.)22 b fj(8)16 b fl(refdIte\ m)f fj(2)326 1543 y fl(\(v)m(ariablesReferencedBy\(F)o(C.calledF)l(un)q(ction\ \))j fj([)401 1599 y fl(functionsCalledBy\(F)o(C.calledF)l(unction\)\),)476 1655 y(\(scop)q(eOf\(refdItem\))d fj(\032)h fl(F)o(C.calledF)l(unction\))g fj (_)476 1712 y fl(\(con)o(tainingClass\(F)o(C\))e fj(\032)i fl(scop)q(eOf\(ref\ dItem\)\).)251 1768 y(\(all)h(mem)o(b)q(er)f(v)m(ariables)h(and)f(functions)g (referenced)h(b)o(y)f(the)g(called)i(function)e(are)g(reac)o(hable)251 1825 y (from)f(the)g(calling)i(function\))151 1919 y(After)e(c)o(hec)o(king)h(the)f (preconditions,)i(this)e(refactoring:)193 2012 y(1.)22 b(creates)c(a)g(statem\ en)o(t)e(list,)k(equiv)m(alen)o(t)f(to)f(the)g(function)h(b)q(o)q(dy)f(in)h (the)f(called)i(function,)f(to)251 2069 y(insert)14 b(in)o(to)e(the)i(calling) g(function.)20 b(In)14 b(creating)f(the)g(statemen)o(t)f(list,)i(the)f(names) g(of)f(v)m(ariables)251 2125 y(lo)q(cal)22 b(to)f(the)g(called)i(function)f (ma)o(y)e(b)q(e)i(c)o(hanged)g(to)e(a)o(v)o(oid)h(name)g(collisions.)40 b(Eac) o(h)21 b(call)251 2182 y(b)o(y)16 b(v)m(alue)i(is)f(handled)h(b)o(y)e(assignm\ en)o(t)g(statemen)o(t)g(added)h(to)e(the)i(b)q(eginning)h(of)e(the)h(inlined) 251 2238 y(co)q(de.)j(Return)14 b(statemen)o(ts)e(are)h(con)o(v)o(erted)g(to) f(branc)o(h/goto)g(statemen)o(ts)g(\(at)g(the)i(end)g(of)e(the)251 2295 y(sta\ temen)o(t)i(list\).)193 2368 y(2.)22 b(replaces)16 b(the)g(function)g(call)g (with)f(the)h(equiv)m(alen)o(t)h(statemen)o(t)d(list.)37 2449 y 750 2 v 89 2476 a fu(8)107 2492 y fp(Issues)f(in)o(v)o(olv)o(ed)j(in)d(inlini)q(ng)j(fun\ ctions)f(calls)f(are)f(detailed)i(in)f(the)f(program)h(transformation)h(liter\ ature)f([27].)952 2760 y fl(49)g eop bop 151 42 a fl(The)12 b(only)g(problem) h(with)f(inlining)i(a)e(called)h(function)g(is)f(that)f(the)h(function)g(ma)o (y)f(reference)i(priv)m(ate)151 98 y(or)j(protected)g(mem)o(b)q(ers)g(that)f (the)h(calling)i(function)f(can't)f(reference.)23 b(By)16 b(precondition)h (one,)g(all)151 154 y(references)f(are)g(visible)i(to)d(the)h(caller.)22 b (Th)o(us,)16 b(the)f(statemen)o(t)g(list)i(is)f(seman)o(tically)h(equiv)m(ale\ n)o(t)g(to)151 211 y(the)e(function)h(call)h(it)e(replaces.)21 b(Therefore,) 14 b(program)h(prop)q(ert)o(y)f(sev)o(en)i(\(seman)o(tically)g(equiv)m(alen)o (t)151 267 y(references)e(and)g(op)q(erations\))f(is)h(preserv)o(ed.)20 b(Oth\ er)14 b(program)e(prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)37 361 y fh (O.)23 b fi(change)s 14 2 v 13 w(sup)n(er)n(class)151 436 y fl(Change)15 b (the)h(sup)q(erclass)g(of)f(a)f(class.)151 511 y(Argumen)o(ts:)20 b(class)15 b (C,)g(class)g(newSup)q(erclass.)151 587 y(Preconditions:)193 680 y(1.)22 b fj (8)16 b fl(I)f fj(2)h fl(instancesOf\(C)f fj([)h fl(sub)q(classesOf\(C\)\),) 326 737 y fj(8)g fl(V)l(ar)f fj(2)g fl(v)m(ariablesAssigned\(I\),)401 793 y (V)l(ar.t)o(yp)q(e)g fj(2)g fl(\(C)g fj([)g fl(sub)q(classesOf\(C\))h fj([)g fl(newSup)q(erclass)h fj([)476 850 y fl(sup)q(erclassesOf\(newSup)q(erclass\)\ \).)251 906 y(\(eac)o(h)11 b(assignmen)o(t)f fi(of)h fl(item)g(w)o(ould)g(rem\ ain)g(t)o(yp)q(e)g(safe)g(if)g(its)g(t)o(yp)q(e)f(w)o(as)g(c)o(hanged)h(to)f (new)s 14 2 v 14 w(t)o(yp)q(e\).)193 979 y(2.)22 b fj(8)16 b fl(mem)o(b)q(er) f fj(2)g fl(inheritedMem)o(b)q(ers\(C\),)326 1036 y(mem)o(b)q(erNamedP\(mem)o (b)q(er.name,)g(newSup)q(erclass\))h fj(^)326 1092 y fl(matc)o(hingA)o(ttribu\ tesP\()401 1149 y(mem)o(b)q(er,)401 1205 y(mem)o(b)q(erNamed\(mem)o(b)q(er.na\ me,)f(newSup)q(erclass\)\))251 1262 y(\(all)d(mem)o(b)q(ers)e(curren)o(tly)i (inherited)g(will)h(b)q(e)e(iden)o(tically)i(inherited)g(from)d(the)h(new)g (sup)q(erclass.)251 1318 y(This)18 b(precondition)g(is)f(strict,)g(but)g(the) g(higher)h(lev)o(el)g(refactoring)e(mo)o(v)o(e)s 14 2 v 13 w(class)h(satis\ \014es)g(this)251 1374 y(precondition)23 b(b)o(y)e(\014rst)f(calling)j(other) e(refactorings)f(to)h(add)g(mem)o(b)q(ers)g(as)g(needed)h(to)e(the)251 1431 y (sup)q(erclass,)c(b)q(efore)g(calling)g(this)g(refactoring.\))193 1504 y(3.) 22 b fj(8)16 b fl(mem)o(b)q(er)f fj(2)g fl(lo)q(callyDe\014nedMem)o(b)q(ersOf\ \(C\),)326 1560 y(if)h(mem)o(b)q(erNamedP\(mem)o(b)q(er.name,)e(newSup)q(ercl\ ass\),)401 1617 y(\(if)h(mem)o(b)q(er)h(is)g(a)e(v)m(ariable\):)21 b(matc)o (hingA)o(ttributesP\()476 1673 y(mem)o(b)q(er,)15 b(mem)o(b)q(erNamed\(mem)o (b)q(er.name,)g(newSup)q(erclass\)\))401 1730 y(\(if)g(mem)o(b)q(er)h(is)g (a)e(function\):)21 b(matc)o(hingSignatureP\()476 1786 y(mem)o(b)q(er,)15 b (mem)o(b)q(erNamed\(mem)o(b)q(er.name,)g(newSup)q(erclass\)\).)251 1843 y(\(e\ ac)o(h)f(lo)q(cally)i(de\014ned)f(mem)o(b)q(er)g(either)g(do)q(esn't)f(clash) g(with)h(a)f(mem)o(b)q(er)g(inherited)i(from)d(the)251 1899 y(new)k(sup)q(erc\ lass,)g(or)e(it)i(is)f(iden)o(tical)i(to)e(an)g(mem)o(b)q(er)g(inheritable)i (from)e(the)g(new)g(sup)q(erclass)251 1956 y(and)g(therefore)e(can)i(b)q(e)g (remo)o(v)o(ed)e(from)h(the)g(sub)q(class)h(when)g(the)f(sup)q(erclass)i(is)e (c)o(hanged.\))193 2029 y(4.)22 b(the)11 b(constructor)g(and)g(destructor)f (c)o(hain)i(for)e(the)i(new)f(sup)q(erclass)h(is)g(seman)o(tically)g(equiv)m (alen)o(t)251 2085 y(to)j(the)g(c)o(hains)h(for)e(the)i(curren)o(t)f(direct)h (sup)q(erclass)g(of)f(C.)151 2179 y(After)g(c)o(hec)o(king)h(the)f(preconditi\ ons,)i(this)e(refactoring:)193 2285 y(1.)22 b(c)o(hanges)15 b(the)h(sup)q(erc\ lass)g(attribute)f(of)g(C)g(to)f(newSup)q(erclass)193 2358 y(2.)22 b(deletes) c(from)f(C)g(an)o(y)g(mem)o(b)q(er)g(v)m(ariables)h(iden)o(tically)i(de\014ne\ d)f(in)f(or)e(inherited)j(b)o(y)f(newSu-)251 2415 y(p)q(erclass.)151 2521 y (Program)d(prop)q(ert)o(y)h(six)h(\(t)o(yp)q(e-safe)e(assignmen)o(ts\))h(is)h (preserv)o(ed)g(b)o(y)f(precondition)i(one.)23 b(By)16 b(pre-)151 2577 y(cond\ itions)h(t)o(w)o(o)d(and)i(three,)f(references)h(to)f(mem)o(b)q(ers)g(b)q(efo\ re)h(the)f(refactoring)g(will)j(b)q(e)e(the)f(same,)952 2760 y(50)g eop bop 151 42 a fl(or)15 b(consisten)o(tly)h(replaced)g(b)o(y)f(references)g(to)g (mem)o(b)q(ers)g(with)g(an)g(iden)o(tical)i(t)o(yp)q(e,)e(after)f(the)i(refac\ -)151 98 y(toring.)32 b(By)19 b(precondition)i(four,)f(the)f(constructors)g (and)g(destructors)g(are)g(seman)o(tically)h(equiv-)151 154 y(alen)o(t)e(when) g(the)f(sup)q(erclass)i(is)f(c)o(hanged.)27 b(Therefore,)17 b(program)g(prop) q(ert)o(y)g(sev)o(en)h(\(seman)o(tically)151 211 y(equiv)m(alen)o(t)i(referen\ ces)f(and)f(up)q(dates\))g(is)h(preserv)o(ed.)28 b(Other)18 b(program)f(prop) q(erties)i(are)f(trivially)151 267 y(preserv)o(ed.)37 411 y fd(5.4)70 b(Mo)n (ving)24 b(a)f(Mem)n(b)r(er)f(V)-6 b(ariable)37 512 y fl(These)16 b(refactori\ ngs)f(mo)o(v)o(e)f(a)h(mem)o(b)q(er)g(v)m(ariable)i(to)e(a)f(sup)q(erclass)j (or)d(sub)q(class.)37 618 y fh(A.)22 b fi(move)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)s 14 2 v 13 w(to)s 14 2 v 15 w(sup)n(er)n(class)151 693 y fl (Argumen)o(ts:)e(v)m(ariable)c(V,)f(class)h(C.)151 769 y(Mo)o(v)o(e)10 b(V)h (to)f(class)i(C)f(from)f(all)i(sub)q(classes)g(where)f(it)g(is)h(de\014ned.) 19 b(If)12 b(V.accessCon)o(trolMo)q(de)e(=)h(public)151 825 y(in)i(its)f(curr\ en)o(t)f(class\(es\),)h(it)g(will)i(b)q(e)e(public)i(in)f(its)f(new)g(class;) h(otherwise,)f(the)g(access)g(con)o(trol)f(mo)q(de)151 881 y(in)19 b(the)f (new)g(class)g(will)h(b)q(e)g(protected.)27 b(Also,)19 b(in)f(eac)o(h)g(sub)q (class)h(where)f(it)g(is)g(curren)o(tly)g(de\014ned,)151 938 y(the)d(lo)q(cal) i(de\014nition)g(of)e(the)g(v)m(ariable)h(is)g(remo)o(v)o(ed,)e(as)h(it)h(wil\ l)h(b)q(e)e(no)o(w)g(b)q(e)h(inherited)h(from)d(C.)151 1013 y(This)k(refactor\ ing)f(c)o(hanges)h(the)f(relativ)o(e)h(ph)o(ysical)h(ordering)e(of)g(v)m(aria\ bles)i(in)f(the)g(class,)g(but)f(the)151 1070 y(v)m(ariable)g(t)o(yp)q(e)e (and)g(references)h(remain)g(the)f(same.)1063 1053 y fs(9)151 1145 y fl(Preco\ nditions:)193 1238 y(1.)22 b fj(8)16 b fl(C)f fj(2)g fl(sub)q(classesOf\(C\):) 326 1295 y(\()p fj(9)g fl(V)l(ar)g fj(2)h fl(C.lo)q(callyDe\014nedMem)o(b)q (erV)l(ariables)i fj(^)326 1351 y fl(V)l(ar.name)d(=)g(V.name\))g fj(\))401 1408 y fl(matc)o(hingA)o(ttributesP\(V)l(ar,)f(V\).)251 1464 y(\(the)h(v)m (ariable)i(is)e(de\014ned)i(iden)o(tically)h(in)e(all)g(sub)q(classes)g(where) g(it)f(is)h(de\014ned\))193 1537 y(2.)22 b fj(8)16 b fl(mem)o(b)q(er)f fj(2)g fl(C.lo)q(callyDe\014nedMem)o(b)q(erV)l(ariabl)q(es,)326 1594 y(mem)o(b)q(er.\ name)g fj(6)p fl(=)h(V.name\))251 1650 y(\(the)c(v)m(ariable)i(isn't)e(alread\ y)g(de\014ned)i(lo)q(cally)g(in)f(\(as)e(a)h(priv)m(ate)h(mem)o(b)q(er)f(of)t (\))f(the)h(sup)q(erclass\).)151 1744 y(Since)20 b(\(b)o(y)d(precondition)i (one\))f(the)g(v)m(ariable)h(is)g(de\014ned)g(iden)o(tically)h(in)f(all)g(sub) q(classes)g(where)f(it)151 1801 y(is)f(de\014ned,)g(replacing)h(the)e(lo)q (cal)h(de\014nitions)h(in)f(the)g(sub)q(classes)g(b)o(y)f(a)g(de\014nition)i (inherited)g(from)151 1857 y(C)f(will)i(not)e(c)o(hange)h(the)f(b)q(eha)o(vio\ r)h(of)f(the)g(program,)g(preserving)h(program)e(prop)q(ert)o(y)h(sev)o(en)h (\(se-)151 1913 y(man)o(tically)f(equiv)m(alen)o(t)h(references)f(and)f(op)q (erations\).)22 b(Other)16 b(program)f(prop)q(erties)i(are)f(trivially)151 1970 y(preserv)o(ed.)351 1953 y fs(10)37 2064 y fh(B.)23 b fi(move)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)s 14 2 v 13 w(to)s 14 2 v 14 w(sub)n(class\ es)151 2139 y fl(Argumen)o(ts:)d(v)m(ariable)c(V,)f(sub)q(class)s 14 2 v 14 w (list.)151 2214 y(Mo)o(v)o(e)21 b(the)g(mem)o(b)q(er)h(v)m(ariable)g(from)f (its)h(curren)o(t)f(con)o(taining)h(class)g(to)e(eac)o(h)i(of)f(its)g(immedia\ te)151 2270 y(sub)q(classes.)151 2346 y(Preconditions:)37 2418 y 750 2 v 89 2445 a fu(9)107 2461 y fp(This)15 b(refactoring)g(c)o(hanges)h(the)f(relativ) o(e)h(ph)o(ysical)h(p)q(osition)f(of)f(v)n(ariables)h(within)g(instances)g (of)f(the)f(class.)23 b(Programs)37 2506 y(that)14 b(test)e(the)h(ph)o(ysical) j(p)q(ositions)f(of)e(v)n(ariables)i(could)f(see)f(their)h(b)q(eha)o(vior)h (c)o(hange)e(\(see)g(the)g(discussion)j(in)e(section)g(4.1.2\).)74 2536 y fu (10)107 2552 y fp(This)h(refactoring)g(c)o(hanges)h(the)f(relativ)o(e)h(ph)o (ysical)h(p)q(osition)f(of)f(v)n(ariables)h(within)g(instances)g(of)f(the)f (class.)23 b(Programs)37 2598 y(that)14 b(test)e(the)h(ph)o(ysical)j(p)q(osit\ ions)f(of)e(v)n(ariables)i(could)f(see)f(their)h(b)q(eha)o(vior)h(c)o(hange)e (\(see)g(the)g(discussion)j(in)e(section)g(4.1.2\).)952 2760 y fl(51)g eop bop 193 42 a fl(1.)22 b(referencesT)l(o\(V,)15 b(con)o(tainingClass\(V\)\))g(=)h fj(;)251 98 y fl(\(the)h(v)m(ariable)i(is)f(not)f(referenced)h(b)o(y)g(mem)o (b)q(ers)f(of,)g(nor)g(referenced)i(on)e(instances)h(of,)f(con-)251 154 y(tai\ ningClass\(V\)\))193 227 y(2.)22 b(V.accessCon)o(trolMo)q(de)15 b fj(6)p fl (=)g(priv)m(ate.)251 284 y(\(the)g(v)m(ariable)i(is)e(already)h(inherited)h (b)o(y)e(the)g(immediate)i(sub)q(classes.)151 378 y(After)g(the)f(refactoring\ ,)h(V)g(will)h(still)h(b)q(e)e(de\014ned)h(in)g(all)g(sub)q(classes)g(that)e (curren)o(tly)h(reference)h(it.)151 434 y(Therefore,)c(program)f(prop)q(ert)o (y)h(sev)o(en)h(\(seman)o(tically)g(equiv)m(alen)o(t)h(references)f(and)g(op) q(erations\))f(is)151 491 y(preserv)o(ed)i(b)o(y)f(preconditions;)h(other)f (program)f(prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)1673 474 y fs(11) 37 634 y fd(5.5)70 b(Comp)r(osite)21 b(Refactorings)37 735 y fl(These)h(refac\ torings)e(build)j(up)q(on)f(the)f(other)g(lo)o(w-lev)o(el)h(refactorings,)g (to:)30 b(abstract)20 b(v)m(ariable)j(access,)37 792 y(con)o(v)o(ert)14 b(b)q (et)o(w)o(een)g(a)g(co)q(de)g(segmen)o(t)g(and)g(a)g(corresp)q(onding)h(funct\ ion)g(call,)g(and)f(p)q(erform)g(more)f(p)q(o)o(w)o(erful)37 848 y(mo)o(ving) j(op)q(erations.)37 942 y fh(A.)22 b fi(abstr)n(act)s 14 2 v 14 w(ac)n(c)n (ess)s 14 2 v 12 w(to)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)151 1017 y fl(Abstract)e(access)h(to)e(a)i(mem)o(b)q(er)f(v)m(ariable)i(b)o(y)e(de\014\ ning)i(functions)g(for)d(accessing)j(the)e(v)m(alue)i(or)151 1074 y(address) 15 b(of)g(the)g(v)m(ariable,)h(and)f(for)f(up)q(dating)i(its)f(v)m(alue.)21 b (Replace)c(v)m(ariable)f(references)g(with)f(calls)151 1130 y(to)h(these)g (functions,)h(and)g(\(if)f(the)h(access)f(con)o(trol)g(mo)q(de)h(of)f(the)g (v)m(ariable)i(is)e(public\))j(limit)e(access)151 1187 y(to)e(the)g(v)m(ariab\ le)i(b)o(y)e(making)g(it)g(protected.)151 1262 y(Argumen)o(ts:)20 b(v)m(ariab\ le)c(V.)151 1337 y(After)f(c)o(hec)o(king)h(its)f(preconditions,)i(this)e(ref\ actoring:)193 1431 y(1.)22 b(calls)16 b(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(function)g(to)f(create)g(the)g(access)g(and)h(up)q(date)f(functions) 251 1487 y(\(named)g(get)s 14 2 v 13 w fk(<)e(V)22 b(>)p fl(,)16 b(set)s 14 2 v 13 w fk(<)d(V)22 b(>)p fl(,)15 b(address)s 14 2 v 14 w(of)s 14 2 v 13 w fk (<)e(V)22 b(>)p fl(\))193 1560 y(2.)g(calls)12 b(con)o(v)o(ert)s 14 2 v 13 w (v)m(ariable)s 14 2 v 15 w(references)s 14 2 v 14 w(to)s 14 2 v 12 w(function) s 14 2 v 15 w(calls)g(to)e(replace)i(references)g(to)e(V)h(with)g(calls)251 1617 y(to)k(the)g(access)g(and)h(up)q(date)f(functions.)193 1690 y(3.)22 b (if)17 b(the)f(access)g(con)o(trol)g(mo)q(de)h(of)e(V)i(is)f(public,)j(calls) e(c)o(hange)s 14 2 v 13 w(access)s 14 2 v 14 w(con)o(trol)s 14 2 v 13 w(mo)q (de)f(to)g(mak)o(e)251 1746 y(V)f(protected.)151 1840 y(Preconditions:)193 1934 y(1.)22 b fj(\030)p fl(mem)o(b)q(erNamed\(get)s 14 2 v 14 w fk(<)12 b (V)23 b(>)15 b fl(con)o(tainingClass\(V\)\))g fj(^)251 1990 y(\030)p fl(mem)o (b)q(erNamed\(set)s 14 2 v 14 w fk(<)e(V)22 b(>)15 b fl(con)o(tainingClass\(V\ \)\))h fj(^)251 2047 y(\030)p fl(mem)o(b)q(erNamed\(address)s 14 2 v 14 w(of) s 14 2 v 13 w fk(<)d(V)22 b(>)16 b fl(con)o(tainingClass\(V\)\).)251 2103 y (\(access)f(to)g(the)g(v)m(ariable)i(has)e(not)f(already)i(b)q(een)g(abstract\ ed\))151 2197 y(F)l(or)j(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(func\ tion:)29 b(preconditions)22 b(one)d(through)h(four)f(are)g(satis\014ed)h(b)o (y)g(precondi-)151 2253 y(tion)d(one)f(of)g(this)h(refactoring;)f(preconditio\ n)i(\014v)o(e)f(is)f(satis\014ed)h(b)q(ecause)h(the)e(new)h(functions)g(only) 151 2310 y(con)o(tain)f(a)g(reference)h(to)e(V,)h(whic)o(h)h(remains)f(visibl\ e)j(within)e(its)f(class.)23 b(F)l(or)15 b(the)i(refactoring)e(con-)151 2366 y (v)o(ert)s 14 2 v 13 w(v)m(ariable)s 14 2 v 15 w(references)s 14 2 v 14 w(to) s 14 2 v 13 w(function)s 14 2 v 14 w(calls:)31 b(precondition)22 b(one)e(is)h (satis\014ed)g(b)o(y)f(the)h(functions)151 2423 y(w)o(ere)16 b(created)h(in)g (the)g(prior)g(step.)23 b(F)l(or)16 b(c)o(hange)s 14 2 v 14 w(access)s 14 2 v 13 w(con)o(trol)s 14 2 v 13 w(mo)q(de:)23 b(since)18 b(this)f(refactoring)f (is)37 2504 y 750 2 v 74 2531 a fu(11)107 2547 y fp(This)f(refactoring)g(c)o (hanges)h(the)f(relativ)o(e)h(ph)o(ysical)h(p)q(osition)f(of)f(v)n(ariables)h (within)g(instances)g(of)f(the)f(class.)23 b(Programs)37 2592 y(that)14 b(tes\ t)e(the)h(ph)o(ysical)j(p)q(ositions)f(of)e(v)n(ariables)i(could)f(see)f(thei\ r)h(b)q(eha)o(vior)h(c)o(hange)e(\(see)g(the)g(discussion)j(in)e(section)g (4.1.2\).)952 2760 y fl(52)g eop bop 151 42 a fl(only)18 b(called)g(if)g(V)f (is)h(public,)h(preconditions)g(one)e(and)g(t)o(w)o(o)f(are)h(trivially)i(sat\ is\014ed;)f(precondition)151 98 y(three)g(is)g(satis\014ed)h(b)q(ecause)f(aft\ er)f(the)h(prior)g(step,)g(the)g(only)g(reference)h(to)e(the)h(v)m(ariable)h (is)f(from)151 154 y(functions)e(de\014ned)h(in)f(the)f(class.)151 227 y(This) d(refactoring)f(is)h(constructed)f(using)h(b)q(eha)o(vior)g(preserving)g(refa\ ctorings)e(and,)i(since)h(it)e(satis\014es)151 283 y(the)k(preconditions)i (of)e(those)g(refactorings,)f(b)q(eha)o(vior)i(is)g(preserv)o(ed.)37 372 y fh (B.)23 b fi(c)n(onvert)s 14 2 v 13 w(c)n(o)n(de)s 14 2 v 13 w(se)n(gment)s 14 2 v 13 w(to)s 14 2 v 14 w(function)151 444 y fl(De\014ne)18 b(a)f(new)g(mem)o (b)q(er)h(function,)g(with)g(a)f(unique)h(name,)g(whose)f(function)h(b)q(o)q (dy)g(is)g(equiv)m(alen)o(t)151 501 y(to)g(a)h(statemen)o(t)e(list)j(of)e(an) h(existing)g(mem)o(b)q(er)g(function.)31 b(Replace)21 b(that)d(statemen)o(t)f (list)j(in)f(the)151 557 y(existing)d(mem)o(b)q(er)g(function)g(with)f(a)g (call)h(to)f(the)g(new)h(mem)o(b)q(er)f(function.)151 629 y(Argumen)o(ts:)20 b (setOf\(statemen)o(t\))13 b(statemen)o(tList.)151 702 y(After)i(c)o(hec)o(kin\ g)h(its)f(precondition,)i(this)e(refactoring:)193 790 y(1.)22 b(constructs)14 b(an)g(argumen)o(t)g(list)h(for)e(the)h(new)h(mem)o(b)q(er)f(function.)21 b (The)14 b(argumen)o(t)f(consists)i(of)251 847 y(v)m(ariables)g(lo)q(cal)g(to) f(con)o(tainingF)l(unction\(statemen)o(tList\))g(that)f(are)h(referenced)h (or)e(mo)q(di\014ed)251 903 y(b)o(y)f(statemen)o(tList,)g(but)f(whic)o(h)i (are)f(declared)h(within)g(statemen)o(tList.)18 b(V)l(ariables)13 b(mo)q(di\ \014ed)g(is)251 960 y(statemen)o(tList)i(will)i(b)q(e)f(passed-b)o(y-referenc\ ed;)g(other)f(v)m(ariables)h(will)h(b)q(e)f(passed-b)o(y-v)m(alue.)251 1022 y (Then,)j(calls)h(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(function)f (to)f(create)g(the)g(new)h(mem)o(b)q(er)f(function.)30 b(The)18 b(new)251 1078 y(function)e(is)g(giv)o(en)g(a)e(unique)j(name.)193 1146 y(2.)22 b(calls)g (replace)s 14 2 v 15 w(statemen)o(t)s 14 2 v 12 w(list)s 14 2 v 14 w(with)s 14 2 v 14 w(function)s 14 2 v 14 w(call)g(to)f(replace)h(the)f(statemen)o(t)f (list)h(with)h(a)251 1202 y(call)16 b(to)f(the)g(newly)h(created)g(function.) 151 1291 y(Preconditions:)193 1379 y(1.)22 b(con)o(v)o(ertibleT)l(oF)l(unctio\ nP\(statemen)o(tList\).)251 1435 y(\(statemen)o(tList)15 b(is)g(con)o(v)o(ert\ ible)h(to)f(a)g(legal)h(function\))151 1524 y(F)l(or)21 b(create)s 14 2 v 13 w (mem)o(b)q(er)s 14 2 v 14 w(function:)32 b(preconditions)23 b(one)f(through)e (four)h(are)g(satis\014ed)h(b)q(ecause)g(the)151 1580 y(function)12 b(is)g (giv)o(en)g(a)g(unique)h(name;)f(precondition)h(\014v)o(e)f(is)g(satis\014ed) g(b)q(ecause)g(the)g(new)f(function)i(has)151 1637 y(the)f(same)g(access)g (to)f(global)h(and)g(mem)o(b)q(er)g(v)m(ariables)h(and)f(functions)h(as)e(the) h(old)h(function,)g(and)f(an)o(y)151 1693 y(v)m(ariables)g(lo)q(cal)g(to)d (the)i(old)g(function)g(but)g(not)f(de\014ned)i(in)f(statemen)o(tList)f(are)g (passed)h(as)f(argumen)o(ts)151 1750 y(to)18 b(the)h(new)g(function.)32 b(F)l (or)19 b(replace)s 14 2 v 14 w(statemen)o(t)s 14 2 v 12 w(list)s 14 2 v 14 w (with)s 14 2 v 14 w(function)s 14 2 v 14 w(call,)i(precondition)f(one)g(b)o (y)151 1806 y(the)e(results)h(of)e(the)h(prior)g(step;)h(precondition)h(t)o (w)o(o)d(is)h(satis\014ed)h(b)q(ecause,)g(b)o(y)f(construction,)g(the)151 1862 y(new)e(function)g(is)f(equiv)m(alen)o(t)i(to)e(the)g(statemen)o(t)f(list)i (it)g(replaces.)151 1935 y(This)c(refactoring)f(is)h(constructed)f(using)h (b)q(eha)o(vior)g(preserving)g(refactorings)e(and,)i(since)h(it)e(satis\014es) 151 1991 y(the)k(preconditions)i(of)e(those)g(refactorings,)f(b)q(eha)o(vior) i(is)g(preserv)o(ed.)37 2080 y fh(C.)22 b fi(move)s 14 2 v 14 w(class)151 2152 y fl(Mo)o(v)o(e)14 b(a)h(class)h(\(c)o(hange)f(its)g(sup)q(erclass\).)151 2225 y(Argumen)o(ts:)20 b(class)15 b(C,)g(class)g(newSup)q(erclass.)151 2297 y(Aft\ er)g(c)o(hec)o(king)h(the)f(preconditions,)i(this)e(refactoring:)193 2392 y (1.)22 b(determines)14 b(the)g(set)f(of)g(inherited)i(mem)o(b)q(ers)e(that)g (w)o(ould)g(not)g(b)q(e)h(\(iden)o(tically\))h(inherited)h(b)o(y)251 2449 y (C)f(\(from)f(newSup)q(erclass)j(or)e(one)g(of)g(its)g(sup)q(erclasses\))h (at)f(its)g(new)h(lo)q(cation)1618 2432 y fs(12)1656 2449 y fl(;)f(then:)37 2522 y 750 2 v 74 2548 a fu(12)107 2564 y fp(The)f(curren)o(t)h(sub)q(class)i (of)d(C)g(could)i(share)f(a)g(common)g(sup)q(erclass)i(with)e(newSup)q(erclas\ s;)i(these)e(classes)h(ma)o(y)e(inherit)37 2610 y(some)k(common)f(b)q(eha)o (vior)i(but)e(a)g(virtual)h(mem)o(b)q(er)g(function)g(could)g(b)q(e)f(de\014n\ ed)h(di\013eren)o(tly)h(in)f(those)f(classes.)30 b(Or,)17 b(the)952 2760 y fl (53)g eop bop 255 42 a fl(\(a\))22 b(for)17 b(eac)o(h)g(mem)o(b)q(er)g(functi\ on)h(in)g(the)g(set,)f(calls)h(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w (function)g(to)e(cop)o(y)h(the)336 98 y(function)f(in)o(to)f(C)253 163 y(\(b\ \))22 b(for)15 b(eac)o(h)g(mem)o(b)q(er)g(v)m(ariable)i(in)f(the)f(set:)365 227 y(i.)23 b(if)g(the)g(v)m(ariable)h(is)f(de\014ned)h(in)f(an)o(y)g(curren) o(t)f(sub)q(class)i(of)e(newSup)q(erclass,)j(calls)413 284 y(mo)o(v)o(e)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)s 14 2 v 14 w(to)s 14 2 v 13 w (sup)q(erclass)14 b(to)f(mo)o(v)o(e)f(the)h(v)m(ariable)i(to)d(newSup)q(ercla\ ss.)353 349 y(ii.)23 b(otherwise)12 b(if)h(the)f(v)m(ariable)h(is)f(not)g(alr\ eady)g(a)f(lo)q(cal)i(or)e(inherited)j(mem)o(b)q(er)e(of)g(newSu-)413 405 y (p)q(erclass,)j(calls)f(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(v)m (ariable)h(to)e(add)h(the)f(v)m(ariable)i(to)e(newSup)q(erclass.)193 478 y (2.)22 b(calls)16 b(the)g(refactoring)e(c)o(hange)s 14 2 v 14 w(sup)q(erclass) i(to)f(c)o(hange)g(the)g(sup)q(erclass)i(of)d(C.)151 584 y(Preconditions:)193 678 y(1.)22 b fj(8)16 b fl(mem)o(b)q(er)f fj(2)g fl(\(mem)o(b)q(ersOf\(C\):) 255 751 y(\(a\))22 b(if)16 b(mem)o(b)q(er)f(is)h(a)f(v)m(ariable)h fj(^)411 808 y(9)g fl(V)l(ar)f fj(2)g fl(mem)o(b)q(erV)l(ariablesOf\(newSup)q(erclass\ \))j fj(^)411 864 y fl(mem)o(b)q(er.name)d(=)h(V)l(ar.name,)486 921 y(matc)o (hingA)o(ttributesP\(mem)o(b)q(er,)f(V)l(ar\).)253 985 y(\(b\))22 b(if)16 b (mem)o(b)q(er)f(is)h(a)f(function)h fj(^)411 1042 y(9)g fl(F)l(unc)f fj(2)h fl (mem)o(b)q(erF)l(unctionsOf\(newSup)q(erclass\))h fj(^)411 1098 y fl(mem)o (b)q(er.name)e(=)h(F)l(unc.name,)486 1155 y(matc)o(hingSignatureP\(mem)o(b)q (er,)f(F)l(unc\).)336 1211 y(\(attributes)j(of)g(mem)o(b)q(er)h(v)m(ariables) h(and)e(signatures)h(of)f(mem)o(b)q(er)h(functions)g(in)g(C)g(will)336 1268 y (matc)o(h)c(with)g(its)h(sup)q(erclasses.\))193 1341 y(2.)22 b(if)16 b(v)m (ariables)g(needed)h(in)f(the)f(new)h(sup)q(erclass)g(are)f(already)h(de\014n\ ed)g(in)g(its)g(sub)q(classes,)g(those)251 1397 y(v)m(ariables)h(are)e(de\014\ ned)h(iden)o(tically)i(in)e(the)f(sub)q(classes)193 1470 y(3.)22 b fj(8)16 b fl(sub)q(classInstance)g fj(2)g fl(instancesOf\(C\),)326 1527 y fj(8)g fl(V)l (ar)f fj(2)g fl(v)m(ariablesAssigned\(sub)q(cl)q(assInstance\),)401 1583 y (V)l(ar.t)o(yp)q(e)g fj(2)g fl(\(C)g fj([)g fl(newSup)q(erclass)476 1640 y fj ([)h fl(sup)q(erclassesOf\(newSup)q(erclass\)\).)251 1696 y(\(eac)o(h)f(assig\ nmen)o(t)g fi(of)h fl(an)f(instance)h(of)e(the)i(class)f(b)q(eing)i(mo)o(v)o (ed)d(w)o(ould)i(remain)g(t)o(yp)q(e)f(safe\).)151 1790 y(F)l(or)h(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(function:)24 b(preconditions)19 b(one)e (and)g(four)g(are)f(satis\014ed)i(b)q(ecause)g(the)f(refac-)151 1846 y(toring) e(is)h(only)g(in)o(v)o(ok)o(ed)g(if)f(it)h(is)g(not)f(already)g(lo)q(cally)j (de\014ned)e(or)f(inherited;)i(precondition)g(t)o(w)o(o)d(is)151 1903 y(satis\ \014ed)f(b)o(y)f(precondition)i(one)e(of)g(this)g(refactoring;)h(precondition) h(three)e(is)g(satis\014ed)h(b)q(ecause)g(the)151 1959 y(class)19 b(is)g(mo)o (v)o(ed)e(along)i(with)f(its)h(sup)q(erclasses;)h(precondition)g(\014v)o(e)e (is)h(satis\014ed)g(b)o(y)f(construction)151 2016 y(-)f(this)g(refactoring)f (ensures)h(that)e(all)j(referenced)f(v)m(ariables)h(and)f(functions)g(are)f (visible)j(after)c(the)151 2072 y(mo)o(v)o(e.)151 2147 y(F)l(or)21 b(mo)o(v)o (e)s 14 2 v 12 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)s 14 2 v 15 w(to)s 14 2 v 12 w(sup)q(erclass:)33 b(precondition)23 b(one)e(is)h(satis\014ed)g(b)o (y)f(precondition)151 2204 y(t)o(w)o(o)e(of)h(this)g(refactoring;)i(precondit\ ion)g(t)o(w)o(o)d(is)i(satis\014ed)f(b)o(y)g(this)h(refactoring)f(is)g(not)g (in)o(v)o(ok)o(ed)151 2260 y(when)c(the)f(v)m(ariable)i(is)e(already)h(de\014\ ned)g(in)g(or)f(inherited)i(b)o(y)e(the)h(sup)q(erclass.)151 2335 y(F)l(or)11 b(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable:)20 b(this)11 b (refactoring)g(is)g(only)h(in)o(v)o(ok)o(ed)f(if)h(the)f(v)m(ariable)h(do)q (es)g(not)e(collide)151 2392 y(with)16 b(an)f(existing)h(v)m(ariable,)g(th)o (us)f(satisfying)h(precondition)g(one.)37 2473 y 750 2 v 37 2516 a fp(curren) o(t)f(and)g(new)f(sup)q(erclasses)j(ma)o(y)d(not)h(share)f(a)h(common)g(sup)q (erclass)h(and)f(all)g(inherited)i(b)q(eha)o(vior)f(w)o(ould)f(need)g(to)f (b)q(e)37 2561 y(copied.)952 2760 y fl(54)g eop bop 151 42 a fl(F)l(or)18 b (c)o(hange)s 14 2 v 13 w(sup)q(erclass:)27 b(precondition)20 b(one)f(is)g(sat\ is\014ed)f(b)o(y)h(precondition)h(three)e(of)g(this)h(refac-)151 98 y(toring;) j(precondition)g(is)e(satis\014ed)h(b)o(y)f(the)g(results)g(of)g(the)g(prior) g(steps;)i(precondition)g(three)e(is)151 154 y(satis\014ed)c(b)o(y)f(precondi\ tion)i(one)e(of)g(this)h(refactoring.)151 230 y(This)c(refactoring)f(is)h(con\ structed)f(using)h(b)q(eha)o(vior)g(preserving)g(refactorings)e(and,)i(since) h(it)e(satis\014es)151 286 y(the)k(preconditions)i(of)e(those)g(refactorings,) f(b)q(eha)o(vior)i(is)g(preserv)o(ed.)1372 270 y fs(13)37 2521 y 750 2 v 74 2548 a fu(13)107 2564 y fp(This)c(refactoring)h(could)g(c)o(hange)g(the)f(ph) o(ysical)i(size)f(of)e(instances)j(of)e(the)g(class.)17 b(Programs)c(that)f (test)f(the)h(ph)o(ysical)j(size)37 2610 y(of)e(ob)r(jects)h(could)g(see)f (their)h(b)q(eha)o(vior)h(c)o(hange)f(\(see)f(the)g(discussion)j(in)e(section) g(4.1.2\).)952 2760 y fl(55)g eop bop 37 353 a fc(Chapter)35 b(6)37 560 y fb (Refactoring)42 b(T)-10 b(o)40 b(Generalize:)37 685 y(Creating)i(an)d(Abstrac\ t)g(Sup)s(erclass)37 907 y fl(This)16 b(c)o(hapter)e(fo)q(cuses)i(on)e(creati\ ng)h(an)g(abstract)f(sup)q(erclass)i(that)e(captures)g(the)h(b)q(eha)o(vior)h (common)e(to)37 964 y(t)o(w)o(o)g(classes.)21 b(It)15 b(can)g(b)q(e)h(general\ ized)h(to)e(w)o(ork)f(with)h(an)o(y)g(n)o(um)o(b)q(er)h(of)f(classes.)108 1020 y(Casais)c([30)o(])g(and)g(Bergstein)h([15)o(])f(note)g(that)f(a)h(useful)h (b)q(eha)o(vior)g(preserving)g(program)e(transformation)37 1077 y(is)15 b(to) e(mo)o(v)o(e)g(a)g(function)h(or)g(v)m(ariable)h(to)e(a)g(common)g(sup)q(ercl\ ass)i(from)e(sub)q(classes)i(where)f(it)g(is)g(iden)o(tically)37 1133 y(de\ \014ned.)22 b(Ho)o(w)o(ev)o(er,)14 b(as)h(this)h(c)o(hapter)f(describ)q(es)i (de\014ning)g(an)e(abstract)f(sup)q(erclass)j(in)o(v)o(olv)o(es)f(more)f(than) 37 1190 y(just)e(mo)o(ving)g(up)h(iden)o(tically)h(de\014ned)g(mem)o(b)q(ers.) k(The)14 b(imp)q(ortan)o(t)e(\(and)h(complex\))h(parts)e(of)h(the)g(pro)q(ces\ s)37 1246 y(come)j(in)h(\014nding)f(the)g(common)f(abstraction)h(that)e(is)j (often)e(hidden)i(b)q(ehind)h(di\013ering)e(v)o(o)q(cabulary)l(,)g(and)37 1303 y(ac)o(hieving)h(compatibilit)o(y)g(b)q(et)o(w)o(een)e(the)h(sub)q(class)g (implemen)o(tations.)1284 1286 y fs(1)108 1359 y fl(When)c(capturing)g(the)g (abstraction)f(common)h(to)f(t)o(w)o(o)f(classes,)j(one)f(cannot)f(exp)q(ect) i(that)e(the)h(similari-)37 1416 y(ties)i(will)g(already)f(b)q(e)g(ob)o(vious\ ,)g(con)o(v)o(enien)o(tly)h(separated)e(from)g(the)h(di\013erences,)h(and)f (de\014ned)h(iden)o(tically)37 1472 y(in)22 b(b)q(oth)f(sub)q(classes.)38 b (In)22 b(general,)g(ac)o(hieving)g(compatibilit)o(y)g(b)q(et)o(w)o(een)g(the) e(sub)q(classes)j(ma)o(y)d(require)37 1528 y(c)o(hanging)f(mem)o(b)q(er)e(nam\ es)h(and)f(other)h(attributes,)f(and)h(splitting)h(function)f(b)q(o)q(dies,)i (b)q(efore)d(mem)o(b)q(ers)37 1585 y(can)f(b)q(e)g(mo)o(v)o(ed)e(up)i(to)f (the)g(sup)q(erclass.)108 1641 y(T)l(o)i(illustrate)h(some)f(of)g(the)h(compl\ exities,)h(recall)f(the)g(example)g(describ)q(ed)h(in)f(section)g(3.2)e(for)h (cre-)37 1698 y(ating)i(the)g(abstract)f(sup)q(erclass)i ff(Ino)q(de)p fl(,)h (that)d(captured)h(the)g(abstraction)f(common)h(to)f(the)h ff(BSDIno)q(de)37 1754 y fl(and)e ff(SystemVIno)q(de)f fl(classes.)24 b(The)16 b(common)g(abstr\ action)g(w)o(as)g(con)o(tained)h(in)g(functions)g(that)f(w)o(ere)g fi(not)37 1811 y fl(iden)o(tically)k(de\014ned)e(in)g(the)g(t)o(w)o(o)d(classes)j(b)q (efore)f(the)g(refactoring)g(w)o(as)f(p)q(erformed.)26 b(In)18 b(particular,) f(the)37 1867 y(implemen)o(tations)i(of)e(the)h fi(mapUnit)f fl(function)h (w)o(ere)f(sligh)o(tly)i(di\013eren)o(t)f(due)g(to)e(di\013erences)j(in)f(the) g(t)o(w)o(o)37 1924 y(\014le)f(formats.)108 1980 y(As)d(sho)o(wn)g(b)q(elo)o (w)h(in)h(Figure)e(6.1,)g(most)f(but)i(not)f(all)h(of)f(the)g(co)q(de)h(for)f (the)h fi(mapUnit)f fl(function)h(in)g(the)37 2037 y ff(SystemVIno)q(de)j fl (class)g(w)o(as)f(the)g(same)h(as)f(for)g(the)h fi(mapUnit)g fl(function)g (de\014ned)h(in)g(the)f ff(BSDIno)q(de)g fl(class.)37 2093 y(Ho)o(w)o(ev)o (er,)13 b(the)h(co)q(de)g(for)g(getting)f(and)h(setting)g(a)f(logical)i(blo)q (c)o(k)g(n)o(um)o(b)q(er)f(w)o(as)f(di\013eren)o(t)h(b)q(et)o(w)o(een)g(the)g (t)o(w)o(o)37 2149 y(\014le)j(system)d(formats.)108 2206 y(The)f(implemen)o (tations)i(of)e(the)g fi(mapUnit)g fl(function)h(in)g(eac)o(h)f(sub)q(class)h (needed)h(to)d(matc)o(h)h(b)q(efore)g(they)37 2262 y(could)22 b(b)q(e)f(repla\ ced)g(b)o(y)f(a)g(commonly)h(inherited)h(function)f(in)g(the)f(sup)q(erclass.) 36 b(T)l(o)20 b(handle)i(this,)f(the)37 2319 y(co)q(de)f(that)d(di\013ered)j (b)q(et)o(w)o(een)f(the)f(t)o(w)o(o)f(implemen)o(tations)j(w)o(as)e(placed)h (in)o(to)g(new)g(functions)g fi(getDir)n(e)n(ct)37 2375 y fl(and)g fi(setDir) n(e)n(ct)e fl(whic)o(h)i(w)o(ere)f(added)h(to)f(the)g(sub)q(classes.)30 b(The\ n,)19 b(in)g(b)q(oth)f(de\014nitions)i(of)e(the)g fi(mapUnit)37 2456 y 750 2 v 89 2483 a fu(1)107 2499 y fp(Casais)d([31])e(similarly)18 b(observ)o(es)d(tha\ t)f(renamings)i(and)f(other)g(attribute)g(re\014nemen)o(ts)g(are)g(sometimes) g(needed)g(b)q(efore)37 2545 y(functions)g(and)f(v)n(ariables)h(are)e(migrate\ d)h(to)f(an)h(abstract)f(sup)q(erclass.)952 2760 y fl(56)g eop bop 96 0 a 27759903 25589105 5788794 19602964 33548697 45192069 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Helvetica-Bold Courier-Bold %%Pages: 1 %%BoundingBox: 88 298 510 687 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 0 58.5542 ] concat Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -23.8554 0 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 485 707 ] concat %I [ (AFTER:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 477.084 153.313 ] concat %I 158 461 158 461 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 437.084 685.313 ] concat %I [ (Inode) () ( Protected:) () ( virtual int getDirect\(\)) ( virtual void setDirect\(..\)) ( int mapUnit\(...\) {) ( *) ( index = getDirect\(\)) ( *) ( setDirect\(index\)) ( * }) () (BSDInode \(and SystemVInode\)) () ( Protected:) () ( int getDirect\(\) {...}) ( void setDirect\(..\) {...}) () ] Text End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 341.843 797.072 ] concat %I [ (Inode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.707107 -0.707107 0.707107 0.707107 -208.265 465.137 ] concat %I 167 613 167 575 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 290.843 747.072 ] concat %I [ (BSDInode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ -0.733281 -0.679925 0.679926 -0.733281 121.425 1314.19 ] concat %I 167 613 167 575 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 376.843 747.072 ] concat %I [ (SystemVInode) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 190.843 168.072 ] concat %I 46 633 46 633 Line End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 13.0121 -1.08432 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 141 709 ] concat %I [ (BEFORE:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 100.253 686.145 ] concat %I [ (BSDInode) () ( Protected:) () ( int mapUnit\(...\) {) ( *) ( code to get) ( physical block #) ( \(BSD specific\)) ( *) ( code to set) ( physical block #) ( \(BSD specific\)) ( * } ) () () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 98.4096 507.554 ] concat %I [ (SystemVInode) () ( Protected:) () ( int mapUnit\(...\) {) ( *) ( code to get) ( physical block #) ( \(SystemV specific\)) ( *) ( code to set) ( physical block #) ( \(SystemV specific\)) ( * } ) () () ] Text End End %I eop End %I eop End %I eop showpage %%Trailer end endTexFig 492 1749 a fh(Figure)18 b(6.1)p fl(:)i(Refactoring)15 b(The)g (F)l(unction)i fi(mapUnit)37 1882 y fl(function,)e(the)f(di\013ering)g(co)q (de)g(w)o(as)f(replaced)i(b)o(y)e(calls)i(to)e(these)h(functions.)20 b(Once) 14 b(the)g(de\014nitions)h(of)e(the)37 1939 y fi(mapUnit)j fl(function)g(in)g (b)q(oth)f(sub)q(classes)h(matc)o(hed,)f(the)g(function)h(w)o(as)f(mo)o(v)o (ed)g(to)f(the)h(sup)q(erclass.)108 1995 y(In)h(general,)g(the)f(pro)q(cess)h (of)e(de\014ning)j(an)f(abstract)e(sup)q(erclass)i(\014rst)f(in)o(v)o(olv)o (es)h(creating)g(a)f(new)g(class)37 2052 y(and)h(mo)o(ving)g(the)g(t)o(w)o (o)e(existing)j(classes)f(under)h(it.)k(Then,)16 b(capturing)g(the)g(common)g (abstraction)f(in)h(the)37 2108 y(sup)q(erclass)h(is)e(an)h(iterativ)o(e)f (pro)q(cess)g(that)g(ma)o(y)f(in)o(v)o(olv)o(e)i(the)g(follo)o(wing)f(steps:) 106 2214 y fj(\017)22 b fl(making)15 b(function)i(signatures)e(compatible)h (in)g(b)q(oth)f(sub)q(classes)106 2308 y fj(\017)22 b fl(adding)16 b(function) g(signatures)f(to)g(the)g(sup)q(erclass)i(proto)q(col)106 2402 y fj(\017)22 b fl(making)16 b(functions)g(b)q(o)q(dies)g(\(and)g(the)f(v)m(ariables)i(refere\ nced)f(b)o(y)f(them\))g(compatible)h(in)g(b)q(oth)g(sub-)151 2458 y(classes) 106 2552 y fj(\017)22 b fl(migrating)15 b(common)g(co)q(de)h(and)f(v)m(ariabl\ es)i(to)d(the)i(sup)q(erclass.)952 2760 y(57)g eop bop 108 42 a fl(Eac)o(h)13 b(of)g(these)h(steps)f(is)h(describ)q(ed)h(in)f(this)g(c)o(hapter.)19 b(The) 13 b(c)o(hapter)h(closes)f(with)h(a)f(discussion)i(of)e(ho)o(w)37 98 y(in)o (teraction)j(with)g(the)f(designer)h(migh)o(t)f(b)q(e)h(reduced,)g(and)f(othe\ r)g(issues.)108 154 y(Casais)k([31)o(])f(deals)i(with)f(sev)o(eral)g(of)g(the) g(issues)h(discussed)g(in)g(this)f(c)o(hapter:)28 b(renamings,)19 b(re\014nin\ g)37 211 y(function)d(signatures)f(and)g(v)m(ariable)h(attributes,)e(and)h (mo)o(ving)f(mem)o(b)q(ers.)20 b(One)15 b(imp)q(ortan)o(t)f(step)h(de\014ned) 37 267 y(here)i(that)e(is)h(not)f(addressed)h(b)o(y)g(Casais)f([31)o(])g(is)i (ho)o(w)e(to)g(separate)g(out)g(the)h(di\013erences)h(b)q(et)o(w)o(een)f(corr\ e-)37 324 y(sp)q(onding)h(functions)g(de\014ned)g(in)f(b)q(oth)g(sub)q(classe\ s,)g(making)g(them)g(matc)o(h,)e(b)q(efore)i(migrating)g(common)37 380 y(co)q (de)i(to)f(the)g(sup)q(erclass.)26 b(That)17 b(step)g(closely)h(relates)f(wit\ h)g(the)h(other)e(steps)h(de\014ned)i(in)f(this)f(c)o(hapter.)37 437 y(There) 22 b(are)e(other)h(w)o(a)o(ys)f(in)i(whic)o(h)g(this)f(w)o(ork)f(is)i(di\013e\ ren)o(t)f(from)f([31)o(]:)32 b(it)21 b(pro)o(vides)g(some)g(heuristics)37 493 y(for)c(detecting)i(structural)e(similarities,)j(includes)g(access)e(con)o (trol)f(mo)q(de)h(as)f(an)h(attribute)f(that)g(can)h(b)q(e)37 550 y(re\014ned\ ,)e(and)g(discusses)g(some)f(of)g(the)g(tradeo\013s)f(in)o(v)o(olving)i(user/\ to)q(ol)f(in)o(teraction.)108 606 y(Before)c(a)f(function)h(signature)g(or)f (v)m(ariable)i(can)f(b)q(e)g(added)h(to)e(the)g(sup)q(erclass,)j(it)d(m)o(ust) h(\014rst)f(b)q(e)h(de\014ned)37 663 y(compatibly)i(in)g(the)f(sub)q(classes.) 20 b(Compatibilit)o(y)13 b(is)f(de\014ned)h(di\013eren)o(tly)g(for)e(the)h (v)m(arious)g(ob)s(ject-orien)o(ted)37 719 y(languages)k(and)f(programming)g (st)o(yles.)20 b(The)15 b(refactorings)g(de\014ned)h(in)g(this)g(c)o(hapter)f (require)h(that:)106 803 y fj(\017)22 b fl(for)d(function)h(signatures)f(to)g (b)q(e)g(compatible)i(the)e(names,)h(argumen)o(t)e(t)o(yp)q(es,)i(return)f (t)o(yp)q(es)g(and)151 860 y(access)c(con)o(trol)g(mo)q(des)h(m)o(ust)e(matc) o(h)106 950 y fj(\017)22 b fl(for)13 b(v)m(ariables)h(to)f(b)q(e)h(compatible) g(the)g(names,)f(t)o(yp)q(es)g(and)g(\(for)g(mem)o(b)q(er)g(v)m(ariables\))h (access)g(con)o(trol)151 1006 y(mo)q(des)i(m)o(ust)e(matc)o(h.)108 1090 y(F)l (or)e(eac)o(h)h(of)g(the)f(refactorings)h(describ)q(ed)i(in)e(this)g(and)g (the)g(follo)o(wing)h(t)o(w)o(o)d(c)o(hapters,)i(the)g(description)37 1147 y (of)22 b(the)h(refactoring)f(is)g(follo)o(w)o(ed)h(b)o(y)f(sections)h(that)f (detail)h(its)g(preconditions)g(and)g(argue)f(that)f(it)i(is)37 1203 y(b)q (eha)o(vior)18 b(preserving.)26 b(As)17 b(with)g(the)g(lo)o(w-lev)o(el)i(refa\ ctorings)d(de\014ned)j(in)f(the)f(previous)g(c)o(hapter,)g(these)37 1259 y (sections)e(\(included)h(for)d(completeness\))h(pro)o(vide)g(a)g(lev)o(el)h (of)e(detail)h(b)q(ey)o(ond)h(what)e(ma)o(y)g(b)q(e)h(of)f(in)o(terest)h(to) 37 1316 y(some)h(readers.)20 b(These)c(sections)f(can)h(b)q(e)g(skipp)q(ed)h (without)e(missing)h(the)f(in)o(ten)o(t)g(of)g(the)g(refactorings.)37 1457 y fd(6.1)70 b(Creating)22 b(a)i(Common)e(Sup)r(erclass)37 1559 y fl(The)15 b (\014rst)e(imp)q(ortan)o(t)h(step)g(in)h(this)f(pro)q(cess)h(\(b)q(efore)f (dealing)h(with)f(function)h(signatures,)f(common)g(co)q(de)37 1615 y(and)i (v)m(ariables\))g(is)f(to)f(create)h(the)g(new)g(abstract)f(sup)q(erclass.)21 b(It)15 b(is)h(assumed)f(here)g(that)f(the)h(t)o(w)o(o)f(classes)37 1672 y (that)j(share)g(a)g(common)g(abstraction)g(ha)o(v)o(e)g(already)h(b)q(een)g (selected)h(b)o(y)e(the)g(designer)1580 1655 y fs(2)1618 1672 y fl(and)h(are) f fi(sibling)37 1728 y fl(classes;)e(that)e(is,)h(they)g(either)g(share)g(a)f (common)h(direct)g(sup)q(erclass)h(or)e(eac)o(h)h(class)g(is)g(the)g(top)f (most)g(class)37 1785 y(in)h(its)f(inheritance)h(hierarc)o(h)o(y)l(.)20 b(If) 13 b(the)g(t)o(w)o(o)e(classes)i(are)g(not)f(sibling)j(classes,)e(the)g fi (move)s 14 2 v 14 w(class)e fl(refactoring,)37 1841 y(describ)q(ed)18 b(in)e (c)o(hapter)f(\014v)o(e,)g(can)g(b)q(e)h(applied)h(to)d(mo)o(v)o(e)h(one)g (or)g(b)q(oth)g(of)g(the)g(classes.)37 1934 y(The)h(argumen)o(ts)e(to)h(this) g(refactoring)g(are:)106 2026 y fj(\017)22 b fl(string)15 b(absSup)q(erclassN\ ame)106 2116 y fj(\017)22 b fl(class)16 b(C1,)e(C2.)37 2209 y(After)h(c)o(hec) o(king)h(its)g(preconditions,)g(this)g(refactoring:)93 2302 y(1.)22 b(calls)d (the)e(create)s 14 2 v 13 w(empt)o(y)s 14 2 v 14 w(class)g(refactoring)g(to)g (create)h(the)f(new)h(sup)q(erclass,)h(as)e(a)g(sibling)i(of)e(the)151 2358 y (t)o(w)o(o)d(curren)o(t)h(classes.)93 2448 y(2.)22 b(calls)16 b(the)g(mo)o (v)o(e)s 14 2 v 12 w(class)g(refactoring)f(to)f(mo)o(v)o(e)h(the)g(t)o(w)o (o)f(classes)h(under)h(it.)37 2522 y 750 2 v 89 2548 a fu(2)107 2564 y fp(Sec\ tion)e(6.8.2)e(discusses)j(issues)f(in)o(v)o(olv)o(ed)h(in)e(automatically)j (selecting)e(t)o(w)o(o)f(classes)h(with)f(common)g(attributes)h(from)e(a)37 2610 y(set)h(of)g(classes.)952 2760 y fl(58)g eop bop 37 42 a fe(6.1.1)56 b (Preconditions)37 127 y fl(The)16 b(preconditions)h(for)d(this)i(refactoring) f(are:)93 220 y(1.)22 b fj(8)16 b fl(class)f fj(2)h fl(Program.classes,)226 277 y(class.name)f fj(6)p fl(=)h(absSup)q(erclassName.)151 333 y(\(absSup)q (erclassName)g(do)q(es)g(not)f(clash)g(with)h(the)f(name)g(of)g(an)g(existing) i(class\))93 423 y(2.)22 b(C1.sup)q(erclass)16 b(=)f(C2.sup)q(erclass)151 480 y(\(the)g(t)o(w)o(o)f(classes)i(share)f(a)g(common)f(sup)q(erclass\).)37 600 y fe(6.1.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 685 y fl(F)l(or)13 b(create) s 14 2 v 13 w(empt)o(y)s 14 2 v 13 w(class,)g(precondition)i(1)d(\(the)h(name) g(of)f(the)h(new)g(class)g(do)q(esn't)g(clash)g(with)g(an)g(already)37 742 y (existing)k(class\))e(is)h(satis\014ed)f(b)o(y)h(precondition)g(1)f(of)g(this) h(refactoring.)108 798 y(F)l(or)h(mo)o(v)o(e)s 14 2 v 13 w(class:)26 b(The)18 b(preconditions)i(are)e(satis\014ed)g(b)q(ecause)h(after)e(the)i(mo)o(v)o(e)e (classes)h(S1)g(and)h(S2)37 855 y(will)f(inherited)f(the)f(same)f(mem)o(b)q (ers)h(as)f(b)q(efore)h(\(satisfying)f(precondition)j(1\),)c(no)i(mem)o(b)q (ers)f(need)i(to)e(b)q(e)37 911 y(lo)q(cally)j(added)e(to)f(the)g(classes)h (\(satisfying)g(precondition)h(2\))e(and)h(the)f(sup)q(erclasses)i(\(sub)q (classes\))f(of)f(C1)37 968 y(and)g(C2)e(prior)h(to)g(the)g(refactoring)f(wil\ l)j(con)o(tin)o(ue)f(to)e(b)q(e)i(sup)q(erclasses)g(\(sub)q(classes\))f(of)g (C1)g(and)g(C2)f(after)37 1024 y(the)j(refactoring)f(\(satisfying)g(precondit\ ion)i(3\).)108 1081 y(This)f(refactoring)f(is)g(constructed)h(using)g(b)q(eha) o(vior)g(preserving)g(refactorings)e(and,)h(since)i(it)e(satis\014es)37 1137 y (the)h(preconditions)g(of)f(those)g(refactorings,)g(b)q(eha)o(vior)g(is)h(pre\ serv)o(ed.)37 1278 y fd(6.2)70 b(Making)24 b(F)-6 b(unction)22 b(Signatures)h (Compatible)37 1380 y fl(F)l(unctions)d(b)q(elong)g(in)g(the)f(sup)q(erclass) h(proto)q(col)f(if)g(they)g(are)f(part)h(of)f(the)h(common)g(abstraction)f (rep-)37 1436 y(resen)o(ted)g(b)o(y)f(the)g(sup)q(erclass.)26 b(As)17 b(noted) g(in)h(c)o(hapter)f(one,)g(determining)h(the)f(correct)g(abstraction)f(is)i (a)37 1493 y(design)f(decision)g(that)e(cannot)g(b)q(e)h(en)o(tirely)g(automa\ ted.)k(Heuristics)d(\(suc)o(h)e(as)g(those)g(listed)i(b)q(elo)o(w\))e(can)37 1549 y(detect)h(similarities)h(b)q(et)o(w)o(een)f(classes,)f(but)g(they)h(are) f(not)f(fo)q(olpro)q(of.)108 1606 y(Tw)o(o)f(sub)q(classes)j(sharing)e(a)g (common)g(abstraction)g(ma)o(y)g(ha)o(v)o(e)f(mem)o(b)q(er)i(functions)g(that) e(are)h(similar)37 1662 y(but)i(not)f(exactly)h(the)f(same.)20 b(This)c(migh) o(t)g(b)q(e)g(exp)q(ected)g(esp)q(ecially)i(if)e(the)g(t)o(w)o(o)e(classes)i (w)o(ere)f(dev)o(elop)q(ed)37 1719 y(indep)q(endently)k(of)d(eac)o(h)g(other.) 23 b(The)16 b(name)h(of)e(the)i(function)g(in)g(one)f(class)h(ma)o(y)f(b)q (e)h(a)f(synon)o(ym)g(of)f(the)37 1775 y(function)g(de\014ned)g(in)g(the)f (other)f(class.)20 b(Or,)13 b(the)h(functions)h(ma)o(y)e(ha)o(v)o(e)g(the)h (same)f(names,)h(but)g(the)g(return)37 1831 y(t)o(yp)q(es)20 b(or)g(function) g(argumen)o(ts)f(ma)o(y)g(b)q(e)i(sligh)o(tly)g(di\013eren)o(t.)33 b(In)21 b (these)f(cases,)g(the)g(signatures)g(of)f(the)37 1888 y(mem)o(b)q(er)d(functi\ ons)g(in)g(the)f(sub)q(classes)i(need)f(to)e(b)q(e)i(c)o(hanged)g(b)q(efore)f (they)g(matc)o(h)g(with)g(eac)o(h)h(other.)108 1944 y(This)g(do)q(es)g(not)f (imply)l(,)h(ho)o(w)o(ev)o(er,)e(that)h(detecting)h(common)f(abstractions)g (m)o(ust)g(b)q(e)h(left)g(en)o(tirely)g(to)37 2001 y(the)k(user.)31 b(It)20 b (is)f(p)q(ossible)i(to)e(automatically)g(infer)h(design)g(similarities)h(from) e(structural)g(similarities,)37 2057 y(p)q(erform)13 b(some)g(primitiv)o(e)h (refactorings)e(that)g(mak)o(e)h(the)g(functions)g(more)g(structurally)g(simi\ lar,)h(and)f(add)37 2114 y(all)k(p)q(ossible)g(matc)o(hes)e(to)g(the)h(proto) q(col)f(of)h(the)f(abstract)g(class.)21 b(There)16 b(are)f(at)g(least)h(t)o (w)o(o)e(shortcomings)37 2170 y(to)h(carrying)g(automated)g(supp)q(ort)g(to)f (this)i(extreme:)93 2254 y(1.)22 b(A)11 b(to)q(ol)g(migh)o(t)g(detect)g(and)g (act)g(up)q(on)g(structural)g(matc)o(hes)g(that)f(do)h(not)f(corresp)q(ond)i (to)e(meaningful)151 2311 y(common)17 b(abstractions.)24 b(The)17 b(v)o(o)q (cabulary)g(used)g(to)f(name)h(classes)g(and)g(class)h(mem)o(b)q(ers)e(is)i (often)151 2367 y(am)o(biguous.)h(T)l(erms)12 b(suc)o(h)h(as)f(length,)h(size\ ,)h(age,)e(and)h(brigh)o(tness)f(can)h(ha)o(v)o(e)f(di\013eren)o(t)h(meanings) g(in)151 2424 y(di\013eren)o(t)g(classes,)g(and)g(v)m(ariables)i(with)e(these) g(names)f(ma)o(y)g(not)h(b)q(elong)g(in)h(a)f(common)f(abstraction)151 2480 y (ev)o(en)k(though)f(they)g(are)g(de\014ned)h(in)g(b)q(oth)g(classes.)151 2554 y(If)11 b(the)g(t)o(w)o(o)e(classes)i(that)f(share)h(a)f(common)g(abstraction) h(w)o(ere)f(dev)o(elop)q(ed)i(indep)q(enden)o(tly)m(,)i(common)151 2610 y(mem) o(b)q(ers)c(ma)o(y)g(ha)o(v)o(e)g(di\013eren)o(t)g(names.)18 b(This)11 b(sugg\ ests)e(c)o(hec)o(king)j(for)d(matc)o(hes)h(on)g(attributes)g(other)952 2760 y (59)g eop bop 151 42 a fl(than)19 b(name.)29 b(Unfortunately)l(,)20 b(mem)o (b)q(ers)e(with)h(similar)h(attributes)e(need)i(not)e(represen)o(t)g(similar) 151 98 y(abstractions.)i(F)l(or)15 b(example,)h(supp)q(ose)h(an)e(abstract)f (class)i ff(V)o(ehicle)h fl(is)f(created)f(from)g(the)g(existing)151 154 y (classes)j ff(Automobile)e fl(and)h ff(Subma)o(rine)p fl(.)24 b(Supp)q(ose)19 b(that)e(eac)o(h)g(class)h(con)o(tained)g(a)f(function)h(with)g(a)151 211 y (single,)d(in)o(teger)f(argumen)o(t.)k(These)c(functions)g(are)f(structurally) h(similar,)h(and)f(an)f(automated)f(to)q(ol)151 267 y(could)j(detect)f(this)g (similarit)o(y)l(,)h(rename)f(one)g(of)f(the)h(functions)g(and)g(de\014ne)h (a)f(common)f(function)i(in)151 324 y(the)e(sup)q(erclass.)20 b(But,)13 b(sup\ p)q(ose)g(that)f(in)i(the)f ff(Automobile)d fl(class,)k(the)e(function)i(is)f (called)h fi(changeOil)151 380 y fl(whose)e(argumen)o(t)g(is)g(the)h(n)o(um)o (b)q(er)f(of)g(quarts)g(of)g(oil)h(needed;)h(in)f(the)f ff(Subma)o(rine)e fl (class,)j(the)g(function)151 437 y(is)20 b(called)h fi(submer)n(ge)d fl(whose) i(argumen)o(t)e(is)i(the)f(depth)h(to)e(whic)o(h)i(to)f(descend.)33 b(These) 20 b(functions)151 493 y(clearly)12 b(don't)f(share)g(a)g(common)g(abstractio\ n,)g(but)h(automatically)f(matc)o(hing)g(on)h(attributes)f(w)o(on't)151 550 y (detect)16 b(this.)93 643 y(2.)22 b(Some)c(of)f(the)h(structural)f(matc)o(hes) g(ma)o(y)g(collide)j(with)e(other)f(matc)o(hes.)27 b(Supp)q(ose)19 b(a)e(func\ tion)i(in)151 700 y(one)d(class)g(ma)o(y)e(ha)o(v)o(e)i(a)f(return)g(t)o(yp)q (e)h(and)f(argumen)o(t)g(t)o(yp)q(es)h(that)f(matc)o(h)f(t)o(w)o(o)h(or)g(mor\ e)g(functions)151 756 y(in)j(the)f(other)g(class,)h(all)g(with)f(di\013eren)o (t)h(names.)25 b(In)18 b(this)g(case,)f(it)g(is)h(not)f(clear)h(whic)o(h)g (of)e(sev)o(eral)151 813 y(matc)o(hes)j(should)h(b)q(e)g(added)g(to)f(the)g (sup)q(erclass.)33 b(This)20 b(implies)i(that,)d(b)q(efore)g(selecting)i(amon\ g)151 869 y(these)16 b(p)q(ossible)h(matc)o(hes,)d(it)h(is)h(necessary)f(to)g (c)o(hec)o(k)g(ho)o(w)g(these)h(functions)g(are)e(used.)108 963 y(Th)o(us,)23 b(automating)e(the)h(detection)h(of)e(a)h(common)g(abstraction)f(is)h(p)q(oss\ ible)i(but)e(has)g(its)g(short-)37 1020 y(comings.)i(These)16 b(factors)g(sug\ gest)f(a)h(middle)i(ground,)e(where)h(a)f(refactoring)g(to)q(ol)g(displa)o (ys)h(alternativ)o(e)37 1076 y(refactorings)e(and)h(lets)f(the)g(user)h(selec\ t)g(the)f(one)g(to)g(p)q(erform,)g(as)f(sho)o(wn)h(in)h(Figure)g(6.2.)108 1132 y(In)g(a)g(m)o(ulti-windo)o(w)h(displa)o(y)g(presen)o(ted)f(to)f(the)h(user,) g(a)f(refactoring)h(to)q(ol)f(could)i(list)g(the)f(functions)37 1189 y(in)j (the)e(sup)q(erclass)h(proto)q(col,)f(and)h(list)g(the)f(functions)h(de\014ne\ d)h(in)f(eac)o(h)f(sub)q(class.)27 b(In)18 b(this)g(example,)g(a)37 1245 y (function)e(is)f(de\014ned)h(in)g(b)q(oth)e(the)h ff(Automobile)e fl(and)i ff (Subma)o(rine)d fl(classes)k(for)e(redirecting)i(the)e(v)o(ehicle.)22 b(In)37 1302 y(one)16 b(class,)g(the)g(function)g(is)h(called)g fi(shiftDir)n(e)n(cti\ on)e fl(while)i(in)f(the)g(other)f(class)i(it)e(is)i(called)g fi(r)n(e)n(dir) n(e)n(ct)p fl(.)j(The)37 1358 y(argumen)o(ts)15 b(to)f(the)i(t)o(w)o(o)e(func\ tions)h(are)g(the)h(same,)e(but)i(are)e(in)i(in)o(v)o(erted)g(order.)108 1415 y(The)k(refactoring)g(to)q(ol)g(could)i(generate)d(its)i(set)f(of)g(suggested) g(c)o(hanges)g(based)g(on)g(the)h(structural)37 1471 y(similarities)c(it)d (detects)g(b)q(et)o(w)o(een)h(the)f(classes.)20 b(The)14 b(to)q(ol)g(could)h (suggest)f(renaming)g(the)g(function)h(in)g(one)37 1528 y(of)g(the)f(classes) h(and)g(reordering)g(the)f(argumen)o(ts)g(of)g(one)h(function.)20 b(Once)c (these)e(c)o(hanges)h(are)f(made,)g(the)37 1584 y(signatures)20 b(will)h(b)q (e)e(iden)o(tical)i(and)f(the)f(signature)g(can)h(b)q(e)g(added)f(to)g(the)g (sup)q(erclass)h(proto)q(col.)32 b(The)37 1641 y(to)q(ol)17 b(could)h(suggest) d(p)q(ossible)k(re\014nemen)o(ts)e(in)g(the)g(lo)o(w)o(est)f(windo)o(w.)24 b (F)l(or)15 b(example,)j(in)f(comparing)g(t)o(w)o(o)37 1697 y(functions)d(in)g (di\013eren)o(t)f(classes,)g(the)g(return)g(t)o(yp)q(es)g(and)g(argumen)o(ts) f(ma)o(y)g(b)q(e)h(the)g(same)g(but)g(the)g(function)37 1753 y(names)21 b(ma) o(y)e(b)q(e)i(di\013eren)o(t;)h(the)f(to)q(ol)f(w)o(ould)g(suggest)g(renaming) h(one)f(function)h(to)e(matc)o(h)h(the)g(other.)37 1810 y(Belo)o(w)14 b(is)g (a)f(set)g(of)f(heuristics)j(that)d(can)i(detect)f(some)g(structural)g(simila\ rities)j(and)d(suggest)f(re\014nemen)o(ts.)37 1866 y(F)l(or)18 b(example,)i (heuristic)g(2)f(detects)f(the)h(case)g(where)f(the)h(a)f(function)i(in)f(one) g(sub)q(class)h(has)e(the)h(same)37 1923 y(argumen)o(ts)12 b(and)h(return)g (t)o(yp)q(es,)g(as)f(a)h(function)g(\(with)g(a)f(di\013eren)o(t)h(name\))g (de\014ned)h(in)g(the)e(other)h(sub)q(class.)37 1979 y(These)j(structural)f (similarities)j(suggest)c(that)h(the)g(t)o(w)o(o)f(functions)108 2036 y(These) e(heuristics)h(can)f(b)q(e)g(applied,)i(rep)q(eatedly)l(,)f(to)e(iterativ)o (ely)h(deriv)o(e)h(a)e(sup)q(erclass)i(proto)q(col.)18 b(First,)37 2092 y(the) d(most)f(ob)o(vious)g(case)h(is)g(c)o(hec)o(k)o(ed,)g(where)g(a)f(function)h (is)g(iden)o(tically)i(de\014ned)f(in)f(b)q(oth)g(classes.)20 b(When)37 2149 y (this)c(o)q(ccurs,)g(the)g(heuristic)h(suggests)d(adding)j(the)e(function)i (signature)e(to)g(the)h(sup)q(erclass)g(proto)q(col.)21 b(In)37 2205 y(other) 14 b(cases,)g(the)g(attributes)g(of)g(a)g(function)g(in)h(one)g(class)f(will) i(b)q(e)f(similar)g(to)e(but)h(not)g(exactly)h(the)f(same)37 2262 y(as)h(an)f (equiv)m(alen)o(t)i(function)f(in)g(the)g(other)f(class.)20 b(The)15 b(other) f(heuristics)h(b)q(elo)o(w)g(handle)h(renaming)f(\(2-4\),)37 2318 y(ret)o(ypi\ ng)k(\(5-6\),)g(reordering)g(argumen)o(ts)f(\(7\))f(and)i(c)o(hanging)g(acces\ s)g(con)o(trol)g(mo)q(de)g(\(8\),)f(to)g(mak)o(e)g(the)37 2374 y(signatures)e (of)f(equiv)m(alen)o(t)h(functions)g(matc)o(h)839 2358 y fs(3)859 2374 y fl (:)37 2522 y 750 2 v 89 2548 a fu(3)107 2564 y fp(The)11 b(action)i(clauses)g (of)e(most)g(heuristics)j(suggest)e(applying)j(a)c(primitiv)o(e)j(refactoring\ ,)f(describ)q(ed)g(in)f(c)o(hapter)h(\014v)o(e.)j(The)37 2610 y(precondition) q(s)g(of)c(those)i(refactorings)g(are)f(somewhat)h(more)f(complex)h(than)g (the)f(preconditions)j(sho)o(wn)e(here.)952 2760 y fl(60)g eop bop 133 0 a 26575831 26575831 5065195 15656058 31641026 42231889 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Roman Helvetica %%Pages: 1 %%BoundingBox: 77 238 481 642 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.86747 0 0 0.86747 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 136 163 542 550 Rect End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 210 639 ] concat %I [ (PROTOCOL FOR SUPERCLASS: VEHICLE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -27 189 ] concat %I 239 435 508 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 261 608 ] concat %I [ (int refuel\(int capacity\)) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 62 -3 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 176.5 327 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 177 313.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 151 504 ] concat %I [ (SUBCLASS: AUTOMOBILE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -87 55 ] concat %I 239 435 416 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 155 478 ] concat %I [ (void shiftDirection) ( \(direction newDirection,) ( int newSpeed\)) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -34 -161 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 176.5 327 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 177 313.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 361 503 ] concat %I [ (SUBCLASS: SUBMARINE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 124 58 ] concat %I 238 431 405 431 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 368 478 ] concat %I [ (void redirect\(int newSpeed,) ( direction newDirection\)) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 0.999969 -19 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 339.5 191 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 340 177.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 191 376 ] concat %I [ (POSSIBLE REFINEMENTS:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -47 -71.9999 ] concat %I 239 435 407 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 194 353 ] concat %I [ (in subclass automobile, consider changing the name of function ) ( shiftDirection to redirect) (in subclass submarine, consider reordering the arguments of) ( the function redirect) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 61 -288 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 176.5 327 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 177 313.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -6 156.5 ] concat %I 144 369 547 369 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 0 160.5 ] concat %I 342 363 342 229 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -2.99998 18.5 ] concat %I 144 369 547 369 Line End Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 89 626 90 626 Rect End End %I eop showpage %%Trailer end endTexFig 518 1811 a fh(Figure)17 b(6.2)p fl(:)j(De\014ning)c(the)f(Sup) q(erclass)i(Proto)q(col)133 1945 y fg(1.)24 b(if)71 b(function)23 b(F1)g(is)h (defined)f(in)g(class)g(A)324 2001 y(function)g(F1)g(is)h(defined)f(in)g(clas\ s)g(B)324 2058 y(the)g(functions)g(have)g(the)h(same)f(access)g(control)g(mod\ e,)g(return)g(type,)g(and)372 2114 y(arguments)f(with)i(the)f(same)g(names)g (and)h(types)205 2170 y(then)f(consider)g(adding)g(function)f(F1)i(to)g(the)f (superclass)g(protocol)252 2227 y(\(using)g(the)h(refactoring)e(defined)h(in) h(section)f(6.3\).)133 2340 y(2.)h(if)71 b(function)23 b(F1)g(is)h(defined)f (in)g(class)g(A)324 2396 y(function)g(F1)g(is)h(not)f(defined)g(in)h(class)f (B)324 2453 y(function)g(F2)g(is)h(defined)f(in)g(class)g(B)324 2509 y(functi\ on)g(F2)g(is)h(not)f(defined)g(in)h(class)f(A)324 2566 y(functions)f(F1)i(and) g(F2)f(have)g(arguments)g(with)g(the)h(same)f(names)g(and)952 2760 y fl(61)g eop bop 372 42 a fg(types,)23 b(and)g(have)g(the)h(same)f(return)g(type)205 98 y(then)g(consider)g(renaming)f(function)h(F2)h(in)f(class)h(B)f(to)h(F1)252 154 y(\(using)f(the)h(refactoring)e(change_member_function_name)o(\).)133 267 y(3.)i(if)71 b(function)23 b(F1)g(is)h(defined)f(in)g(class)g(A)324 324 y(fun\ ction)g(F1)g(is)h(not)f(defined)g(in)h(class)f(B)324 380 y(function)g(F2)g (is)h(defined)f(in)g(class)g(B)324 437 y(function)g(F2)g(is)h(not)f(defined)g (in)h(class)f(A)324 493 y(the)g(arguments)g(in)h(function)e(F2)i(of)f(class)h (B)f(can)h(be)f(arranged)g(such)372 550 y(that)g(the)g(corresponding)f(argume\ nts)h(in)h(both)f(functions)g(have)372 606 y(types)g(that)g(are)h(the)f(same,) g(parent/child)f(or)i(siblings)205 663 y(then)f(consider)g(renaming)f(functio\ n)h(F2)h(in)f(class)h(B)f(to)h(F1)252 719 y(\(using)f(the)h(refactoring)e(cha\ nge_member_function_name)o(\).)133 832 y(4.)i(if)71 b(function)23 b(F1)g(is)h (defined)f(in)g(class)g(A)324 888 y(function)g(F1)g(is)h(defined)f(in)g(class) g(B)324 945 y(the)g(types)g(of)h(their)f(corresponding)f(arguments)h(and)g (return)g(value)372 1001 y(are)g(the)g(same.)205 1058 y(then)g(consider)g(cha\ nging)f(\(as)i(needed\))f(the)g(argument)g(names)g(in)h(function)f(F1)252 1114 y(of)h(class)f(B)h(to)f(match)h(the)f(argument)g(names)g(in)h(class)f(A,)252 1171 y(\(using)g(the)h(refactoring)e(change_variable_name\).)133 1284 y(5.)i (if)71 b(function)23 b(F1)g(is)h(defined)f(in)g(class)g(A)324 1340 y(function) g(F1)g(is)h(defined)f(in)g(class)g(B)324 1396 y(a)h(type)f(of)g(an)h(argument) f(\(or)g(return)g(value\))g(in)h(one)f(function)372 1453 y(is)g(the)h(subtype) f(to)g(the)h(type)f(of)g(the)h(corresponding)e(argument)372 1509 y(\(or)h(ret\ urn)g(value\))g(in)h(another)f(function)205 1566 y(then)g(consider)g(changing) f(child-type)h(to)g(parent-type)252 1622 y(\(using)g(the)h(refactoring)e(chan\ ge_type\).)133 1735 y(6.)i(if)71 b(function)23 b(F1)g(is)h(defined)f(in)g(cla\ ss)g(A)324 1792 y(function)g(F1)g(is)h(defined)f(in)g(class)g(B)324 1848 y (a)h(type)f(of)g(an)h(argument)f(\(or)g(return)g(value\))g(in)h(one)f(functio\ n)372 1905 y(shares)g(a)g(common)g(supertype)g(with)g(the)h(type)f(of)h(the)f (corresponding)372 1961 y(argument)f(\(or)i(return)f(value\))g(in)g(another)g (function)205 2017 y(then)g(consider)g(changing)f(both)i(types)f(to)g(be)h (their)f(common)g(ancestor)252 2074 y(\(using)g(the)h(refactoring)e(change_ty\ pe\).)133 2187 y(7.)i(if)71 b(function)23 b(F1)g(is)h(defined)f(in)g(class)g (A)324 2243 y(function)g(F1)g(is)h(defined)f(in)g(class)g(B)324 2300 y(the)g (arguments)g(in)h(function)e(F1)i(of)f(class)h(B)f(can)h(be)f(arranged)g(such) 324 2356 y(that)g(the)h(corresponding)e(arguments)g(in)i(both)f(functions)g (have)g(types)324 2413 y(that)g(are)h(the)f(same,)g(parent/child)f(or)i(sibli\ ngs)205 2469 y(then)f(consider)g(reordering)f(the)i(arguments)e(of)i(F1)f(in) h(class)f(B)252 2526 y(\(using)g(the)h(refactoring)e(reorder_function_argumen\ ts\))o(.)952 2760 y fl(62)g eop bop 133 42 a fg(8.)24 b(if)71 b(function)23 b (F1)g(is)h(defined)f(in)g(class)g(A)324 98 y(function)g(F1)g(is)h(defined)f (in)g(class)g(B)324 154 y(their)g(access)g(control)g(modes)g(are)h(different) 205 211 y(then)f(consider)g(changing)f(the)i(least)f(permissive)g(mode)g(to)g (match)252 267 y(the)h(most)f(permissive)g(mode,)252 324 y(\(using)g(the)h (refactoring)e(change_access_control_mode\))o(.)108 430 y fl(Heuristics)c(suc) o(h)e(as)g(these)h(could)g(b)q(e)h(applied)g(incremen)o(tally)g(to)e(mak)o (e)g(the)g(functions)h(conform,)f(or)37 487 y(they)g(could)g(b)q(e)g(c)o(hain\ ed)g(together)f(to)f(\014nd)i(all)g(p)q(ossible)h(matc)o(hes.)108 543 y(F)l (or)c(eac)o(h)i(heuristic,)g(the)f(name)g(of)g(the)g(corresp)q(onding)h(refac\ toring)e(is)i(sho)o(wn)e(in)i(paren)o(theses.)20 b(This)37 599 y(is)e(done)g (here)g(to)e(mak)o(e)h(clear)h(the)f(relationships)i(b)q(et)o(w)o(een)f(the)f (suggested)g(re\014nemen)o(ts)h(and)f(primitiv)o(e)37 656 y(refactorings.)28 b (Ho)o(w)o(ev)o(er,)17 b(in)h(the)g(user)g(in)o(terface)g(\(sho)o(wn)f(in)i (Figure)f(6.2\),)f(the)h(refactoring)f(names)h(are)37 712 y(not)g(displa)o (y)o(ed.)29 b(Rather,)19 b(when)f(the)g(user)g(selects)h(an)f(attribute)f(to) h(up)q(date)g(and)g(en)o(ters)g(a)f(new)i(v)m(alue,)37 769 y(the)j(corresp)q (onding)g(refactoring)f(is)h(automatically)g(triggered.)38 b(Suc)o(h)23 b(an) e(up)q(date)h(b)o(y)f(the)h(user)f(ma)o(y)37 825 y(b)q(e)h(in)g(resp)q(onse)g (to)e(a)h(re\014nemen)o(t)g(suggested)g(b)o(y)g(the)g(to)q(ol,)h(or)e(migh)o (t)h(b)q(e)h(a)f(re\014nemen)o(t)g(\(suc)o(h)g(as)g(a)37 882 y(renaming\))f (based)f(on)g(the)g(user's)g(design)h(insigh)o(t.)32 b(Before)19 b(the)g(prim\ itiv)o(e)h(refactoring)f(is)h(p)q(erformed,)37 938 y(whose)d(preconditions)h (are)e(c)o(hec)o(k)o(ed.)25 b(If)17 b(the)g(c)o(hange)f(is)h(v)m(alid,)i(the) d(refactoring)h(is)g(p)q(erformed,)g(and)f(the)37 995 y(user)22 b(displa)o (y)h(is)f(up)q(dated.)40 b(When)22 b(the)g(function)h(signatures)e(matc)o(h,) i(the)e(user)h(selects)h(to)e(add)g(the)37 1051 y(function)g(signature)e(to)g (the)h(sup)q(erclass)h(proto)q(col,)f(in)g(whic)o(h)g(case)g(the)f(refactorin\ g)h(describ)q(ed)h(in)f(the)37 1108 y(next)c(section)g(is)f(in)o(v)o(ok)o(ed.) 108 1164 y(These)f(heuristics)i(detect)e(similarities)i(based)e(on)f(a)h(smal\ l)g(set)g(of)f(structural)h(attributes.)19 b(More)14 b(p)q(o)o(w-)37 1220 y (erful)j(similarit)o(y)f(detection)h(is)f(p)q(ossible,)h(as)e(discussed)i(in) f(the)g(arti\014cial)h(in)o(telligence)h(mac)o(hine)e(learning)37 1277 y(lite\ rature)h(on)e(analogy-based)h(systems)g([28)o(,)f(39,)g(51)o(,)h(64)o(].)21 b (Analogy-based)c(systems)e(ha)o(v)o(e)g(v)o(ery)h(limited)37 1333 y(p)q(o)o (w)o(er)h(unless)i(their)f(analysis)g(is)g(based)g(on)f(a)g(w)o(ell-de\014ned) j(domain)e(mo)q(del.)28 b(Suc)o(h)18 b(approac)o(hes)f(are)g(of)37 1390 y(dub\ ious)j(v)m(alue)f(in)g(man)o(y)e(applications)j(of)e(refactoring,)g(where)g (the)g(design)h(of)f(the)g(application)h(is)g(not)37 1446 y(w)o(ell)e(underst\ o)q(o)q(d)e(and)h(is)g(ev)o(olving.)37 1589 y fd(6.3)70 b(Adding)23 b(F)-6 b (unction)23 b(Signatures)g(to)g(the)f(Sup)r(erclass)h(Proto)r(col)37 1691 y fl (Once)15 b(the)e(signature)h(of)f(a)g(function)h(in)g(b)q(oth)g(sub)q(classes) g(matc)o(h,)f(the)h(function)g(signature)f(can)h(b)q(e)g(added)37 1747 y(to)d (the)h(sup)q(erclass.)19 b(The)12 b(follo)o(wing)g(refactoring)f(adds)g(a)g (function)h(signature)f(to)g(the)h(sup)q(erclass)g(proto)q(col.)37 1804 y(The) k(argumen)o(ts)e(to)h(this)g(refactoring)g(are:)106 1910 y fj(\017)22 b fl (the)15 b(mem)o(b)q(er)h(function)g(\(F1\))e(as)h(de\014ned)h(in)g(the)f(\014\ rst)g(sub)q(class)h(\(C1\))106 2004 y fj(\017)22 b fl(the)15 b(mem)o(b)q(er)h (function)g(\(F2\))e(as)h(de\014ned)h(in)g(the)f(second)h(sub)q(class)g(\(C2\ \))37 2110 y(After)f(c)o(hec)o(king)h(its)g(preconditions,)g(this)g(refactori\ ng:)93 2216 y(1.)22 b(calls)12 b(the)f(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(function)h(refactoring)e(to)g(add)h(the)g(function)h(\(signature\))e (as)g(a)h(protected)151 2273 y(mem)o(b)q(er)18 b(of)e(the)i(sup)q(erclass.)27 b(The)17 b(function)i(is)e(de\014ned)i(as)e(virtual)h(in)g(the)f(sup)q(erclas\ s)i(\(referred)151 2329 y(to)c(b)q(elo)o(w)g(as)g(`commonSup)q(erclass'\),)g (allo)o(wing)h(it)g(to)e(b)q(e)i(\(re\)de\014ned)g(in)g(the)f(sub)q(classes.) 1748 2313 y fs(4)37 2413 y 750 2 v 89 2440 a fu(4)107 2456 y fp(In)j(C++,)h (the)g(function)h(can)f(b)q(e)f(de\014ned)i(as)f(a)f(pure)h(virtual)i(functio\ n)f(b)o(y)f(assigning)i(its)e(v)n(alue)h(to)e(b)q(e)h(`0')f(in)h(the)37 2501 y (sup)q(erclass.)952 2760 y fl(63)g eop bop 37 42 a fe(6.3.1)56 b(Precondition\ s)37 127 y fl(The)16 b(precondition)h(for)d(this)i(refactoring)f(is:)93 234 y (1.)22 b fj(8)16 b fl(mem)o(b)q(er)f fj(2)g fl(commonSup)q(erclass.lo)q(cally\ De\014ne)q(dMem)o(b)q(erF)l(uncti)q(ons,)226 290 y(mem)o(b)q(er.name)g fj(6)p fl(=)h(F1.name.)151 347 y(\(the)f(mem)o(b)q(er)g(function)h(is)g(not)f(alread\ y)g(lo)q(cally)i(de\014ned)g(in)f(the)f(common)g(sup)q(erclass\))93 440 y(2.) 22 b(matc)o(hingSignaturesP\(F1,)14 b(F2\))151 497 y(\(the)h(signatures)g(of) g(the)g(mem)o(b)q(er)h(function)g(in)g(b)q(oth)f(sub)q(classes)i(matc)o(h\)) 37 618 y fe(6.3.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 704 y fl(F)l(or)10 b(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(function:)18 b(precondition) 12 b(1)e(\(the)g(mem)o(b)q(er)g(function)h(is)g(not)f(already)g(de\014ned)i (lo)q(cally\))37 761 y(is)24 b(satis\014ed)f(b)o(y)g(precondition)h(1)e(of)h (this)g(refactoring;)i(precondition)g(2)d(\(the)g(signature)h(is)h(iden)o(tic\ al)37 817 y(to)19 b(that)g(of)g(an)o(y)g(inherited)j(function)e(with)g(the)g (same)f(name\))g(is)h(satis\014ed)g(b)o(y)g(precondition)h(2)e(of)g(this)37 874 y(refactoring)14 b(and)g(the)f fi(Comp)n(atible)i(Signatur)n(es)e(in)i (Memb)n(er)f(F)m(unction)g(R)n(e)n(de\014nition)e fl(program)g(prop)q(ert)o (y;)37 930 y(precondition)24 b(3)d(\(the)h(signatures)f(of)h(corresp)q(onding) g(functions)h(in)f(sub)q(classes)h(are)f(iden)o(tical)h(to)e(the)37 987 y(sig\ nature)d(b)q(eing)g(added)g(to)f(the)g(sup)q(erclass\))h(is)g(satis\014ed)g (b)o(y)f(precondition)i(2)e(of)g(this)g(refactoring)g(and)37 1043 y(b)o(y)h (construction;)i(precondition)f(4)f(\(if)g(there)g(is)g(an)g(inherited)i(func\ tion)f(with)f(the)g(same)f(name,)i(either)37 1099 y(the)c(inherited)h(functio\ n)f(is)f(unreferenced)i(on)e(instances)h(of)f(C)g(\(or)f(its)h(sub)q(classes\ \),)h(or)f(the)g(new)h(function)37 1156 y(is)20 b(seman)o(tically)h(equiv)m (alen)o(t)f(to)f(the)g(function)h(it)g(replaces\))g(is)f(satis\014ed)h(b)q (ecause)g(there)f(are)g(no)g(name)37 1212 y(collisions)d(-)e(the)g(new)g(clas\ s)g(has)g(no)g(lo)q(cal)g(functions)h(or)e(instances,)i(and)f(its)f(sub)q(cla\ sses)i(already)f(o)o(v)o(erride)37 1269 y(the)g(function;)h(precondition)h (5)d(\(regarding)h(references)g(in)h(the)f(function)h(b)q(o)q(dy\))f(is)g(sat\ is\014ed)h(b)q(ecause)f(the)37 1325 y(function)j(signature)e(has)g(no)g(funct\ ion)h(b)q(o)q(dy)l(.)108 1382 y(This)e(refactoring)f(is)h(constructed)g(using) g(a)g(b)q(eha)o(vior)g(preserving)g(refactoring)f(and,)h(since)g(it)g(satis\ \014es)37 1438 y(the)i(preconditions)g(of)f(that)g(refactorings,)f(b)q(eha)o (vior)i(is)g(preserv)o(ed.)37 1581 y fd(6.4)70 b(Making)24 b(F)-6 b(unction) 22 b(Bo)r(dies)g(Compatible)37 1683 y fl(Often,)14 b(in)g(abstract)e(classes) i(the)f(abstraction)g(is)h(represen)o(ted)g(not)f(only)g(b)o(y)h(the)f(functi\ on)h(signatures)f(but)37 1739 y(also)k(b)o(y)f(the)g(implemen)o(tations)i(of) d(some)h(functions.)24 b(Often)17 b(these)f(implemen)o(tations)i(are)e(only)g (partial;)37 1796 y(that)f(is,)g(the)g(implemen)o(tations)h(include)h(calls)f (to)e(other)h(functions)g(that)f(are)h(de\014ned)h(in)g(the)f(sub)q(classes.) 108 1852 y(As)j(in)g(the)f fi(mapunit)i fl(example,)f(the)g(function)g(b)q (o)q(dies)h(in)f(the)g(sub)q(classes)h(ma)o(y)d(b)q(e)j(similar)f(but)g(not) 37 1909 y(iden)o(tical.)28 b(Before)18 b(the)f(function)h(b)q(o)q(dy)g(can)f (b)q(e)h(migrated)f(to)g(the)g(sup)q(erclass,)i(di\013erences)f(need)g(to)f (b)q(e)37 1965 y(separated)e(from)g(the)g(common)g(co)q(de.)108 2022 y(The)c (approac)o(hes)g(for)f(detecting)h(program)f(di\013erences)i(in)o(v)o(olv)o (e)f(string)g(comparison,)g(tree)f(comparison)37 2078 y(or)16 b(a)g(com)o(bin\ ation)g(of)g(these)g(tec)o(hniques)h([12)o(].)22 b(Program)15 b(di\013erences) i(ha)o(v)o(e)f(b)q(een)h(studied)g(in)g(regard)e(to)37 2135 y(sp)q(elling)j (correction)d([54,)f(109)o(],)h(parsing)g(error)g(correction)g([119)o(],)f (v)o(ersion)i(storage)e([99)o(])g(and)i(other)f(uses.)108 2191 y(String)f(com\ parison)f(\014nds)i(the)e(minim)o(um)i(cost)e(sequence)h(of)f(edit)i(op)q(era\ tions)e(to)g(con)o(v)o(ert)g(one)g(string)37 2247 y(in)o(to)h(another.)19 b (The)14 b(standard)f(algorithm)h(for)f(string)g(comparison)h(is)g(describ)q (ed)h(b)o(y)f(W)l(agner)f(and)h(Fisher)37 2304 y([120)o(].)19 b(The)14 b(user) g(sp)q(eci\014es)i(the)e(cost)f(of)g(insertion,)i(replacemen)o(ts)f(and)g(del\ etion)h(of)f(particular)g(elemen)o(ts.)37 2360 y(Dynamic)20 b(programming)f (is)h(used)g(to)f(build)i(a)f(cost)e(table;)k(then,)f(the)e(table)h(is)g(anal\ yzed)g(to)f(\014nd)h(the)37 2417 y(minim)o(um)d(cost)d(sequence.)22 b(Sev)o (eral)15 b(re\014nemen)o(ts)h(ha)o(v)o(e)f(b)q(een)h(prop)q(osed)f([12].)108 2473 y(String)g(comparison)f(algorithms)h(ha)o(v)o(e)f(their)g(limitations.) 21 b(In)15 b(comparing)g(t)o(w)o(o)e(programs,)g(one)i(limi-)37 2530 y(tation) h(is)g(that)e(often)i(there)f(is)h(no)g(w)o(a)o(y)e(to)h(relate)g(c)o(hanges) h(with)g(eac)o(h)f(other.)21 b(F)l(or)15 b(example,)h(if)f(c)o(hanges)952 2760 y(64)g eop bop 37 42 a fl(are)15 b(made)h(at)e(the)i(b)q(eginning)h(and)e(end) h(of)f(a)g(conditional)i(statemen)o(t,)d(these)h(c)o(hanges)g(will)i(not)e (b)q(e)h(adja-)37 98 y(cen)o(t)g(and)h(string)f(comparison)g(approac)o(hes)f (cannot)h(in)o(terrelate)h(the)f(c)o(hanges.)22 b(Also,)16 b(sligh)o(t)g(di\ \013erences)37 154 y(in)h(programming)e(st)o(yle)h(\(extra)e(paren)o(theses,) i(blank)g(lines,)h(etc.\))k(can)16 b(result)g(in)g(di\013erences)h(\015agged) f(b)o(y)37 211 y(string)i(comparison,)f(ev)o(en)h(though)f(the)g(t)o(w)o(o)f (programs)h(ma)o(y)f(b)q(e)i(syn)o(tactically)g(the)g(same.)26 b(These)17 b (and)37 267 y(other)e(limitations)i(ha)o(v)o(e)e(motiv)m(ated)g(sev)o(eral)g (tec)o(hniques)i(in)o(v)o(olving)f(tree)f(comparison.)108 324 y(T)l(ree)f(com\ parison)h(algorithms)f(detect)g(syn)o(tactic)g(di\013erences)h(b)q(et)o(w)o (een)g(programs)d(b)o(y)j(building)h(syn-)37 380 y(tax)11 b(trees)h(and)f(com\ paring)h(the)f(trees.)19 b(T)l(ree)12 b(comparison)f(is)h(computationally)h (exp)q(ensiv)o(e,)g(and)f(extensiv)o(e)37 437 y(researc)o(h)i(has)f(gone)g (in)o(to)h(reducing)g(the)g(cost)f(b)o(y)g(\014rst)g(limiting)j(the)d(analysi\ s)i(to)d(a)h(subset)h(of)f(\\in)o(teresting)37 493 y(trees",)k(and)h(then)g (further)f(reducing)h(the)g(searc)o(h)f(b)o(y)g(detecting)h(and)g(eliminating) h(matc)o(hing)f(subtrees.)37 550 y(T)l(ree)e(comparison)f(algorithms)g(are)g (describ)q(ed)i(in)f([94)o(,)f(111)o(,)g(115)o(,)g(116)o(,)g(124)o(].)108 606 y(These)i(tec)o(hniques)g(can)g(b)q(e)g(used)g(in)g(refactoring)f(as)g(follo) o(ws:)23 b(Supp)q(ose)17 b(the)f(function)i fi(abstr)n(actable-)37 663 y(F)m (unction)10 b fl(is)h(de\014ned)h(in)g(classes)f ff(Class1)g fl(and)g ff(Clas\ s2)p fl(.)18 b(A)11 b(string)g(or)f(tree)g(comparison)h(algorithm)g(is)g(appl\ ied,)37 719 y(pro)q(ducing)j(a)e(set)g(of)g(insertion,)h(replacemen)o(ts)g (and)g(deletion)g(op)q(erations)g(to)e(get)h(from)g fi(abstr)n(actableF)m(unc\ -)37 775 y(tion)j fl(in)h ff(Class1)f fl(to)g fi(abstr)n(actableF)m(unction)e fl(in)j ff(Class2)p fl(.)k(F)l(or)14 b(eac)o(h)h(edit)h(op)q(eration,)f(de\ \014ne)h(a)e(new)i(function)37 832 y(in)h(b)q(oth)e(classes:)106 923 y fj(\ \017)22 b fl(for)13 b(eac)o(h)h(insertion,)h(de\014ne)g(in)g ff(Class2)f fl (a)f(new)i(function)f(whose)g(b)q(o)q(dy)h(con)o(tains)f(the)f(inserted)i(co) q(de;)151 979 y(de\014ne)f(in)g ff(Class1)g fl(a)f(new)g(function)h(with)g (the)f(same)g(name)g(whose)g(b)q(o)q(dy)h(is)f(n)o(ull.)21 b(Con)o(v)o(ert)12 b(in)i ff(Class2)151 1036 y fl(the)21 b(inserted)h(co)q(de)g(to)f(a)f(call)j (to)d(the)h(new)h(function;)i(at)d(the)g(corresp)q(onding)h(lo)q(cation)g(wit\ hin)151 1092 y fi(abstr)n(actableF)m(unction)14 b fl(in)i ff(Class1)p fl(,)f (add)g(a)g(call)h(to)f(the)g(new)h(function.)106 1185 y fj(\017)22 b fl(for) 17 b(eac)o(h)g(replacemen)o(t,)h(de\014ne)g(in)g ff(Class1)f fl(a)g(new)g(fun\ ction)h(whose)f(b)q(o)q(dy)h(con)o(tains)f(the)g(replaced)151 1241 y(co)q(de;) 27 b(de\014ne)d(in)f ff(Class2)g fl(a)f(new)h(function)h(with)f(the)g(same)f (name)h(whose)f(b)q(o)q(dy)i(con)o(tains)e(the)151 1298 y(replacing)f(co)q (de.)35 b(In)21 b ff(Class1)p fl(,)g(con)o(v)o(ert)e(the)h(replaced)h(co)q (de)g(to)e(a)h(call)h(to)f(the)g(new)g(function;)j(in)151 1354 y ff(Class2)p fl(,)15 b(con)o(v)o(ert)g(the)g(replacing)i(co)q(de)e(with)h(a)f(call)h(to)f (the)g(new)g(function.)106 1447 y fj(\017)22 b fl(for)16 b(eac)o(h)g(deletion\ ,)h(in)g ff(Class1)f fl(de\014ne)i(a)d(new)i(function)g(whose)f(b)q(o)q(dy)g (con)o(tains)h(the)f(deleted)h(co)q(de;)151 1503 y(de\014ne)d(in)g ff(Class2) f fl(a)g(new)g(function)g(with)h(the)f(same)f(name)h(whose)g(b)q(o)q(dy)g(is) h(n)o(ull.)20 b(In)14 b ff(Class1)p fl(,)f(con)o(v)o(ert)151 1559 y(the)22 b (deleted)i(co)q(de)f(to)e(a)h(call)i(to)d(the)i(new)f(function;)k(at)c(the)g (corresp)q(onding)h(lo)q(cation)g(within)151 1616 y fi(abstr)n(actableF)m(unc\ tion)14 b fl(in)i ff(Class2)p fl(,)f(add)g(a)g(call)h(to)f(the)g(new)h(functi\ on.)108 1707 y(Using)g(these)g(algorithms,)f(the)g(task)g(of)g(comparing)h (t)o(w)o(o)e(functions)i(and)g(splitting)g(a)o(w)o(a)o(y)e(di\013erences)37 1763 y(in)o(to)i(separate)e(functions)i(could)h(b)q(e)e(automated,)f(but)i (there)f(are)g(shortcomings.)108 1820 y(When)h(a)f(new)h(function)g(is)g(de\ \014ned,)h(it)f(should)g(b)q(e)h(giv)o(en)f(a)f(descriptiv)o(e)i(name)f(and)f (con)o(tain)h(related)37 1876 y(co)q(de.)21 b(F)l(unction)16 b(names)f(that)g (are)g(auto-generated)f(probably)i(w)o(on't)e(b)q(e)i(descriptiv)o(e.)21 b (Ho)o(w)o(ev)o(er,)14 b(this)i(is)37 1933 y(not)f(a)f(ma)s(jor)f(problem,)i (as)f(a)g(refactoring)g(could)i(later)e(b)q(e)h(applied)i(to)c(c)o(hange)i (the)g(function)g(names)f(and)37 1989 y(mak)o(e)h(them)g(more)g(descriptiv)o (e.)108 2045 y(More)k(imp)q(ortan)o(tly)l(,)h(when)g(t)o(w)o(o)e(functions)i (are)f(compared,)g(a)g(segmen)o(t)g(of)g(con)o(tiguous)g(co)q(de)h(that)37 2102 y(app)q(ears)e(in)g(one)f(function)h(but)f(not)g(in)h(the)f(other)g(ma)o (y)f(not)h(b)q(elong)h(in)g(a)f(new)g(function.)26 b(P)o(erhaps)17 b(the)37 2158 y(con)o(tiguous)f(co)q(de)h(should)f(b)q(e)h(divided)g(further)f(in)o (to)g(sev)o(eral)g(functions.)22 b(Con)o(v)o(ersely)l(,)15 b(sometimes)h(when) 37 2215 y(t)o(w)o(o)i(functions)h(are)g(compared,)g(segmen)o(ts)f(of)g(co)q (de)h(that)f(di\013er)h(b)q(et)o(w)o(een)g(them)g(ma)o(y)f(b)q(e)h(preceded)h (or)37 2271 y(follo)o(w)o(ed)e(b)o(y)f(segmen)o(ts)f(of)h(related)g(co)q(de)h (that)e(\(coinciden)o(tally\))j(are)e(the)g(same)g(in)h(b)q(oth)f(functions.) 26 b(In)37 2328 y(order)18 b(for)f(the)h(new)f(functions)i(to)e(represen)o (t)g(meaningful)i(abstractions,)f(this)g(\\common")e(co)q(de)j(migh)o(t)37 2384 y(really)i(b)q(elong)g(together)e(with)h(the)g(di\013ering)h(segmen)o (ts)e(in)i(those)f(new)g(functions.)34 b(F)l(ully)21 b(automated)37 2441 y (tec)o(hniques)c(w)o(on't)d(pic)o(k)i(this)g(up.)108 2497 y(Rak)e([93)o(])f (describ)q(es)j(an)d(approac)o(h)g(that)g(com)o(bines)i(automated)e(analysis) h(with)g(user)g(in)o(teraction,)g(for)37 2554 y(abstracting)g(a)g(function)g (\(Smalltalk)h(metho)q(d\))f(in)o(to)g(a)f(sup)q(erclass)i(from)f(its)g(sub)q (class)h(implemen)o(tations.)37 2610 y(A)j(parse)f(of)g(eac)o(h)h(function)g (pro)q(duces)g(a)f(stream)g(of)g(tok)o(ens;)g(the)h(tok)o(en)f(streams)f(are) h(compared)h(using)952 2760 y(65)g eop bop 37 42 a fl(W)l(agner)19 b(and)g (Fisher's)g(string)g(comparison)h(algorithm)f(to)f(determine)i(the)f(di\013er\ ence)i(regions.)31 b(On)20 b(a)37 98 y(displa)o(y)d(terminal,)g(the)f(functio\ ns)g(implemen)o(tations)i(are)d(displa)o(y)o(ed)i(side-b)o(y-side,)h(with)e (the)g(di\013erence)37 154 y(regions)g(highligh)o(ted.)23 b(The)15 b(user)h (can)g(expand)g(or)f(split)h(the)g(di\013erence)g(regions.)21 b(Then,)16 b (for)e(eac)o(h)i(di\013er-)37 211 y(ence)i(region,)e(a)g(new)h(function)g(is) g(added)g(to)f(eac)o(h)g(sub)q(class)h(to)f(con)o(tain)h(the)f(di\013erences.) 24 b(Then,)17 b(in)g(the)37 267 y(function)d(b)q(eing)h(abstracted,)e(the)g (di\013ering)h(co)q(de)g(is)f(replaced)i(b)o(y)e(a)g(call)h(to)f(the)g(newly) h(created)f(function.)37 324 y(This)19 b(pro)q(cess)f(is)h(rep)q(eated)f(un)o (til)h(the)f(function)h(implemen)o(tations)g(are)f(iden)o(tical,)i(at)d(whic) o(h)i(p)q(oin)o(t)f(the)37 380 y(function)f(can)e(b)q(e)h(migrated)f(to)f(the) i(sup)q(erclass.)108 437 y(Rak)21 b(c)o(hose)g(a)g(string)g(comparison)h(appr\ oac)o(h)e(b)q(ecause)i(it)g(w)o(as)e(simpler)i(to)f(implemen)o(t)h(than)f(the) 37 493 y(tree)d(comparison)g(approac)o(hes.)28 b(Ho)o(w)o(ev)o(er,)18 b(it)g (has)g(shortcomings.)28 b(A)18 b(stream)f(of)g(tok)o(ens)h(represen)o(ting)37 550 y(a)g(di\013erence)i(region)e(ma)o(y)g(cross)g(the)g(b)q(oundary)h(b)q (et)o(w)o(een)f(subtrees)h(of)f(the)g(function)h(parse,)g(in)g(whic)o(h)37 606 y(case)h(that)e(region)h(is)h(not)e(alw)o(a)o(ys)h(con)o(v)o(ertible)h(to)e (a)h(function.)32 b(This)20 b(shortcoming)e(can)i(b)q(e)f(o)o(v)o(ercome)37 663 y(b)o(y)e(expanding)h(the)e(di\013erence)i(region)e(un)o(til)i(it)f(corre\ sp)q(onds)f(to)g(a)g(syn)o(tactically)i(meaningful)g(program)37 719 y(part.) 108 775 y(Bec)o(kman-Da)o(vies)25 b([12)o(])f(analyzed)h(string)f(and)h(tree) f(comparison)h(approac)o(hes)f(\(and)g(h)o(ybrid)h(ap-)37 832 y(proac)o(hes\)) 18 b(for)e(\014nding)j(program)e(di\013erences.)28 b(That)17 b(analysis)h(sho) o(w)o(ed)f(that)g(no)h(approac)o(h)f(is)h(optimal)37 888 y(in)i(all)g(cases.) 32 b(Bec)o(kman-Da)o(vies)19 b(further)g(concluded)i(that,)e(among)f(the)i (approac)o(hes)e(for)h(\014nding)h(and)37 945 y(displa)o(ying)g(program)d(di\ \013erences)j(to)d(a)h(user,)h(an)f(alternativ)o(e)g(should)h(b)q(e)g(c)o(hos\ en)g(based)f(primarily)i(on)37 1001 y(what)f(seems)g(in)o(tuitiv)o(ely)h(b)q (est)f(to)f(that)h(user,)g(while)h(minimizing)i(computational)d(costs)f(and)h (w)o(orking)37 1058 y(within)e(the)e(limitations)i(of)d(the)i(displa)o(y)g (terminal.)37 1201 y fd(6.5)70 b(Making)24 b(V)-6 b(ariables)22 b(Compatible) 37 1302 y fl(Ha)o(ving)14 b(created)g(the)g(abstract)f(sup)q(erclass)i(and)f (determined)h(the)f(function)h(signatures,)f(it)g(is)g(sometimes)37 1359 y (necessary)i(to)f(add)g(mem)o(b)q(er)h(v)m(ariables)g(to)f(the)g(abstract)g (sup)q(erclass.)21 b(Although)16 b(abstract)e(classes)i(often)37 1415 y(do)j (not)f(ha)o(v)o(e)h(mem)o(b)q(er)g(v)m(ariables,)h(sometimes)f(they)g(need)g (to)f(b)q(e)h(mo)o(v)o(ed)g(there.)30 b(The)19 b(most)f(common)37 1472 y(reas\ on)d(is)h(that)e(they)i(are)f(referenced)h(b)o(y)f(common)g(co)q(de)h(that)e (b)q(elongs)i(in)g(the)f(sup)q(erclass.)108 1528 y(As)j(w)o(as)e(the)i(case)g (with)g(function)g(signatures,)g(v)m(ariables)h(de\014ned)g(in)f(one)g(sub)q (class)g(ma)o(y)f(b)q(e)h(struc-)37 1585 y(turally)12 b(similar)g(to,)f(but)g (not)g(exactly)g(matc)o(h,)g(conceptually)h(equiv)m(alen)o(t)h(v)m(ariables)f (in)g(the)f(other)g(sub)q(class.)37 1641 y(F)l(or)18 b(example,)h(supp)q(ose) g(t)o(w)o(o)e(ob)s(jects,)h(one)g(of)f(eac)o(h)i(sub)q(class,)g(eac)o(h)f(con) o(tain)h(a)e(coun)o(ter)h(of)g(references)37 1698 y(to)f(themselv)o(es.)26 b (When)17 b(the)h(coun)o(ter)e(reac)o(hes)h(zero,)g(the)h(ob)s(ject)e(marks)g (itself)i(for)f(deletion.)27 b(Ho)o(w)o(ev)o(er,)37 1754 y(in)17 b(one)g(sub) q(class)g(the)f(coun)o(ter)g(is)g(called)i fi(r)n(efCount)d fl(while)j(in)f (the)f(other)f(sub)q(class)i(the)f(coun)o(ter)g(is)h(called)37 1810 y fi(r)n (efer)n(enc)n(es)p fl(.)25 b(Before)18 b(the)g(v)m(ariable)h(is)f(added)g(to) f(the)g(sup)q(erclass,)i(the)f(name)f(of)h(one)f(of)g(these)h(v)m(ariables)37 1867 y(needs)e(to)f(b)q(e)h(c)o(hanged)f(to)g(matc)o(h)g(the)g(other)g(v)m (ariable.)108 1923 y(Structural)h(heuristics)g(similar)h(to)d(those)h(listed) i(in)f(section)g(6.2)e(could)j(detect)e(similarities)j(in)e(name,)37 1980 y (access)d(con)o(trol)f(mo)q(de)h(and)g(t)o(yp)q(e.)19 b(In)13 b(cases)g(where) f(the)h(attributes)f(of)h(the)f(v)m(ariables)i(di\013er,)f(the)g(follo)o(wing) 37 2036 y(refactorings)22 b(that)e(c)o(hange)i(v)m(ariable)h(attributes)e(can) h(b)q(e)g(applied)i(to)d(mak)o(e)g(the)h(v)m(ariable)h(attributes)37 2093 y (matc)o(h,)15 b(pro)o(vided)h(that)e(their)i(preconditions)h(are)e(met:)106 2187 y fj(\017)22 b fl(c)o(hange)s 14 2 v 14 w(v)m(ariable)s 14 2 v 14 w(name) 16 b(\(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable,)g(new)s 14 2 v 14 w(v)m(ariabl\ e)s 14 2 v 15 w(name\))106 2280 y fj(\017)22 b fl(c)o(hange)s 14 2 v 14 w(acc\ ess)s 14 2 v 13 w(con)o(trol)s 14 2 v 13 w(mo)q(de)16 b(\(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable,)g(new)s 14 2 v 14 w(access)s 14 2 v 13 w(con)o(trol)s 14 2 v 14 w(mo)q(de\))106 2374 y fj(\017)22 b fl(c)o(hange)s 14 2 v 14 w(t)o(yp)q (e)15 b(\(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable,)h(new)s 14 2 v 14 w(t)o(yp) q(e\).)952 2760 y(66)g eop bop 37 42 a fd(6.6)70 b(Migrating)23 b(V)-6 b(aria\ bles)22 b(to)h(the)f(Sup)r(erclass)37 143 y fl(This)16 b(refactoring)f(migrat\ es)g(a)g(v)m(ariable)h(to)f(the)g(abstract)f(sup)q(erclass.)21 b(The)16 b(arg\ umen)o(ts)e(to)h(this)37 199 y(refactoring)g(are:)106 306 y fj(\017)22 b fl (the)15 b(mem)o(b)q(er)h(v)m(ariable)g(\(V1\))f(in)h(one)f(sub)q(class)h(\(C1\ \))106 400 y fj(\017)22 b fl(the)15 b(mem)o(b)q(er)h(v)m(ariable)g(\(V2\))f (in)h(the)f(other)g(sub)q(class)h(\(C2\))37 506 y(After)f(c)o(hec)o(king)h (its)g(preconditions,)g(this)g(refactoring:)93 612 y(1.)22 b(calls)17 b(the)e (mo)o(v)o(e)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)s 14 2 v 15 w (to)s 14 2 v 13 w(sup)q(erclass)h(refactoring)f(to)g(mo)o(v)o(e)g(the)g(v)m (ariable)i(to)e(the)g(su-)151 669 y(p)q(erclass.)37 790 y fe(6.6.1)56 b(Preco\ nditions)37 876 y fl(The)16 b(preconditions)h(for)d(this)i(refactoring)f(are:) 93 982 y(1.)22 b(matc)o(hingA)o(ttributesP\(V1,)14 b(V2\))151 1039 y(\(the)h (attributes)g(of)g(the)g(mem)o(b)q(er)g(v)m(ariables)i(matc)o(h.\))93 1133 y (2.)22 b(V1.accessCon)o(trolMo)q(de)14 b fj(6)p fl(=)i(priv)m(ate)151 1189 y (\(the)f(access)g(con)o(trol)g(mo)q(de)h(of)f(eac)o(h)g(v)m(ariable)h(is)g (not)f(priv)m(ate\))37 1311 y fe(6.6.2)56 b(Beha)n(vior)18 b(Preserv)m(ation) 37 1397 y fl(F)l(or)e(mo)o(v)o(e)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m (ariable)s 14 2 v 15 w(to)s 14 2 v 13 w(sup)q(erclass:)23 b(precondition)18 b (1)e(\(the)g(v)m(ariable)i(is)f(de\014ned)h(iden)o(tically)h(in)37 1453 y(all) j(sub)q(classes)g(where)g(it)f(is)g(de\014ned\))h(is)g(satis\014ed)f(b)o(y)g (precondition)h(1)f(of)f(this)i(refactoring)e(and)h(and)37 1509 y(b)q(ecause) i(\(b)o(y)d(construction,)j(from)d(prior)h(steps\))g(no)g(other)g(sub)q(class\ es)h(are)f(de\014ned;)k(precondition)e(2)37 1566 y(\(the)18 b(v)m(ariable)i (isn't)e(already)g(de\014ned)i(or)e(inherited)h(b)o(y)g(the)f(sup)q(erclass\)) h(is)f(satis\014ed)h(b)o(y)f(precondition)37 1622 y(2)f(of)f(this)h(refactori\ ng)f(and)h(program)e(prop)q(ert)o(y)i(four)f(\(inherited)i(Mem)o(b)q(er)e(V)l (ariables)i(Not)e(Rede\014ned\),)37 1679 y(whic)o(h)i(states)e(that)g(a)g(mem) o(b)q(er)h(v)m(ariable)h(inherited)g(from)e(a)g(sup)q(erclass)i(is)f(not)f (rede\014ned)i(in)g(an)o(y)e(of)g(its)37 1735 y(sub)q(classes.)108 1792 y(Thi\ s)e(refactoring)f(is)h(constructed)g(using)g(a)g(b)q(eha)o(vior)g(preserving) g(refactoring)f(and,)h(since)g(it)g(satis\014es)37 1848 y(the)i(preconditions) g(of)f(that)g(refactoring,)f(b)q(eha)o(vior)i(is)g(preserv)o(ed.)37 1991 y fd (6.7)70 b(Migrating)23 b(Common)f(Co)r(de)g(to)h(the)g(Abstract)g(Sup)r(ercla\ ss)37 2093 y fl(In)18 b(this)f(step,)g(common)f(co)q(de)i(is)f(migrated)f(to) g(the)h(sup)q(erclass.)26 b(Before)17 b(migrating)f(the)h(function)h(b)q(o)q (dy)37 2149 y(to)d(the)g(sup)q(erclass,)h(di\013erences)h(b)q(et)o(w)o(een)e (the)g(functions)h(are)f(computed)h(using)g(one)f(of)g(the)g(comparison)37 2206 y(algorithms)k(describ)q(ed)h(in)f(section)g(6.4.)28 b(V)l(ariables)19 b (and)f(functions)h(referenced)h(b)o(y)e(the)g(common)g(co)q(de)37 2262 y(m)o (ust)i(b)q(e)g(visible)i(from)e(the)f(sup)q(erclass)i(b)q(efore)g(it)f(can)g (b)q(e)g(mo)o(v)o(ed)g(there.)34 b(The)20 b(refactorings)f(de\014ned)37 2319 y (earlier)e(can)e(b)q(e)h(applied)h(to)d(mo)o(v)o(e)h(v)m(ariables)h(\(and)f (add)h(function)g(signatures\))f(to)f(the)i(sup)q(erclass.)108 2375 y(This)d (refactoring)g(is)g(applied)i(for)d(eac)o(h)h(function)g(b)q(o)q(dy)h(that)e (is)h(to)f(b)q(e)i(added)f(to)f(the)h(sup)q(erclass.)20 b(The)37 2432 y(argum\ en)o(ts)15 b(to)f(this)i(refactoring)f(are:)106 2538 y fj(\017)22 b fl(the)11 b(sub)q(class)g(implemen)o(tations)h(of)e(the)h(mem)o(b)q(er)g(function)g(\(F\ 1)f(in)h(C1,)g(and)g(F2)f(in)h(C2\))f(represen)o(ted)151 2594 y(as)15 b(a)g (list)h(of)f(alternating)g(common)g(and)g(di\013ering)h(co)q(de)g(segmen)o (ts.)952 2760 y(67)g eop bop 37 42 a fl(After)15 b(c)o(hec)o(king)h(its)g(pre\ conditions,)g(this)g(refactoring:)93 148 y(1.)22 b(for)15 b(eac)o(h)g(di\013e\ ring)h(co)q(de)g(segmen)o(t,)e(this)i(refactoring:)170 242 y(\(a\))22 b(calls) e(the)g(con)o(v)o(ert)s 14 2 v 13 w(co)q(de)s 14 2 v 14 w(segmen)o(t)s 14 2 v 13 w(to)s 14 2 v 12 w(function)g(refactoring)f(to)g(create)g(a)g(new)g(functi\ on)i(in)251 298 y(eac)o(h)h(sub)q(class.)40 b(The)22 b(name)g(of)f(the)h(new) g(function)g(is)g(automatically)g(generated)g(and)g(is)251 355 y(distinct)17 b (from)d(the)h(name)g(of)g(an)o(y)g(existing)h(mem)o(b)q(er.)1200 338 y fs(5) 168 428 y fl(\(b\))22 b(calls)16 b(the)g(refactoring)e(de\014ned)j(in)f(secti\ on)g(6.3,)e(to)g(add)i(the)f(signature)g(of)g(the)g(new)h(function)251 484 y (to)f(the)g(sup)q(erclass)h(proto)q(col)93 578 y(2.)22 b(calls)c(the)g(add)s 14 2 v 13 w(function)s 14 2 v 14 w(b)q(o)q(dy)g(refactoring)f(to)g(add)g(a)g (function)h(b)q(o)q(dy)g(to)e(the)h(mem)o(b)q(er)h(function)151 634 y(signatu\ re)d(in)i(the)e(sup)q(erclass)93 728 y(3.)22 b(calls)g(the)g(delete)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 14 w(functions)g(refactoring)f(to)g(delete)h(the)f (mem)o(b)q(er)h(function)g(from)e(the)151 785 y(sub)q(classes.)37 906 y fe (6.7.1)56 b(Preconditions)37 992 y fl(The)16 b(preconditions)h(for)d(this)i (refactoring)f(are:)93 1098 y(1.)22 b fj(9)16 b fl(mem)o(b)q(er)f fj(2)226 1155 y fl(C1.o)o(wner.sup)q(erclass.lo)q(callyDe\014nedMem)o(b)q(erF)l(unctio\ ns,)301 1211 y(where)h(mem)o(b)q(er.name)f(=)g(sub)q(classMem)o(b)q(erF)l(unc\ tion1.name)i fj(^)376 1268 y fl(mem)o(b)q(er.functionBo)q(dy)f(=)g fj(;)p fl (.)151 1324 y(\(the)f(function)h(signature,)f(but)g(not)g(the)h(function)g (b)q(o)q(dy)l(,)f(is)h(already)f(de\014ned)i(in)f(the)f(sup)q(erclass\))93 1418 y(2.)22 b(let)14 b(setOfDi\013eringCo)q(deSegmen)o(ts)h(b)q(e)f(the)g (set)f(of)h(di\013ering)g(co)q(de)h(segmen)o(ts)e(for)g(the)h(t)o(w)o(o)e(mem) o(b)q(er)151 1474 y(functions.)226 1531 y fj(8)k fl(co)q(deSegmen)o(t)f fj (2)h fl(setOfDi\013eringCo)q(deSegmen)o(ts)301 1587 y(con)o(v)o(ertibleT)l (oF)l(unctionP\(co)q(deSegmen)o(t\).)151 1644 y(\(eac)o(h)f(di\013ering)h(co) q(de)g(segmen)o(t)f(can)g(b)q(e)h(con)o(v)o(erted)f(to)f(a)h(legal)h(function\ \).)93 1738 y(3.)22 b(for)15 b(eac)o(h)g(commonCo)q(deSegmen)o(t)g(of)g(F1)f (and)i(F2,)226 1794 y fj(8)g fl(V)f fj(2)g fl(v)m(ariablesReferencedBy\(commo\ nCo)q(deSe)q(gmen)o(t\),)301 1851 y fj(8)h fl(class)f(in)h(\(C1)f fj([)g fl (C2)g fj([)g fl(C1.sup)q(erclass\))376 1907 y(class)h fj(\032)f fl(scop)q(eOf\ \(V\))451 1963 y(where)h(mem)o(b)q(er.name)f(=)g(refdV)l(ariable.name.)21 b fj (_)226 2020 y(8)16 b fl(F)e fj(2)i fl(functionsCalledBy\(commonCo)q(deSegmen) o(t\),)301 2076 y fj(8)g fl(class)f(in)h(\(C1)f fj([)g fl(C2)g fj([)g fl(C1.s\ up)q(erclass\))376 2133 y(class)h fj(\032)f fl(scop)q(eOf\(F\).)151 2189 y (\(the)21 b(scop)q(e)g(of)f(all)i(v)m(ariables)g(and)f(functions)h(referenced) g(b)o(y)e(the)h(common)g(co)q(de)g(includes)i(the)151 2246 y(sup)q(erclass)16 b(and)g(b)q(oth)f(sub)q(classes\).)37 2329 y 750 2 v 89 2356 a fu(5)107 2372 y fp(The)e(refactoring)h fm(change)r 12 2 v 10 w(memb)n(er)r 12 2 v 12 w(functi\ on)r 12 2 v 9 w(name)e fp(could)i(later)g(b)q(e)f(applied)j(to)d(mak)o(e)g (the)g(name)g(more)h(descriptiv)o(e.)952 2760 y fl(68)g eop bop 37 42 a fe (6.7.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 127 y fl(F)l(or)f(step)g(1-\(\ a\),)f(a)h(call)h(to)e(con)o(v)o(ert)s 14 2 v 13 w(co)q(de)s 14 2 v 14 w(segm\ en)o(t)s 14 2 v 13 w(to)s 14 2 v 13 w(function:)24 b(precondition)19 b(1)e (\(eac)o(h)f(new)i(function)37 184 y(is)e(a)f(legal)h(function\))g(is)g(satis\ \014ed)f(b)o(y)g(precondition)i(2)e(of)g(this)g(refactoring.)108 240 y(F)l (or)d(step)h(1-\(b\),)g(a)f(call)i(to)f(the)g(refactoring)f(de\014ned)j(in)e (section)h(6.3:)k(precondition)c(1)f(\(the)f(signatures)37 297 y(of)g(the)h (mem)o(b)q(er)f(function)h(in)g(b)q(oth)f(sub)q(classes)i(matc)o(h\))d(is)i (satis\014ed)f(the)h(results)f(of)g(the)g(prior)h(step,)f(where)37 353 y(eac) o(h)18 b(new)g(function)g(is)g(created)g(in)g(b)q(oth)g(sub)q(classes)h(with) f(the)f(same)h(signature;)g(precondition)h(2)f(\(the)37 410 y(mem)o(b)q(er)h (function)f(is)h(not)e(lo)q(cally)j(de\014ned)f(in)g(the)f(sup)q(erclass\))h (is)f(satis\014ed)g(b)q(ecause)h(b)o(y)f(construction)37 466 y(the)e(new)f (function)h(has)f(a)g(unique)i(name.)108 523 y(F)l(or)i(step)h(2,)g(in)h(the) f(call)h(to)e(add)s 14 2 v 13 w(function)s 14 2 v 15 w(b)q(o)q(dy:)29 b(preco\ ndition)22 b(1)d(\(all)i(v)m(ariables)g(and)f(functions)37 579 y(referenced) 15 b(in)g(the)f(function)h(b)q(o)q(dy)f(are)g(visible)i(from)d(the)h(sup)q (erclass\))g(is)h(satis\014ed)f(b)o(y)g(precondition)h(3)f(of)37 635 y(this)j (refactoring;)e(precondition)j(2)d(\(the)h(mem)o(b)q(er)g(function)h(is)g(unr\ eferenced)g(lo)q(cally)h(in)e(the)g(sup)q(erclass)37 692 y(or)f(the)g(sup)q (erclass)i(is)e(abstract\))f(is)i(satis\014ed)g(b)q(ecause)g(the)f(sup)q(ercl\ ass)h(is)g(abstract.)108 748 y(F)l(or)11 b(step)g(3,)h(in)g(the)g(call)h(to)d (delete)s 14 2 v 15 w(mem)o(b)q(er)s 14 2 v 13 w(functions:)19 b(precondition) 13 b(1)e(\(the)h(function)g(to)f(b)q(e)h(deleted)37 805 y(is)17 b(unreference\ d)g(or)f(redundan)o(t\))g(is)g(satis\014ed)h(b)q(ecause,)f(as)g(a)f(result)i (of)e(the)h(prior)g(step,)g(the)g(function)h(is)37 861 y(redundan)o(t.)108 918 y(This)f(refactoring)f(is)g(constructed)h(using)g(b)q(eha)o(vior)g(preserving) g(refactorings)e(and,)h(since)i(it)e(satis\014es)37 974 y(the)h(preconditions) g(of)f(those)g(refactorings,)g(b)q(eha)o(vior)g(is)h(preserv)o(ed.)37 1114 y fd(6.8)70 b(Discussion)37 1217 y fe(6.8.1)56 b(Reducing)18 b(In)n(teraction)g (with)g(the)h(Designer)37 1303 y fl(Giv)o(en)i(t)o(w)o(o)e(concrete)h(classes\ ,)h(it)g(is)f(p)q(ossible)i(to)e(de\014ne)h(a)f(higher)h(lev)o(el)g(refactori\ ng)f(that)f(automati-)37 1359 y(cally)h(creates)e(a)g(new)g(common)g(sup)q (erclass)h(that)e(has)i(no)f(instances)h(and)f(whic)o(h)h(con)o(tains)f(simil\ arities)37 1415 y(detectable)f(b)o(y)e(structural)g(analysis,)g(using)h(the)g (follo)o(wing)g(algorithm:)106 1494 y fj(\017)22 b fl(create)15 b(the)g(abstr\ act)g(sup)q(erclass,)g(as)g(describ)q(ed)i(in)f(section)g(6.1)106 1580 y fj (\017)22 b fl(add)16 b(function)g(signatures)g(to)f(the)h(sup)q(erclass)h(-)e (add)h(all)h(iden)o(tical)g(signatures)f(to)f(the)h(sup)q(erclass.)151 1636 y (Going)d(b)q(ey)o(ond)i(exact)e(matc)o(hes,)g(apply)h(heuristics)h(and)e(refa\ ctorings)g(describ)q(ed)i(in)g(section)f(6.2)e(to)151 1692 y(detect)k(functio\ ns)h(with)f(similar)h(signatures,)e(refactor)g(them)h(to)f(b)q(e)h(the)g(same\ ,)f(and)h(add)g(them)g(to)151 1749 y(the)f(sup)q(erclass.)106 1835 y fj(\017) 22 b fl(mo)o(v)o(e)15 b(v)m(ariables)j(to)d(the)h(sup)q(erclass)h(-)f(the)g (same)g(algorithm)g(is)g(applied)i(as)d(in)i(the)f(previous)h(step,)151 1891 y (but)e(applied)j(to)c(mem)o(b)q(er)h(v)m(ariables,)i(as)d(describ)q(ed)k(in)e (section)f(6.6.)106 1977 y fj(\017)22 b fl(for)14 b(all)i(functions)g(whose)f (signatures)g(are)f(de\014ned)j(in)e(the)g(sup)q(erclass,)h(detect)f(common)g (co)q(de)g(and)151 2033 y(di\013ering)g(co)q(de)g(using)g(one)f(of)g(the)g (approac)o(hes)g(describ)q(ed)i(in)f(section)g(6.4.)j(Apply)e(the)e(refactori\ ng)151 2090 y(describ)q(ed)j(in)f(section)g(6.8)e(to:)202 2176 y fh({)23 b fl (separate)15 b(di\013ering)h(co)q(de)g(in)o(to)f(new)g(functions)202 2241 y fh ({)23 b fl(mo)o(v)o(e)18 b(v)m(ariables)i(and)e(add)h(function)g(signatures)g (to)e(the)i(sup)q(erclass)h(as)e(referenced)h(b)o(y)f(the)251 2297 y(common)d (co)q(de,)g(if)h(these)f(ha)o(v)o(e)g(not)g(already)h(b)q(een)g(migrated)f (to)f(sup)q(erclass.)202 2362 y fh({)23 b fl(mo)o(v)o(e)15 b(the)g(common)g (co)q(de)g(to)g(the)g(sup)q(erclass.)108 2441 y(It)i(migh)o(t)f(b)q(e)h(that) f(this)h(algorithm)g(will)h(pro)q(duce)f(go)q(o)q(d)g(results)g(in)g(practice\ ,)g(so)g(that)e(a)i(user)f(could)37 2497 y(just)h(run)f(it)h(and)f(then)h(bac) o(k)f(it)h(out)f(if)h(the)f(results)h(w)o(eren't)f(what)f(w)o(as)h(in)o(tende\ d.)25 b(Ho)o(w)o(ev)o(er)15 b(it)i(is)g(lik)o(ely)37 2554 y(that,)i(in)h(orde\ r)f(to)f(capture)h(in)h(the)f(sup)q(erclass)h(an)f(abstraction)g(that)f(the)h (user)h(can)f(understand)g(and)37 2610 y(later)d(use)f(to)g(extend)h(the)f (system,)f(some)h(user)g(in)o(teraction)h(will)h(b)q(e)f(needed.)952 2760 y (69)g eop bop 37 42 a fe(6.8.2)56 b(Other)18 b(Issues)37 127 y fl(Giv)o(en)e (t)o(w)o(o)e(classes,)h(this)h(c)o(hapter)f(de\014nes)h(an)g(approac)o(h)e (for)h(creating)g(a)g(common)g(abstract)f(sup)q(erclass)37 184 y(that)h(con)o (tains)g(a)g(set)f(of)h(mem)o(b)q(er)g(function)h(signatures,)f(and)g(p)q(oss\ ibly)i(a)d(set)h(of)g(mem)o(b)q(er)g(v)m(ariables)h(and)37 240 y(the)k(partia\ l)f(implemen)o(tations)h(of)f(some)g(functions.)32 b(After)19 b(refactoring,) g(the)g(de\014nitions)i(in)f(the)f(sub-)37 297 y(classes)c(are)f(streamlined,) h(as)f(some)g(of)g(the)h(b)q(eha)o(vior)f(that)g(had)g(b)q(een)i(lo)q(cally)g (de\014ned)f(is)g(no)o(w)f(inherited.)37 353 y(The)i(commonalities)g(and)g (di\013erences)g(b)q(et)o(w)o(een)f(the)h(sub)q(classes)g(are)f(made)g(more)g (explicit.)108 410 y(A)i(related)h(issue,)g(outside)g(the)f(scop)q(e)h(of)f (this)g(c)o(hapter,)g(is)h(whether)g(an)f(algorithm)g(can)g(b)q(e)h(de\014ned) 37 466 y(for)g(selecting)i(from)e(a)g(set)g(of)g(classes)h(t)o(w)o(o)e(classe\ s)i(that)f(share)g(a)h(common)f(abstraction.)29 b(Recall)20 b(from)37 523 y (section)15 b(6.1)e(that)h(the)g(classes)g(that)g(shared)g(a)g(common)f(abstr\ action)h(w)o(ere)g(passed)g(as)g(argumen)o(ts)f(to)g(the)37 579 y(refactoring) 19 b(that)f(created)h(the)g(sup)q(erclass.)31 b(Casais)19 b([30)o(])f(describ) q(es)i(a)f(global)g(reorganization)g(sc)o(heme)37 635 y(that)12 b(is)i(based) e(on)h(recognizing)h(classes)f(with)g(common)f(attributes.)19 b(Classes)13 b (are)f(automatically)h(brough)o(t)37 692 y(together)j(that)g(share)g(common)g (attributes,)g(and)h(higher)g(lev)o(el)h(classes)e(are)h(in)o(tro)q(duced)g (to)f(con)o(tain)g(the)37 748 y(common)f(mem)o(b)q(ers.)20 b(One)c(shortcomin\ g)e(of)h(this)g(approac)o(h)g(is)g(that)f(in)i(c)o(ho)q(osing)f(classes)h(wit\ h)f(common)37 805 y(attributes)d(it)h(lo)q(oks)f(only)h(for)e(matc)o(hing)i (names.)18 b(Also,)13 b(its)g(ma)s(jor)d(motiv)m(ation)j(is)f(to)g(remo)o(v)o (e)f(duplication)37 861 y(of)17 b(attributes)f(and)h(not)f(to)g(mo)q(del)h (reusable)h(design)g(abstractions.)23 b(Th)o(us,)17 b(newly)g(de\014ned)h(cla\ sses)f(ma)o(y)37 918 y(not)d(corresp)q(ond)h(to)f(meaningful)h(design)h(abstr\ actions)e(and)g(hence)h(the)g(design)g(ma)o(y)f(b)q(e)h(made)f(less)h(clear) 37 974 y(b)o(y)h(the)f(automatic)g(reorganization.)108 1031 y(Inferring)i(a)e (common)g(abstraction)g(from)g(similar)i(names)e(and)h(other)f(structural)h (similarities)i(is)e(not)37 1087 y(fo)q(olpro)q(of)21 b(\(as)f(sho)o(wn)h(in) h(section)f(6.2\).)36 b(Consider)22 b(an)e(extreme)h(example,)i(where)e(t)o (w)o(o)f(classes)h(b)q(oth)37 1144 y(con)o(tain)d(the)f(v)m(ariables)h fi(dep) n(endencies,)f(p)n(arts)g fl(and)g fi(r)n(esour)n(c)n(es)p fl(,)f(and)i(the)f (functions)g fi(start,)i(r)n(e)n(dir)n(e)n(ct,)e(halt)37 1200 y fl(and)h fi (maintain)p fl(.)27 b(These)18 b(classes)g(are)f(structurally)i(quite)f(simil\ ar,)h(but)f(if)g(one)f(class)h(represen)o(ts)g(an)g ff(Au-)37 1256 y(tomobile) d fl(and)i(the)g(other)g(class)g(represen)o(ts)g(a)g ff(Soft)o(w)o(a)o(re)f (Project)p fl(,)h(they)h(probably)f(don't)g(share)g(a)f(useful)37 1313 y(comm\ on)f(abstraction.)k(F)l(requen)o(tly)l(,)c(attributes)f(with)h(the)g(same)f (name)h(ha)o(v)o(e)f(v)o(ery)g(di\013eren)o(t)h(meanings;)37 1369 y(con)o(v)o (ersely)l(,)h(classes)f(that)f(share)h(a)f(common)h(abstraction)f(ma)o(y)g (ha)o(v)o(e)g(attributes)h(that)f(are)h(named)g(quite)37 1426 y(di\013eren)o (tly)l(,)i(due)f(to)f(acciden)o(t)i(or)e(history)l(.)22 b(Th)o(us,)15 b(en)o (tirely)i(automating)e(this)h(pro)q(cess)g(is)g(unlik)o(ely)i(to)d(b)q(e)37 1482 y(successful.)108 1539 y(The)d(refactorings)g(de\014ned)h(here)g(assumed) f(that)f(the)i(abstract)e(sup)q(erclass)i(w)o(as)e(created)h(based)g(on)g(the) 37 1595 y(commonalities)18 b(b)q(et)o(w)o(een)e fi(two)g fl(classes.)23 b(As) 16 b(noted)g(earlier,)h(it)f(can)g(b)q(e)h(generalized)h(to)d(w)o(ork)g(with) h(three)37 1652 y(or)h(more)f(classes.)26 b(In)17 b(some)g(cases)g(it)g(ma)o (y)f(b)q(e)i(desirable)g(to)e(create)h(an)g(abstract)f(sup)q(erclass)i(with)f (only)37 1708 y(one)g(sub)q(class.)24 b(Con\014dence)17 b(that)f(a)g(reusable) h(abstraction)f(has)g(b)q(een)h(found)g(cannot)f(b)q(e)h(attained)f(un)o(til) 37 1765 y(it)i(has)f(b)q(een)h(applied)h(to)e(more)g(than)g(one)g(concrete)g (example)h(in)g(the)g(problem)g(domain.)26 b(Nonetheless,)37 1821 y(these)16 b (refactorings)f(can)g(b)q(e)h(applied)h(to)d(migrate)h(b)q(eha)o(vior)h(from) e(a)h(single)i(class)e(to)g(its)g(sup)q(erclass.)952 2760 y(70)g eop bop 37 353 a fc(Chapter)35 b(7)37 560 y fb(Refactoring)42 b(T)-10 b(o)40 b(Sp)s(ecia\ lize:)37 685 y(Sub)s(classing,)i(and)d(Simplifyi)q(ng)37 809 y(Conditional)q (s)37 1050 y fd(7.1)70 b(Motiv)l(ation)37 1152 y fl(Sometimes)16 b(the)f(desi\ gn)g(of)g(an)f(ob)s(ject-orien)o(ted)h(application)i(framew)o(ork)c(can)i(b)q (e)g(impro)o(v)o(ed)g(b)o(y)g(decom-)37 1208 y(p)q(osing)i(a)e(large,)h(compl\ ex)g(class)h(in)o(to)e(sev)o(eral)h(smaller)h(classes.)k(The)16 b(complex)h (class)f(usually)h(em)o(b)q(o)q(dies)37 1265 y(b)q(oth)f(a)g(general)g(abstra\ ction)g(and)g fi(sever)n(al)f(di\013er)n(ent)g fl(concrete)h(cases)g(that)f (are)h(candidates)g(for)g(sp)q(ecial-)37 1321 y(ization.)21 b(One)15 b(clue)g (for)f(ho)o(w)f(to)h(decomp)q(ose)h(suc)o(h)f(a)g(complex)h(class)g(is)f(to)g (analyze)h(the)f(set)g(of)g(\015ags,)f(tags)37 1378 y(and)j(conditional)h(sta\ temen)o(ts)d(con)o(tained)i(in)g(the)f(class.)108 1434 y(This)i(c)o(hapter)f (describ)q(es)h(ho)o(w)f(to)f(sp)q(ecialize)k(a)d(class)g(b)o(y)g(adding)h (sub)q(classes)g(corresp)q(onding)g(to)e(the)37 1490 y(conditions)i(in)g(a)e (conditional)j(statemen)o(t.)i(F)l(or)15 b(eac)o(h)h(condition,)h(a)e(sub)q (class)i(\(represen)o(ting)f(a)f(subt)o(yp)q(e\))37 1547 y(is)j(created)f(who\ se)g(design)h(abstraction)e(implies)j(that)d(condition.)27 b(In)17 b fi(C++)p fl(,)f(the)h(class)h(proto)q(col)e(is)i(not)37 1603 y(su\016cien)o(t)j(to)e (describ)q(e)i(this)f(design)h(abstraction)e(b)q(ecause)h(it)g(do)q(es)g(not) f(mak)o(e)g(explicit)j(the)e(in)o(v)m(arian)o(t)37 1660 y(conditions)e(of)d (a)h(class.)23 b(T)l(o)16 b(represen)o(t)g(this)g(design)h(information,)g(the) f(class)g(proto)q(col)g(is)h(supplemen)o(ted)37 1716 y(with)f(a)f fi(class)g (invariant)p fl(.)108 1773 y(Sp)q(ecializi)q(ng)j(a)d(class)g(and)h(simplifyi\ ng)h(conditionals)g(in)o(v)o(olv)o(es)f(sev)o(eral)f(steps:)93 1858 y(1.)22 b (c)o(ho)q(osing)16 b(a)f(conditional)h(whose)g(conditions)g(suggest)f(sub)q (classes)93 1949 y(2.)22 b(for)g(eac)o(h)h(condition)h(in)g(the)f(conditional\ ,)j(creating)d(a)f(sub)q(class)i(with)f(a)g(class)g(in)o(v)m(arian)o(t)g(that) 151 2005 y(matc)o(hes)15 b(the)g(condition)93 2095 y(3.)22 b(cop)o(ying)14 b (the)f(b)q(o)q(dy)h(of)f(the)h(conditional)h(to)d(eac)o(h)i(sub)q(class,)g (and)g(in)g(eac)o(h)f(sub)q(class)i(simplifying)g(the)151 2152 y(conditional) i(based)f(on)f(the)g(in)o(v)m(arian)o(t)h(that)e(is)i(true)f(for)g(the)g(sub) q(class)93 2242 y(4.)22 b(sp)q(ecializin)q(g)17 b(some)d(\(or)f(all\))i(expre\ ssions)h(that)d(create)i(instances)g(of)f(the)g(sup)q(erclass.)21 b(Sp)q(ecia\ lizi)q(ng)151 2299 y(an)16 b(expression)h(in)o(v)o(olv)o(es)g(replacing)h(an) e(expression)h(that)e(creates)h(an)g(instance)h(of)f(the)g(sup)q(erclass)151 2355 y(with)j(an)f(expression)h(that)e(creates)h(an)g(instance)h(of)f(one)h (of)e(the)i(newly)g(created)f(sub)q(class.)30 b(This)151 2412 y(can)14 b(b)q (e)h(done)f(safely)h(only)f(if)h(all)g(instances)g(created)f(b)o(y)g(the)g (expression)h(are)e(kno)o(wn)h(to)g(satisfy)f(the)151 2468 y(in)o(v)m(arian)o (t)j(de\014ned)g(on)g(a)e(sub)q(class.)108 2554 y(Cho)q(osing)19 b(the)f(`cor\ rect')g(conditional)i(up)q(on)f(whic)o(h)g(to)f(partition)h(a)f(class)h(\(ste\ p)f(one\))g(dep)q(ends)j(on)37 2610 y(the)14 b(abstraction)e(that)g(the)h(des\ igner)h(in)o(tends.)20 b(A)13 b(to)q(ol)g(could)h(assist)f(the)g(designer)g (in)h(making)f(this)h(c)o(hoice)952 2760 y(71)g eop bop 37 42 a fl(b)o(y)15 b (displa)o(ying)h(the)e(conditionals)i(that)e(app)q(ear)g(in)i(mem)o(b)q(er)e (functions)h(of)f(the)h(class,)f(highligh)o(ting)j(those)37 98 y(conditionals) g(that)e(app)q(ear)g(most)g(frequen)o(tly)l(.)108 154 y(This)j(c)o(hapter)e (de\014nes)i(refactorings)f(for)f(steps)h(t)o(w)o(o)f(through)g(four.)25 b (These)17 b(steps)g(are)g(de\014ned)h(here)37 211 y(as)f(separate)f(refactori\ ngs,)g(mostly)g(for)g(clarit)o(y)h(but)f(also)h(b)q(ecause)g(they)g(could)h (b)q(e)f(in)o(v)o(ok)o(ed)g(separately)l(.)37 267 y(Sp)q(ecializi)q(ng)d(inst\ ances)e(can)f(sometimes)g(b)q(e)h(done)f(automatically)l(,)h(but)f(in)h(some) f(cases)g(an)g(instance)h(of)e(the)37 324 y(sup)q(erclass)17 b(migh)o(t)f(sat\ isfy)g(the)f(in)o(v)m(arian)o(ts)i(of)e(sev)o(eral)h(sub)q(classes.)23 b(Cho) q(osing)16 b(among)f(these)h(sub)q(classes)37 380 y(ma)o(y)f(b)q(e)h(done)f (incorrectly)i(without)e(some)g(input)h(from)e(the)i(user.)108 437 y(The)e (tec)o(hniques)i(de\014ned)f(in)g(this)f(c)o(hapter)g(rely)h(hea)o(vily)g(on) f(data)f(\015o)o(w)g(analysis)i(to)f(c)o(hec)o(k)g(that)f(class)37 493 y(in)o (v)m(arian)o(ts)18 b(hold)g(on)g(instances)g(of)e(a)h(class.)27 b(Class)17 b (in)o(v)m(arian)o(ts)h(and)f(data)g(\015o)o(w)g(analysis)h(are)f(describ)q (ed,)37 550 y(resp)q(ectiv)o(ely)l(,)22 b(in)d(sections)g(7.2)f(and)h(7.3.)29 b(Sections)20 b(7.4)d(through)i(7.9)e(describ)q(e)k(ho)o(w)d(to)g(use)h(data) f(\015o)o(w)37 606 y(analysis)g(to)e(handle)i(sev)o(eral)f(imp)q(ortan)o(t)f (issues)i(regarding)e(class)h(in)o(v)m(arian)o(ts,)h(and)f(de\014ne)g(refacto\ rings.)37 663 y(Section)e(7.10)c(discusses)k(p)q(ossible)g(extensions)f(to)e (the)h(sub)q(classing)i(algorithms)e(de\014ned)i(here;)e(other)g(uses)37 719 y (of)i(class)h(in)o(v)m(arian)o(ts)g(in)g(the)f(ob)s(ject)f(orien)o(ted)i(lite\ rature)g(are)f(also)g(discussed.)108 775 y(This)f(thesis)h(sp)q(eci\014cally) h(addresses)e(ho)o(w)g(class)g(in)o(v)m(arian)o(ts)g(can)g(b)q(e)g(used)h(for) e(simplifying)j(condition-)37 832 y(als)j(in)f(mem)o(b)q(er)h(functions)f(of) g(newly)h(created)f(sub)q(classes.)29 b(Class)18 b(in)o(v)m(arian)o(ts)g(coul\ d)h(b)q(e)g(applied)h(more)37 888 y(generally)d(in)f(refactoring,)e(whic)o (h)i(is)g(an)f(area)g(for)f(future)i(researc)o(h.)37 1032 y fd(7.2)70 b(Class) 22 b(In)n(v)l(arian)n(ts)37 1133 y fl(An)f fi(invariant)f fl(is)h(something)f (that)g(remains)h(constan)o(t)e(\(i.e.)35 b(do)q(es)21 b(not)f(c)o(hange\).) 35 b(A)20 b fi(class)g(invariant)37 1189 y fl(is)g(a)e(predicate)i(whose)e (only)i(free)f(v)m(ariables)h(are)e(mem)o(b)q(er)h(v)m(ariables)h(of)e(the)h (class.)31 b(A)19 b(class)g(in)o(v)m(arian)o(t)37 1246 y(expresses)d(general) g(consistency)g(constrain)o(ts)f(that)f(apply)i(to)f(ev)o(ery)g(instance)h (of)f(a)f(class.)108 1302 y(In)h(general,)g(determining)h(if)f(an)f(arbitrary) g(predicate)i(is)f(a)f(class)h(in)o(v)m(arian)o(t)g(is)g(undecidable.)22 b (F)l(or)14 b(the)37 1359 y(purp)q(oses)j(of)f(this)h(thesis,)g(an)g(extremely) f(narro)o(w)g(set)g(of)g(class)h(in)o(v)m(arian)o(ts)g(are)f(considered)1684 1342 y fs(1)1721 1359 y fl(whic)o(h)h(are)37 1415 y(of)e(the)h(form:)133 1522 y fg()22 b(==)h()37 1628 y fl(where:)157 1734 y fg(mem\ berVariable:)45 b(a)24 b(member)f(variable)g(of)h(the)f(class)157 1791 y(valu\ e:)261 b(an)24 b(integer,)f(or)g(the)h(value)f(of)h(an)f(enumerated)g(type.) 108 1897 y fl(F)l(or)15 b(the)g(class)g(in)o(v)m(arian)o(t)h(to)f(b)q(e)h(cor\ rect:)106 1991 y fj(\017)22 b fl(the)17 b fi(cr)n(e)n(ate)g fl(pro)q(cedure)g (for)g(the)g(class)g(\(a)f(constructor)g(function)i(in)g(C++\),)f(when)g(appl\ ied,)i(m)o(ust)151 2047 y(yield)e(a)e(state)f(satisfying)i(the)f(class)h(in)o (v)m(arian)o(t)106 2141 y fj(\017)22 b fl(the)14 b(class)g(in)o(v)m(arian)o (t)h(m)o(ust)e(hold)i(throughout)e(the)h(remainder)g(of)g(the)f(lifetime)j (of)d(eac)o(h)h(instance)h(of)151 2197 y(the)g(class.)108 2291 y(The)f(algori\ thm)g(for)g(sub)q(classing)i(and)e(simplifying)i(conditionals,)g(outlined)f (in)g(section)g(7.1,)e(in)o(v)o(olv)o(es)37 2348 y(class)j(in)o(v)m(arian)o (ts)g(at)e(sev)o(eral)i(steps.)k(Tw)o(o)14 b(imp)q(ortan)o(t)h(problems)g(ari\ se)h(regarding)f(class)h(in)o(v)m(arian)o(ts:)93 2441 y(1.)22 b(Ho)o(w)15 b (can)g(it)g(b)q(e)h(determined)h(whether)e(a)g(predicate)h(is)g(a)f(class)g (in)o(v)m(arian)o(t)h(for)f(a)g(class?)37 2523 y 750 2 v 89 2549 a fu(1)107 2565 y fp(There)e(are)g(decision)i(pro)q(cedures)g(for)d(less)i(restrictiv)o (e)h(sets)e(of)g(class)h(in)o(v)n(arian)o(ts.)952 2760 y fl(72)g eop bop 93 42 a fl(2.)22 b(Giv)o(en)16 b(a)f(correct)f(class)i(in)o(v)m(arian)o(t,)f(ho)o (w)g(can)g(it)h(b)q(e)g(used,)f(to:)170 129 y(\(a\))22 b(simplify)17 b(a)e (conditional)i(statemen)o(t?)168 196 y(\(b\))22 b(sp)q(ecialize)c(an)d(expres\ sion)h(that)f(creates)g(an)g(instance)h(of)f(the)g(sup)q(erclass?)108 284 y (None)g(of)g(these)g(issues)h(is)g(decidable,)h(in)f(general.)k(Ho)o(w)o(ev)o (er,)14 b(they)h(are)g(decidable)i(in)f(some)f(cases,)g(as)37 340 y(discussed) i(later)e(in)h(this)g(c)o(hapter.)37 459 y fe(7.2.1)56 b(Example)37 545 y fl (T)l(o)17 b(illustrate)h(ho)o(w)e(a)g(class)i(in)o(v)m(arian)o(t)f(could)h (b)q(e)f(used)g(to)g(simplify)h(a)e(conditional,)j(recall)f(the)f(example)37 601 y(sho)o(wn)i(in)g(Figure)g(7.1)e(and)i(\014rst)f(presen)o(ted)h(in)h(c)o (hapter)e(3.)30 b(In)19 b(the)g fi(T)m(yp)n(e)n(d)f(Smal)r(ltalk)g fl(\(TS\)) g(compiler,)37 658 y(instances)i(of)e(the)h ff(Flo)o(wNo)q(de)f fl(class,)i (represen)o(ting)f(a)f(basic)i(blo)q(c)o(k,)g(w)o(ere)e(con)o(tainers)h(of)f (a)g(sequence)i(of)37 714 y(straigh)o(t)d(line)i(co)q(de)f(\(assignmen)o(ts\)) e(ending)j(with)e(a)g(statemen)o(t)g(that)f(alters)h(the)h(\015o)o(w)f(of)f (con)o(trol.)26 b(The)37 771 y(ending)19 b(statemen)o(t)d(in)i(the)g(sequence) g(could)h(b)q(e)f(a)f(return)g(statemen)o(t,)f(a)h(conditional)i(jump)f(state\ men)o(t)37 827 y(or)e(an)g(unconditional)i(jump)e(statemen)o(t.)21 b(In)16 b (the)g(early)g(designs,)h(it)f(had)g(not)g(b)q(een)h(clear)f(that)f(the)h(t)o (yp)q(e)37 884 y(of)i(the)h(ending)g(statemen)o(t)e(w)o(as)h(an)g(imp)q(ortan) o(t)g(discriminator)h(among)e ff(Flo)o(wNo)q(des)p fl(.)30 b(Ho)o(w)o(ev)o (er,)18 b(as)f(the)37 940 y(design)h(matured,)e(the)h(implemen)o(tation)h(of) e ff(Flo)o(wNo)q(de)g fl(w)o(as)g(man)o(ually)h(refactored:)22 b ff(Flo)o(wNo) q(de)17 b fl(b)q(ecame)37 996 y(an)f(abstract)e(sup)q(erclass)j(and)e(the)h (concrete)f(sub)q(classes)i ff(UncondJumpFlo)o(wNo)q(de)p fl(,)e ff(CondJumpF\ lo)o(wNo)q(de)37 1053 y fl(and)h ff(ReturnFlo)o(wNo)q(de)h fl(w)o(ere)e(added\ .)108 1109 y(The)20 b(v)m(alue)i(of)e(the)g(op)q(co)q(de)h(in)g(the)f(ending) h(statemen)o(t)e(is)i(represen)o(ted)g(as)f(the)g(mem)o(b)q(er)g(v)m(ariable) 37 1166 y fi(\014nal)s 14 2 v 13 w(statement)c fl(in)g(the)g ff(Flo)o(wNo)q (de)g fl(class.)22 b(Supp)q(ose)17 b(that)e(the)h(v)m(alue)h(of)e fi(\014nal) s 14 2 v 13 w(statement)g fl(is)h(assigned)h(in)37 1222 y(the)12 b fi(cr)n (e)n(ate)e fl(pro)q(cedure)i(of)f(the)g ff(Flo)o(wNo)q(de)g fl(class)g(\(and) g(its)h(sub)q(classes,)g(and)f(that)g(there)g(are)g(no)g(assignmen)o(ts)37 1279 y(to)22 b(c)o(hange)g(the)g(v)m(alue)h(of)e(that)h(mem)o(b)q(er)g(v)m (ariable.)41 b(Then,)24 b(in)f(the)f ff(Flo)o(wNo)q(de)g fl(example)h(ab)q (o)o(v)o(e,)f(the)37 1335 y(predicate)17 b(assigned)e(as)g(the)g(class)h(in)o (v)m(arian)o(t)g(of)f(the)g(class)g ff(CondJumpFlo)o(wNo)q(de)g fl(w)o(ould)h (b)q(e:)157 1414 y fg(final_statement)22 b(==)h(conditional_jump)108 1492 y fl (Note)15 b(that)g(this)h(predicate)g(is)g(sp)q(eci\014ed)h(in)g(terms)d(of)h (a)g(\014xed)h(v)m(alue)h(of)e(the)g(mem)o(b)q(er)h(v)m(ariable.)22 b(This)37 1548 y(in)o(v)m(arian)o(t)13 b(could)f(b)q(e)g(used)g(to)f(simplify)i(the)f (conditional)h(expression)f(in)h(the)e fi(optimize)h fl(function,)h(remo)o (ving)37 1605 y(the)i(conditional)g(test)f(and)g(all)h(other)e(co)q(de)i(exce\ pt)f(a)g(co)q(de)h(segmen)o(t)e(\(S1)h(in)g ff(CondJumpFlo)o(wNo)q(de)p fl (,)g(S2)g(in)37 1661 y ff(UncondJumpFlo)o(wNo)q(de)i fl(or)f(S3)g(in)h(the)f ff(ReturnFlo)o(wNo)q(de)i fl(class\).)108 1718 y(In)f(general,)f(man)o(y)g (conditions)h(in)g(a)f(conditional)i(statemen)o(t)d(are)h(of)g(the)g(form:) 157 1796 y fg(==)37 1875 y fl(where)j fi(value)f fl (is)h(a)f(constan)o(t.)26 b(The)18 b(v)m(alue)g(of)f fi(memb)n(erV)m(ariable) g fl(is)g(often)h(set)f(b)o(y)g(an)g(assignmen)o(t)h(whose)37 1931 y(righ)o (t-hand-side)g(is)f(either)f(a)g(constan)o(t)f(or)h(a)f(parameter)h(to)f(the) h(function)h(con)o(taining)g(the)f(assignmen)o(t.)37 1988 y(In)h(the)e(latter) g(case,)h(the)f(argumen)o(t)g(in)h(calls)h(to)e(the)h(function)g(is)g(lik)o (ely)h(to)e(b)q(e)h(a)g(constan)o(t.)k(These)c(cases)37 2044 y(are)f(lik)o (ely)i(to)e(mak)o(e)g(up)g(the)h(v)m(ast)e(ma)s(jorit)o(y)g(of)h(conditional) i(simpli\014cations,)1413 2027 y fs(2)1450 2044 y fl(and)e(are)g(easy)g(to)f (c)o(hec)o(k.)37 2163 y fe(7.2.2)56 b(Discussion)37 2249 y fl(Data)12 b(\015o) o(w)g(analysis)h(tec)o(hniques)h(are)e(b)q(oth)h(safe)f(and)g(p)q(o)o(w)o(erf\ ul)h(enough)g(to)f(handle)i(some)e(cases)g(in)o(v)o(olving)37 2305 y(predicat\ es)h(b)q(eing)g(asserted)e(as)h(class)g(in)o(v)m(arian)o(ts.)19 b(The)12 b (follo)o(wing)g(section)h(pro)o(vides)f(bac)o(kground)f(on)h(data)37 2362 y (\015o)o(w)j(analysis.)37 2430 y 750 2 v 89 2457 a fu(2)107 2473 y fp(Determi\ ning)e(what)e(p)q(ercen)o(tage)h(of)f(conditionals)j(are)d(co)o(v)o(ered)h (b)o(y)f(these)g(cases)h(w)o(ould)f(require)i(an)e(exhaustiv)o(e)i(study)f (of)37 2519 y(programs,)h(b)q(ey)o(ond)h(the)e(scop)q(e)h(of)f(this)h(researc) o(h.)18 b(Soft)o(w)o(are)12 b(engineering)j(studies)e(of)f(refactoring)i(larg\ e)f(programs,)g(written)37 2564 y(in)f(sev)o(eral)g(practical)h(\(alb)q(eit)f (complicated\))h(languages)g(with)e(sev)o(eral)h(di\013eren)o(t)h(programming) f(st)o(yles,)g(is)f(an)h(area)f(for)f(future)37 2610 y(researc)o(h)k(noted)g (in)g(c)o(hapter)f(11.)952 2760 y fl(73)g eop bop 73 0 a 28483502 22365798 5920358 28680847 34403860 51046645 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Helvetica-Bold Courier-Bold %%Pages: 1 %%BoundingBox: 90 436 523 776 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 348 966 ] concat %I [ (BEFORE:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 1 -6 ] concat %I 158 461 158 461 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 195 937 ] concat %I [ (FlowNode:) ( enum {conditional_jump, unconditional_jump,) ( return_statement} final_statement;) ( void optimize\(\) {) ( if \(final_statement == conditional_jump\)) ( ) ( else if \(final_statement == unconditional_jump\)) ( ) ( else if \(final_statement == return_statement\)) ( ) ( }) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-bold-r-*-140-* /Helvetica-Bold 14 SetF %I t [ 1 0 0 1 351 794 ] concat %I [ (AFTER:) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 348 763 ] concat %I [ (FlowNode) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 114.711 718.229 ] concat %I [ ( CondJumpFlowNode:) () ( \(class invariant:) ( final_statement ==) ( conditional_jump\)) () ( void optimize\(\) {) ( ) ( }) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 332 773 201 741 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -12 -14 ] concat %I 431 774 561 742 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 460 770 460 771 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 9 -4 ] concat %I 460 770 460 771 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -1 -14 ] concat %I 376 763 376 677 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 300.458 653.494 ] concat %I [ ( UncondJumpFlowNode:) () ( \(class invariant:) ( final_statement ==) ( unconditional_jump\)) () ( void optimize\(\) {) ( ) ( }) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 477.53 718.88 ] concat %I [ ( ReturnFlowNode:) () ( \(class invariant:) ( final_statement ==) ( return_statement\)) () ( void optimize\(\) {) ( ) ( }) ] Text End End %I eop showpage %%Trailer end endTexFig 455 1545 a fh(Figure)18 b(7.1)p fl(:)h(Simplifying)f(Mem)o(b)q (er)e(F)l(unction)g fi(optimize)37 1678 y fd(7.3)70 b(Bac)n(kground:)33 b(Dat\ a)23 b(Flo)n(w)f(Analysis)37 1779 y fl(A)h(refactoring)g(that)e(simpli\014es) k(a)e(conditional)h(statemen)o(t)e(can)h(b)q(e)g(though)o(t)f(of)g(as)g(a)h (kind)h(of)e(co)q(de)37 1836 y(optimization.)j(Some)16 b(tec)o(hniques)i(that) d(help)j(in)f(optimizing)h(co)q(de)f(for)e(compilers)j(can)e(also)h(b)q(e)g (applied)37 1892 y(in)c(refactoring.)314 1876 y fs(3)352 1892 y fl(Optimizing) g(a)e(program)f(in)o(v)o(olv)o(es)i(t)o(w)o(o)e(tasks:)18 b(analyzing)12 b (the)f(program)g(and)g(mo)q(difying)37 1949 y(it.)21 b(In)15 b(general,)h(the) f(analysis)h(step)f(is)h(the)f(most)g(di\016cult.)108 2005 y(Lo)q(cal)g(optim\ izations)f(are)f(c)o(hanges)h(that)f(are)g(applied)j(to)d(sequen)o(tial)h(co) q(de)h(segmen)o(ts)e(\()p fi(b)n(asic)g(blo)n(cks)p fl(\).)37 2062 y(They)j (are)f(the)g(easiest)g(optimizations)h(to)e(implemen)o(t)j(and,)e(un)o(til)h (recen)o(tly)l(,)f(compilers)i(rarely)e(did)h(more)37 2118 y(than)g(lo)q(cal) g(optimization.)22 b(Examples)15 b(of)g(lo)q(cal)i(optimizations)f(are)f(ev)m (aluating)i(\(within)f(a)f(basic)h(blo)q(c)o(k\))37 2175 y(constan)o(t)f(expr\ essions)h(in)g(adv)m(ance)g(and)f(eliminating)j(some)c(useless)j(instructions\ .)37 2256 y 750 2 v 89 2283 a fu(3)107 2298 y fp(Not)12 b(all)j(tec)o(hniques) g(apply)g(in)f(refactoring,)g(since)g(the)f(motiv)n(ation)i(for)e(refactoring) i(is)e(di\013eren)o(t)i(from)e(the)g(motiv)n(ation)37 2344 y(for)i(optimizing) i(co)q(de)e(in)h(compilers.)23 b(In)15 b(compilers)i(the)d(optimizations)k (are)d(made)g(to)f(increase)i(the)f(sp)q(eed)g(or)g(reduce)g(the)37 2390 y (memory)k(size)g(of)e(an)i(implemen)o(tation;)k(the)18 b(resultan)o(t)i(co)q (de)e(is)h(not)f(mean)o(t)g(to)g(b)q(e)g(h)o(uman)h(readable.)34 b(Some)18 b (compiler)37 2435 y(optimization)q(s)d(restructure)e(the)f(co)q(de)g(in)h(a)f (w)o(a)o(y)g(that)g(mak)o(es)h(it)f(more)h(di\016cult)g(to)f(understand)i(b)o (y)f(a)f(h)o(uman)h(designer.)18 b(By)37 2481 y(con)o(trast,)12 b(the)f(motiv) n(ation)h(for)f(refactoring)h(is)f(to)g(pro)q(duce)g(a)g(design)h(than)g(can) f(b)q(e)g(more)f(clearly)j(understo)q(o)q(d)f(b)o(y)f(a)g(designer.)952 2760 y fl(74)g eop bop 108 42 a fl(Global)15 b(optimizations)g(are)e(more)h(complex) h(than)f(lo)q(cal)h(optimizations,)g(b)q(ecause)g(they)f(ha)o(v)o(e)f(to)h (deal)37 98 y(with)21 b(the)f(\015o)o(w)g(of)g(con)o(trol)f(across)h(basic)h (blo)q(c)o(ks.)35 b(Refactorings)20 b(that)g(simplify)i(conditionals)g(can)e (b)q(e)37 154 y(though)o(t)15 b(of)g(as)g(a)f(kind)j(of)d(global)i(optimizati\ on.)108 211 y(T)l(o)c(optimize)h(a)f(program)f(or)g(a)h(pro)q(cedure)h(within) g(a)f(program,)f(it)i(is)f(usually)i(necessary)e(to)f(determine)37 267 y(the) j(sets)g(of)f(v)m(ariables)j(read)d(and)h(up)q(dated)h(b)o(y)f(that)f(pro)q (cedure.)20 b(Unless)15 b(these)f(sets)g(can)g(b)q(e)h(determined,)37 324 y (w)o(orst)e(case)g(assumptions)h(m)o(ust)f(b)q(e)i(made.)k(F)l(or)13 b(exampl\ e,)h(if)h(the)e(pro)q(cedure)i(includes)h(a)d(call)i(to)e(another)37 380 y (pro)q(cedure,)18 b(in)g(the)e(absence)i(of)e(information)h(ab)q(out)f(the)h (called)h(pro)q(cedure)g(it)f(m)o(ust)f(b)q(e)h(assumed)g(that)37 437 y(all)h (v)m(ariables)f(visible)h(to)e(the)g(called)i(pro)q(cedure)f(will)h(b)q(e)f (read)f(and)g(up)q(dated.)24 b(This)17 b(assumption,)f(while)37 493 y(safe,)e (prev)o(en)o(ts)g(man)o(y)g(optimizations.)20 b(One)15 b(can)g(exp)q(ect)g (to)e(do)i(b)q(etter)f(if)h(the)f(e\013ects)g(of)g(a)g(call)h(are)f(more)37 550 y(carefully)i(analyzed.)21 b(The)15 b(analysis)g(of)g(the)f(e\013ects)h (of)f(a)g(call)i(is)f(generally)h(termed)f fi(interpr)n(o)n(c)n(e)n(dur)n(al) g(data)37 606 y(\015ow)i(analysis.)i fl([1)o(,)c(44)o(,)g(106)o(])37 728 y fe (7.3.1)56 b(In)n(terpro)r(cedural)17 b(Data)i(Flo)n(w)g(Analysis)37 814 y fl (A)i(pro)q(cedure)g(or)f(subprogram)f(can)h(b)q(e)h(represen)o(ted)g(as)f(a)g fi(data)h(\015ow)g(gr)n(aph)g fl(of)f(basic)g(blo)q(c)o(ks,)i(where)37 870 y (directed)c(edges)f(connecting)h(the)f(basic)g(blo)q(c)o(ks)h(represen)o(t)e (the)h(\015o)o(w)f(of)h(con)o(trol)f(within)i(the)f(pro)q(cedure.)37 927 y (The)d(calling)h(relationships)g(among)e(pro)q(cedures)i(in)f(a)f(program)f (can)i(b)q(e)g(represen)o(ted)g(using)g(a)f fi(c)n(al)r(l)h(gr)n(aph)p fl(,) 37 983 y(where)i(eac)o(h)f(no)q(de)h(represen)o(ts)f(a)g(pro)q(cedure)h(and)g (directed)g(arcs)f(represen)o(t)g(calls)h(b)q(et)o(w)o(een)g(pro)q(cedures.) 108 1039 y(The)i(\015o)o(w)f(of)g(con)o(trol)g(for)g(the)g(en)o(tire)h(progra\ m)f(can)g(b)q(e)h(represen)o(ted)g(using)g(a)g fi(data)h(\015ow)f(gr)n(aph)g fl(for)37 1096 y(eac)o(h)k(pro)q(cedure)f(and)h(a)e fi(c)n(al)r(l)h(gr)n(aph) h fl(that)e(in)o(terrelates)h(the)g(pro)q(cedures.)38 b(It)21 b(is)h(not)e (alw)o(a)o(ys)h(p)q(ossible)37 1152 y(to)d(determine)h(statically)g(what)f (sequence)h(of)f(basic)h(blo)q(c)o(ks)g(a)f(program)f(will)j(execute;)g(there\ fore,)e(it)h(is)37 1209 y(usually)e(assumed)e(that)g(all)h(paths)f(in)h(eac)o (h)f(data)g(\015o)o(w)g(graph)f(are)h(p)q(ossible.)108 1265 y(Tw)o(o)j(useful) i(sets)e(to)g(asso)q(ciate)h(with)g(eac)o(h)g(pro)q(cedure)h(call)g(are)e fi (Def)h fl(and)g fi(Use)p fl(.)30 b(A)19 b fi(Def)g fl(set)f(is)h(the)37 1322 y (set)e(of)g(v)m(ariables)h(that)e(ma)o(y)h(b)q(e)g(de\014ned)i(\(assigned\))e (during)h(a)e(call,)i(and)g(the)f fi(Use)f fl(set)h(is)g(the)g(set)g(of)g(all) 37 1378 y(v)m(ariables)h(or)d(named)i(constan)o(ts)e(that)g(ma)o(y)g(b)q(e)i (used)f(\(read\))g(in)h(the)f(call.)23 b(The)16 b fi(Def)g fl(and)g fi(Use)g fl(sets)f(for)h(a)37 1435 y(pro)q(cedure)i(can)f(b)q(e)g(computed)g(from)e (its)i(data)f(\015o)o(w)g(graph.)24 b(The)16 b(sets)g(de\014ned)i(for)e(a)g (called)j(pro)q(cedure)37 1491 y(can)d(help)g(determine)h(what)d(optimization\ s)i(are)f(p)q(ossible)i(in)f(the)f(pro)q(cedures)h(that)f(call)h(it.)108 1548 y(Some)21 b(data)g(\015o)o(w)f(problems)i(can)g(b)q(e)f(describ)q(ed)i(as)e fi (any)h(p)n(ath)f fl(problems,)i(where)f(the)f(analysis)h(is)37 1604 y(concern\ ed)e(with)e(whether)h(a)f(prop)q(ert)o(y)f(holds)i(on)f(one)h(or)f(more)f(p)q (ossible)j(paths)e(through)g(a)g(program.)37 1660 y(Other)f(data)f(\015o)o (w)f(problems)i(are)f fi(al)r(l)h(p)n(ath)g fl(problems,)f(where)h(it)f(is)h (necessary)g(to)e(determine)i(whether)g(a)37 1717 y(prop)q(ert)o(y)e(holds)h (o)o(v)o(er)f(all)h(paths.)108 1773 y(Some)h(data)e(\015o)o(w)h(problems)i (are)e(solv)o(ed)h(using)g fi(forwar)n(d)h(\015ow)f fl(analysis,)g(follo)o (wing)g(the)g(direction)h(of)37 1830 y(\015o)o(w)d(in)h(a)f(program.)j(Consid\ er,)e(for)e(example,)i(computing)f(for)g(a)f(v)m(ariable)j(reference)f(the)f (set)g(of)f(assign-)37 1886 y(men)o(ts)19 b(to)f(that)f(v)m(ariable)j(\(the)f fi(r)n(e)n(aching)f(de\014nitions)p fl(\))f(that)h(ma)o(y)g(precede)i(it)e (without)h(an)f(in)o(terv)o(ening)37 1943 y(reassignmen)o(t.)i(This)14 b(anal\ ysis)g(can)g(b)q(e)g(done)g(b)o(y)f(\014nding)i(all)f(assignmen)o(ts)g(to)e (the)i(v)m(ariable,)h(and)f(mo)o(ving)37 1999 y(forw)o(ard)g(through)h(the)h (\015o)o(w)e(graph)h(to)g(see)g(if)h(the)f(v)m(ariable)i(reference)f(in)g(que\ stion)f(can)h(b)q(e)g(reac)o(hed.)108 2056 y(Other)j(data)e(\015o)o(w)h(probl\ ems)h(are)f(solv)o(ed)g(using)h fi(b)n(ackwar)n(d)h(\015ow)e fl(analysis,)h (where)g(the)f(direction)i(of)37 2112 y(analysis)g(is)e(opp)q(osite)h(the)g (\015o)o(w)e(of)h(con)o(trol)g(of)g(the)h(program.)28 b(F)l(or)17 b(example,) j(to)d(construct)h(the)h(set)f(of)37 2169 y(references)g(to)f(a)g(v)m(ariable) h(that)f(ma)o(y)f(follo)o(w)h(a)g(particular)h(assignmen)o(t)f(\(often)g(call\ ed)h(a)f fi(de\014nition-use)37 2225 y(chain)f fl(or)e fi(du-chain)p fl(\),)h (analysis)h(can)g(b)q(e)g(done)f(b)o(y)g(\014nding)i(all)f(references)g(to)e (that)h(v)m(ariable,)h(and)g(mo)o(ving)37 2281 y(bac)o(kw)o(ard)c(through)g (the)h(\015o)o(w)f(of)g(con)o(trol)g(to)f(determine)j(if)f(the)f(assignmen)o (t)h(in)g(question)g(can)f(b)q(e)h(reac)o(hed.)108 2338 y(Man)o(y)j(data)f (\015o)o(w)h(problems)h(can)g(b)q(e)g(solv)o(ed)f(b)o(y)h(asso)q(ciating)f (with)h(eac)o(h)g(basic)g(blo)q(c)o(k)g(or)f(pro)q(cedure)37 2394 y(a)f(serie\ s)h(of)f(\\sets":)106 2488 y fj(\017)22 b fl(the)13 b fi(Gen)g fl(and)g fi (Kil)r(le)n(d)f fl(sets,)h(whic)o(h)h(are)f(\(resp)q(ectiv)o(ely\))h(the)f (sets)g(of)g(de\014nitions)h(that)f(are)f(generated)151 2545 y(b)o(y)17 b(\(o\ r)g(in)o(v)m(alidated)i(b)o(y\))e(a)g(blo)q(c)o(k.)27 b(F)l(or)17 b(example,) i(if)e(the)h(blo)q(c)o(k)g(con)o(tained)g(a)f(single)i(assignmen)o(t)151 2601 y(statemen)o(t)14 b(of)h(the)g(form:)952 2760 y(75)g eop bop 270 42 a fg(X)24 b(=)g(2;)151 148 y fl(then)17 b(the)g fi(Gen)g fl(set)g(\(for)f(v)m(ariable)i (X\))e(w)o(ould)i(the)f(v)m(alue)h(2,)f(and)g(the)g fi(Kil)r(le)n(d)f fl(set) g(\(for)g(v)m(ariable)j(X\))151 205 y(w)o(ould)d(b)q(e)g(all)g(other)f(v)m (alues)h(of)f(X)g(that)f(migh)o(t)h(ha)o(v)o(e)g(reac)o(hed)h(the)f(blo)q(c)o (k.)106 297 y fj(\017)22 b fl(the)c fi(In)e fl(and)i fi(Out)f fl(sets,)h(whic) o(h)g(are)f(\(resp)q(ectiv)o(ely\))h(the)g(sets)f(of)g(de\014nitions)i(that)e (reac)o(h)g(\(or)f(exit\))151 353 y(a)f(blo)q(c)o(k.)23 b(These)16 b(sets)f (are)g(constructed)h(from)f fi(Gen)g fl(and)h fi(Kil)r(le)n(d)f fl(sets)g(of) h(blo)q(c)o(ks)g(and)g(the)g(program)151 409 y(\015o)o(w)f(relationships)i (b)q(et)o(w)o(een)e(basic)h(blo)q(c)o(ks.)108 498 y(Solving)j(a)e(particular) h(problem)g(in)o(v)o(olv)o(es)g(de\014ning)g(and)g(generating)g(the)f fi(Gen) g fl(and)g fi(Kil)r(le)n(d)g fl(sets)g(for)37 555 y(eac)o(h)i(basic)g(blo)q (c)o(k,)h(and)f(c)o(haracterizing)g(the)g(problem)g(as)g(either)g(an)f(an)o (y)h(path)f(or)g(all)i(path)e(problem,)37 611 y(and)f(as)f(either)h(a)f(forw) o(ard)f(\015o)o(w)h(or)g(bac)o(kw)o(ard)f(\015o)o(w)h(problem.)24 b(F)l(or)15 b(example,)j(the)e(reac)o(hing)h(de\014nitions)37 668 y(problem)h(is)g(an)f (an)o(y)g(path,)g(forw)o(ard)f(\015o)o(w)g(problem.)27 b(The)17 b fi(Gen)g fl (set)g(for)f(a)h(blo)q(c)o(k)h(is)f(de\014ned)i(to)d(con)o(tain)37 724 y(the) i(de\014nitions)i(that)c(app)q(ear)i(in)h(the)e(blo)q(c)o(k)i(and)f(reac)o (h)f(the)h(end)g(of)f(the)h(blo)q(c)o(k.)28 b(The)18 b fi(Kil)r(le)n(d)e fl (set)i(for)f(a)37 781 y(blo)q(c)o(k)e(is)f(de\014ned)h(to)e(con)o(tain)h(the) g(de\014nitions)h(that)e(app)q(ear)h(somewhere)g(in)h(the)e(blo)q(c)o(k)i(but) f(do)f(not)h(reac)o(h)37 837 y(the)i(end)g(of)e(the)i(blo)q(c)o(k.)21 b(By)15 b(con)o(trast,)e(constructing)j(the)f fi(du-chain)h fl(in)o(v)o(olv)o(es)g (an)o(y)f(path,)g(bac)o(kw)o(ard)f(\015o)o(w)37 894 y(analysis.)21 b(The)14 b fi(Gen)g fl(set)f(for)h(a)f(blo)q(c)o(k)i(is)g(de\014ned)g(to)e(con)o(tain)i (the)f(set)f(of)h(statemen)o(ts)f(that)g(use)h(a)g(v)m(ariable)37 950 y(b)q (efore)20 b(it)f(is)g(de\014ned)h(in)f(that)f(blo)q(c)o(k.)32 b(The)19 b fi (Kil)r(le)n(d)f fl(set)g(for)g(a)h(blo)q(c)o(k)g(is)g(de\014ned)i(to)d(con)o (tain)h(the)f(set)h(of)37 1006 y(statemen)o(ts)c(that)f(use)i(the)f(v)m(ariab\ les)h(after)f(it)g(is)h(\(re\)de\014ned)g(in)g(the)f(blo)q(c)o(k.)108 1063 y (After)i(the)g fi(Gen)g fl(and)h fi(Kil)r(le)n(d)e fl(sets)h(ha)o(v)o(e)g(b)q (een)i(determined)f(for)f(eac)o(h)h(basic)g(blo)q(c)o(k,)g(the)f fi(In)g fl (and)g fi(Out)37 1119 y fl(sets)e(can)h(b)q(e)g(determined)g(using)g(\015o)o (w)f(graphs)g(and)h(generic)g(data)e(\015o)o(w)h(equations)h(suc)o(h)g(as)e (describ)q(ed)k(in)37 1176 y([44].)108 1232 y(Tw)o(o)h(common)g(approac)o(hes) h(for)f(solving)i(data)e(\015o)o(w)h(problems)g(are)g fi(iter)n(ative)f fl (and)h fi(structur)n(e)n(d)g fl(ap-)37 1289 y(proac)o(hes)15 b([44)o(].)k(Ite\ rativ)o(e)14 b(approac)o(hes)g([56)o(,)g(118)o(])g(rep)q(eatedly)i(tra)o(v)o (erse)d(the)h(\015o)o(w)g(graphs)g(un)o(til)h(there)g(are)37 1345 y(no)k(more) f(c)o(hanges.)30 b(Structured)19 b(solutions)h(\(e.g.,)e([7)o(,)g(67,)g(107)o (]\))g(are)g(more)g(complex,)i(but)f(ha)o(v)o(e)f(m)o(uc)o(h)37 1402 y(b)q (etter)e(w)o(orse)e(case)h(p)q(erformance.)37 1544 y fd(7.4)70 b(Chec)n(king) 22 b(Whether)g(a)i(Predicate)d(is)h(a)h(Class)g(In)n(v)l(arian)n(t)37 1645 y fl(In)d(general,)f(the)g(problem)h(of)e(determining)i(whether)f(an)f(arbitrar\ y)h(predicate)g(is)g(a)g(class)g(in)o(v)m(arian)o(t)g(is)37 1702 y(undecidabl\ e.)k(The)15 b(approac)o(h)f(tak)o(en)g(here)h(is)g(to)f(restrict)h(the)f(lang\ uage)h(of)f(class)h(in)o(v)m(arian)o(ts,)g(and)g(apply)37 1758 y(conserv)m (ativ)o(e)i(analysis)f(tec)o(hniques.)23 b(F)l(ortunately)l(,)15 b(the)h(lang\ uage)g(of)f(class)h(in)o(v)m(arian)o(ts)g(\(de\014ned)h(earlier,)37 1815 y (in)22 b(section)g(7.2\))d(is)j(expressiv)o(e)f(enough,)h(and)f(data)g(\015o) o(w)f(analysis)i(tec)o(hniques)g(p)q(o)o(w)o(erful)f(enough,)h(to)37 1871 y (handle)15 b(some)f(common)f(cases.)19 b(Data)13 b(\015o)o(w)g(tec)o(hniques) i(are)e(conserv)m(ativ)o(e;)i(if)f(a)f(class)h(in)o(v)m(arian)o(t)h(is)f(sho) o(wn)37 1928 y(to)20 b(b)q(e)i(correct)e(using)h(data)f(\015o)o(w)g(tec)o(hni\ ques)h(then)g(it)g(is)g(correct,)g(but)g(there)f(will)i(b)q(e)g(cases)e(where) h(a)37 1984 y(predicate)c(is)e(a)g(class)h(in)o(v)m(arian)o(t)g(but)f(it)g (cannot)g(b)q(e)h(v)o(eri\014ed)g(using)g(data)f(\015o)o(w)g(analysis.)1600 1968 y fs(4)108 2041 y fl(One)21 b(feature)e(of)g(these)h(predicates)h(that)e (mak)o(es)g(them)g(di\016cult)j(to)d(v)m(alidate)i(is)f(that)f(eac)o(h)h(clau\ se)37 2097 y(asserts)e(a)h(v)m(alue)h(\(or)e(range)g(of)g(v)m(alues\))i(of)e (a)h(mem)o(b)q(er)g(v)m(ariable;)i(a)e(mem)o(b)q(er)f(v)m(ariable)j(can)d(c)o (hange)h(its)37 2154 y(v)m(alue)e(o)o(v)o(er)d(time.)20 b(F)l(or)15 b(example\ ,)h(the)f(assertion:)157 2243 y fg(Y==3)37 2331 y fl(ma)o(y)c(b)q(e)h(true)f (when)h(an)f(ob)s(ject)f(is)i(\014rst)f(initialized,)k(but)c(if)h(an)f(op)q (eration)g(is)h(in)o(v)o(ok)o(ed)f(that)g(assigns)g(another)37 2388 y(v)m(alu\ e)18 b(to)e(mem)o(b)q(er)g(v)m(ariable)i fi(Y)p fl(,)d(then)i(the)f(assertion) h(no)f(longer)g(holds.)24 b(Therefore,)16 b(to)g(determine)h(that)37 2444 y (a)e(predicate)h(holds,)g(it)f(m)o(ust)g(b)q(e)h(sho)o(wn)f(that:)37 2522 y 750 2 v 89 2548 a fu(4)107 2564 y fp(There)h(are)g(program)g(analysis)j(and)d (v)o(eri\014cation)j(tec)o(hniques)f(more)e(p)q(o)o(w)o(erful)h(than)f(data)h (\015o)o(w,)f(but)g(the)g(analysis)j(is)37 2610 y(more)14 b(exp)q(ensiv)o(e)h (and)e(is)h(still)h(not)e(alw)o(a)o(ys)h(decidable.)952 2760 y fl(76)g eop bop 106 42 a fj(\017)22 b fl(the)15 b fi(cr)n(e)n(ate)g fl(pro)q(cedure)h(returns) f(a)g(state)g(implied)i(b)o(y)e(the)h(predicate)106 134 y fj(\017)22 b fl(the) d(predicate)h(implies)h(the)e(range)f(of)h(v)m(alues)h(that)e(eac)o(h)h(mem)o (b)q(er)g(v)m(ariable)h(\(in)g(the)f(predicate\))151 190 y(migh)o(t)c(hold)h (after)f(the)g(ob)s(ject)g(is)g(created.)108 290 y(The)i(\014rst)g(condition) i(can)e(b)q(e)h(easily)g(determined)g(if,)g(for)f(all)h(mem)o(b)q(er)f(v)m (ariables)h(referenced)g(in)g(the)37 347 y(predicate,)d(either)e(the)g fi(cr) n(e)n(ate)g fl(pro)q(cedure)h(assigns)f(a)g(constan)o(t)f(v)m(alue)i(to)f(eac) o(h)g(v)m(ariable,)h(or)f(eac)o(h)g(v)m(ariable)37 403 y(is)i(assigned)f(the) f(v)m(alue)i(of)e(an)h(argumen)o(t)f(to)g(the)g(create)h(pro)q(cedure)g(and)g (the)f(pro)q(cedure)i(is)f(alw)o(a)o(ys)f(called)37 460 y(with)j(constan)o (t)e(argumen)o(ts.)108 516 y(Determining)23 b(the)g(range)f(of)g(v)m(alues)i (that)d(a)i(v)m(ariable)g(migh)o(t)g(hold)g(after)f(it)g(is)h(created)g(requi\ res)37 573 y(\014nding)d(all)f(places)g(where)g(it)g(ma)o(y)e(b)q(e)i(assigne\ d)g(a)f(v)m(alue,)i(and)e(what)g(v)m(alues)h(ma)o(y)f(b)q(e)h(assigned)g(ther\ e.)37 629 y(In)o(terpro)q(cedural)14 b(all)f(paths)f(data)g(\015o)o(w)f(analy\ sis)i(is)g(a)f(\\safe")f(tec)o(hnique)j(that)d(can)i(lo)q(cate)f(all)i(assign\ men)o(ts)37 686 y(that)h(migh)o(t)g(b)q(e)h(made)f(to)g(a)g(v)m(ariable.)108 742 y(Data)22 b(\015o)o(w)g(analysis)i(can)e(determine)i(where)f(assignmen)o (ts)g(to)f(a)h(v)m(ariable)h(are)e(made)h(and)g(what)37 798 y(expressions)18 b (are)d(assigned)i(to)f(the)g(v)m(ariable.)24 b(Determining)18 b(whether)e(a)g (predicate)h(is)g(violated)g(requires)37 855 y(kno)o(wing)22 b(the)f fi(value) g fl(of)f(the)h(expressions)h(assigned)g(to)e(the)h(v)m(ariable.)39 b(In)21 b (man)o(y)g(common)f(cases)h(the)37 911 y(assigned)j(v)m(alue)g(is)f(a)f(const\ an)o(t,)i(in)f(whic)o(h)h(case)f(the)f(v)m(alue)i(is)g(kno)o(wn)e(directly)l (,)k(or)c(the)h(v)m(ariable)h(is)37 968 y(assigned)15 b(the)g(v)m(alue)g(of)f (another)g(v)m(ariable,)h(in)h(whic)o(h)f(case)f(data)g(\015o)o(w)f(analysis) j(can)e(b)q(e)h(used)g(to)e(attempt)37 1024 y(to)g(determine)i(the)e(set)h (of)f(reac)o(hing)h(v)m(alues)g(of)f(that)g(v)m(ariable.)21 b(Data)12 b(\015o) o(w)h(analysis)h(is)g(less)g(lik)o(ely)i(to)c(w)o(ork)37 1081 y(with)k(more)f (complicated)h(expressions.)108 1137 y(Sev)o(eral)i(factors)f(in\015uence)j (the)e(scop)q(e)g(of)g(the)g(analysis.)28 b(The)18 b(access)g(con)o(trol)g (mo)q(de)g(of)g(a)f(v)m(ariable)37 1194 y(\(priv)m(ate,)d(protected)e(or)g (public\))i(determines)g(the)e(range)h(of)f(functions)h(that)f(ma)o(y)g(refer\ ence)h(the)f(v)m(ariable.)37 1250 y(Also,)19 b(if)g(the)f(v)m(ariable)i(is)f (passed)f(b)o(y)g(reference)h(in)g(a)f(function)h(call,)h(the)e(function)i (and)e(the)g(transitiv)o(e)37 1307 y(closure)e(of)e(the)h(set)f(of)g(function\ s)h(whic)o(h)h(migh)o(t)e(receiv)o(e)i(the)e(argumen)o(t)g(b)o(y)h(reference) g(m)o(ust)f(b)q(e)h(c)o(hec)o(k)o(ed.)108 1363 y(Data)g(\015o)o(w)h(analysis) i(is)f(less)g(lik)o(ely)h(to)e(b)q(e)h(able)h(to)e(detect)g(when)h(a)g(predic\ ate)g(holds)g(if)g(the)g(v)m(ariable)37 1419 y(b)q(eing)e(analyzed)g(is)f(par\ t)f(of)g(a)g(v)m(arian)o(t)h(\014eld,)h(or)e(p)q(oin)o(ters)h(to)f(the)g(v)m (ariable)i(are)e(passed)h(and)g(manipulated)37 1476 y(using)19 b(p)q(oin)o (ter)f(arithmetic)g(and)f(other)g(\(dangerous\))g(op)q(erations.)26 b(Suc)o (h)18 b(features)g(mak)o(e)e(it)i(di\016cult)h(or)37 1532 y(imp)q(ossible)14 b (to)d(determine)i(where)f(a)f(v)m(ariable)i(is)f(assigned.)19 b(F)l(ortunatel\ y)l(,)12 b(few)f(ob)s(ject)g(orien)o(ted)h(languages)37 1589 y(allo)o(w)19 b (p)q(oin)o(ter)h(arithmetic)f(and)g(similar)h(op)q(erations.)30 b(C++)19 b (is)h(an)e(exception,)j(since)e(it)g(is)h(a)e(sup)q(erset)37 1645 y(of)h(C.)f (Ho)o(w)o(ev)o(er,)g(sub)q(classing)j(can)e(eliminate)h(the)f(need)h(for)e (v)m(arian)o(t)h(structures)f(in)i(C++,)g(and)f(C++)37 1702 y(encourages)d (a)f(st)o(yle)g(that)f(in)o(v)o(olv)o(es)i(few)o(er)f(p)q(oin)o(ter)h(manipul\ ations)g(than)f(do)q(es)h(C.)37 1844 y fd(7.5)70 b(Refactoring:)30 b(Create) 22 b(Sub)r(classes)g(and)i(Assign)f(In)n(v)l(arian)n(ts)37 1946 y fl(The)17 b (\014rst)f(imp)q(ortan)o(t)g(step)g(in)h(the)g(refactoring)e(pro)q(cess)i(is) g(to)e(create)i(the)f(new)g(sub)q(classes,)i(and)e(assign)37 2002 y(the)21 b (class)g(in)o(v)m(arian)o(ts.)37 b(This)21 b(refactoring)f(creates)g(sub)q (classes)i(that)e(corresp)q(ond)h(to)f(the)g(en)o(umerated)37 2058 y(v)m(alue\ s)d(of)e(a)g(mem)o(b)q(er)g(v)m(ariable.)108 2115 y(The)h(argumen)o(ts)e(to)g (this)i(refactoring)f(are:)106 2204 y fj(\017)22 b fl(the)15 b(class)h(b)q (eing)g(sp)q(ecialized)j(\(C\))106 2297 y fj(\017)j fl(the)15 b(mem)o(b)q(er) h(v)m(ariable)g(\(en)o(umeratedMem)o(b)q(erV)l(ar\))f(w)o(as)f(en)o(umerated) h(v)m(alues)i(are)d(used)i(to)f(create)151 2353 y(sub)q(classes.)37 2453 y (After)g(c)o(hec)o(king)h(its)g(preconditions,)g(this)g(refactoring)f(\(for)f (eac)o(h)h(en)o(umerated)g(v)m(alue\):)93 2554 y(1.)22 b(calls)17 b(the)f(cre\ ate)s 14 2 v 14 w(empt)o(y)s 14 2 v 13 w(class)g(refactoring)g(to)f(create)h (a)g(sub)q(class,)h(whose)f(name)g(corresp)q(onds)g(to)151 2610 y(the)f(en)o (umerated)h(v)m(alue)952 2760 y(77)g eop bop 93 42 a fl(2.)22 b(calls)17 b (the)e(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(function)i(refactoring) e(to)g(add)h(a)f(constructor)g(\()p fi(ie)g fl(create\))g(function)h(to)151 98 y(the)g(sub)q(class.)23 b(The)16 b(constructor)f(function)i(establishes)g(ini\ tial)h(conditions)f(implied)h(b)o(y)e(the)g(class)151 154 y(in)o(v)m(arian)o (t.)21 b(F)l(or)14 b(example,)i(if)f(the)h(class)f(in)o(v)m(arian)o(t)h(is:) 270 267 y fg(X==3,)151 392 y fl(the)f(constructor)g(will)i(assign)e(the)g(v)m (alue)i fi(3)e fl(to)g(mem)o(b)q(er)g(v)m(ariable)i fi(X)p fl(.)93 517 y(3.) 22 b(assigns)15 b(a)g(predicate)h(to)f(the)g(class)h(as)f(the)g(class)g(in)o (v)m(arian)o(t.)37 639 y fe(7.5.1)56 b(Preconditions)37 724 y fl(The)16 b(pre\ conditions)h(for)d(this)i(refactoring)f(are:)106 831 y fj(\017)22 b(8)16 b fl (C)f fj(2)g fl(Program.classes,)226 887 y fj(8)h fl(en)o(umV)l(al)g fj(2)f fl (en)o(umeratedMem)o(b)q(erV)l(ar.t)o(yp)q(e,)301 944 y(C.name)g fj(6)p fl(=)g (en)o(umV)l(al.name.)151 1000 y(\(none)g(of)g(the)g(names)h(of)e(the)i(en)o (umerated)f(v)m(alues)h(clash)g(with)g(the)f(names)g(of)g(existing)h(classes\ \).)106 1094 y fj(\017)22 b(8)16 b fl(F)e fj(2)i fl(\(C.lo)q(callyDe\014nedMe\ m)o(b)q(erF)l(unctions)i fj([)d fl(inheritedMem)o(b)q(erF)l(unctions\(C\)\),) 226 1150 y fj(8)h fl(en)o(umV)l(al)g fj(2)f fl(en)o(umeratedMem)o(b)q(erV)l (ar.t)o(yp)q(e,)301 1207 y(F.name)g fj(6)p fl(=)g(en)o(umV)l(al.name.)151 1263 y(\(none)h(of)g(the)g(names)g(of)g(the)g(en)o(umerated)g(v)m(alues)h(clash)g (with)g(the)f(names)g(of)f(mem)o(b)q(er)i(functions)151 1320 y(of)e(the)g(sup) q(erclass\).)37 1441 y fe(7.5.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 1527 y fl(F)l(or)d(create)s 14 2 v 13 w(empt)o(y)s 14 2 v 13 w(class:)21 b(precond\ ition)16 b(1)f(\(the)g(name)g(do)q(esn't)g(clash)h(with)g(an)f(already)g(exis\ ting)h(class\))37 1584 y(is)g(satis\014ed)g(b)o(y)f(precondition)i(1)e(of)f (this)i(refactoring.)108 1640 y(F)l(or)g(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(function:)24 b(preconditions)19 b(1)d(and)i(2)e(\(the)h(name)g (of)f(the)h(constructor)g(function)37 1697 y(do)q(esn't)e(clash)g(with)f(an)h (already)f(lo)q(cally)i(de\014ned)g(mem)o(b)q(er)e(function,)h(and)g(has)f (a)g(compatible)h(signature)37 1753 y(with)i(an)o(y)f(inherited)i(function)f (with)g(the)f(same)g(name\))g(are)g(satis\014ed)h(b)o(y)f(precondition)i(2)e (of)g(this)h(refac-)37 1809 y(toring;)d(precondition)h(3)e(\(regarding)g(sub) q(classes)i(of)d(eac)o(h)i(newly)g(de\014ned)h(class\))e(is)h(satis\014ed)g (b)q(ecause)g(the)37 1866 y(newly)g(created)e(classes)h(b)o(y)f(construction) h(ha)o(v)o(e)f(no)g(sub)q(classes;)i(precondition)g(4)e(\(if)g(there)h(is)f (an)h(inherited)37 1922 y(function)19 b(with)f(the)g(same)f(name,)h(either)g (the)g(inherited)i(function)e(is)g(unreferenced)h(on)f(instances)g(of)g(C)37 1979 y(\(or)f(its)h(sub)q(classes\),)h(or)e(the)h(new)f(function)i(is)f(seman) o(tically)h(equiv)m(alen)o(t)g(to)e(the)h(function)g(it)g(replaces\))37 2035 y (is)h(satis\014ed)f(b)o(y)f(precondition)i(2)e(of)g(this)h(refactoring;)g(pre\ condition)h(5)e(\(the)h(function)g(will)h(compile\))g(is)37 2092 y(satis\014e\ d)i(b)q(ecause)f(the)f(mem)o(b)q(er)h(v)m(ariables)h(are)e(visible)j(to)d(the) g(constructor,)g(and)h(the)g(assignmen)o(t)f(is)37 2148 y(t)o(yp)q(e-correct.) 108 2205 y(The)e(third)g(step)f(\(attac)o(hing)f(a)i(predicate)g(as)f(the)g (class)h(in)o(v)m(arian)o(t\))f(do)q(es)h(not)f(c)o(hange)g(the)h(b)q(eha)o (vior)37 2261 y(of)d(the)f(program)g(b)q(ecause)h(it)g(is)g(design)g(informat\ ion)g(and)g(do)q(es)f(not)g(c)o(hange)h(the)g(program)e(source)i(co)q(de.) 1893 2245 y fs(5)108 2318 y fl(This)i(refactoring)f(is)g(constructed)h(using) g(b)q(eha)o(vior)g(preserving)g(refactorings)e(and,)h(since)i(it)e(satis\014e\ s)37 2374 y(the)h(preconditions)g(of)f(those)g(refactorings,)g(b)q(eha)o(vior) g(is)h(preserv)o(ed.)37 2455 y 750 2 v 89 2482 a fu(5)107 2498 y fp(Ho)o(w)o (ev)o(er,)h(b)o(y)h(precondition)i(2)d(and)h(the)f(results)i(of)e(the)g(prior) h(step,)h(at)e(this)h(step)f(the)h(class)g(do)q(es)g(not)f(violate)i(the)37 2543 y(predicate)c(attac)o(hed)f(as)f(the)g(class)h(in)o(v)n(arian)o(t.)952 2760 y fl(78)g eop bop 37 42 a fd(7.6)70 b(Using)23 b(A)g(Class)f(In)n(v)l (arian)n(t)i(T)-6 b(o)23 b(Simplify)d(A)j(Conditional)37 143 y fl(Giv)o(en)17 b(a)e(predicate)h(kno)o(wn)g(to)f(b)q(e)h(a)f(correct)g(class)h(in)o(v)m(aria\ n)o(t,)g(this)g(section)g(describ)q(es)i(ho)o(w)d(to)g(simplify)37 199 y(cond\ itional)i(statemen)o(ts)d(in)i(the)g(functions)g(de\014ned)g(for)f(the)g(clas\ s.)20 b(The)c(algorithm)f(is:)93 282 y(1.)22 b(for)15 b(eac)o(h)g(condition)h (in)g(a)f(conditional)i(statemen)o(t,)d(reduce)i(to)e(true)h(or)g(false)g(if) h(p)q(ossible)h(based)f(on)151 339 y(the)f(class)h(in)o(v)m(arian)o(t;)93 428 y(2.)22 b(eliminate)17 b(dead)f(co)q(de)f(and)h(p)q(erform)f(other)g(simpli\ \014cations.)108 511 y(The)f(\014rst)g(step)g(is)g(a)g(sp)q(ecial)i(case)e (of)f(theorem)h(pro)o(ving)g(and,)g(in)h(general,)f(is)h(undecidable.)22 b (Ho)o(w)o(ev)o(er,)37 568 y(since)17 b(class)e(in)o(v)m(arian)o(ts)h(are)f (of)g(the)g(form:)133 650 y fg()22 b(==)h()37 741 y fl (where)16 b(the)f(v)m(alue)i(is)e(an)g(in)o(teger)h(or)f(the)g(v)m(alue)h(of) f(an)g(en)o(umerated)g(t)o(yp)q(e,)g fi(c)n(onstant)h(pr)n(op)n(agation)f fl (and)37 798 y fi(c)n(opy)i(pr)n(op)n(agation)e fl([44])f(can)i(b)q(e)g(used)f (to)g(reduce)h(some)f(conditions)h(to)f(true)g(or)g(false.)108 889 y(Constan) o(t)f(propagation)g(and)h(cop)o(y)g(propagation)g(are)g(applied)h(in)g(compil\ ers)g(to)f(detect)g(and)g(remo)o(v)o(e)37 945 y(extraneous)i(v)m(ariables,)i (and)e(impro)o(v)o(e)g(execution)h(sp)q(eed)g(b)o(y)f(replacing)h(v)m(ariable) h(references)f(with)f(their)37 1002 y(v)m(alues.)22 b(Constan)o(t)13 b(propag\ ation)i(means)g(that,)f(for)h(example,)h(if)f(the)h(assignmen)o(t:)157 1085 y fg(X=3)37 1168 y fl(is)f(follo)o(w)o(ed)f(b)o(y)g(a)f(statemen)o(t)g(that)g (references)i(the)f(v)m(ariable)h fi(X)p fl(,)e(and)h(it)h(is)f(kno)o(wn)g (that)f(the)h(v)m(alue)h(of)e fi(X)h fl(is)37 1224 y(not)h(reassigned)h(b)o (y)e(in)o(termediate)i(statemen)o(ts,)d(then)j(in)f(the)g(latter)g(statemen)o (t)f(the)h(reference)g(to)g fi(X)f fl(can)37 1281 y(b)q(e)i(replaced)h(b)o (y)e(the)g(v)m(alue)i fi(3)p fl(.)j(Cop)o(y)14 b(propagation)h(means)g(that,) f(for)h(example,)h(if)f(the)g(assignmen)o(t:)157 1363 y fg(Y=X)37 1446 y fl (is)e(follo)o(w)o(ed)f(b)o(y)g(a)f(statemen)o(t)g(that)g(references)i fi(Y)p fl(,)e(and)h(it)g(is)g(kno)o(wn)g(that)f(neither)i fi(X)e fl(nor)h fi(Y)f fl (are)h(reassigned)37 1503 y(b)o(y)j(in)o(termediate)g(statemen)o(ts,)e(then)i (in)h(the)e(latter)g(statemen)o(t)g(the)h(reference)g(to)f fi(Y)g fl(can)h (b)q(e)g(replaced)h(b)o(y)37 1559 y(a)d(reference)h(to)e fi(X)p fl(.)g(There) h(are)g(man)o(y)f(algorithms)h(for)f(simplifying)k(expressions)d(b)o(y)g(p)q (erforming)g(constan)o(t)37 1616 y(propagation)i(and)h(cop)o(y)f(propagation) f([44)o(].)108 1672 y(These)22 b(tec)o(hniques)i(can)e(b)q(e)g(applied)i(for) d(simplifying)k(conditional)e(statemen)o(ts.)39 b(F)l(or)21 b(a)h(v)m(ariable) 37 1729 y(referenced)16 b(in)e(a)g(condition,)h(an)f(an)o(y)g(path,)g(forw)o (ard)f(\015o)o(w)g(analysis)i(can)f(b)q(e)h(used)f(to)g(compute)g(the)g(set)g (of)37 1785 y fi(r)n(e)n(aching)g(de\014nitions)p fl(,)d(that)h(is,)i(the)e (set)h(of)f(de\014nitions)j(to)d(the)h(v)m(ariable)h(that)e(migh)o(t)h(reac)o (h)f(the)h(reference.)37 1842 y(If)h(only)h(one)e(assignmen)o(t)h(to)f(a)g (v)m(ariable)j(can)d(\\reac)o(h")g(a)h(reference)g(to)f(that)g(v)m(ariable,)i (then)f(that)f(v)m(ariable)37 1898 y(reference)j(can)g(b)q(e)g(replaced)g(b)o (y)f(the)g(assigned)h(v)m(alue.)108 1954 y(Consider)21 b(ho)o(w)g(the)f(condi\ tions)i(in)g(the)f(ab)q(o)o(v)o(e)f ff(Flo)o(wNo)q(de)h fl(example)g(can)g (b)q(e)h(automatically)f(sim-)37 2011 y(pli\014ed.)39 b(In)21 b(the)g(class)g ff(CondJumpFlo)o(wNo)q(de)p fl(,)g(constan)o(t)f(propagation)g(based)h(on)g (the)g(class)g(in)o(v)m(arian)o(t)37 2067 y(replaces)16 b(references)g(to)e (the)h(v)m(ariable)h fi(\014nal)s 14 2 v 12 w(statement)f fl(with)g(the)g(v)m (alue)h fi(c)n(onditional)s 14 2 v 13 w(jump)p fl(,)f(resulting)h(in)37 2124 y (the)g(follo)o(wing)g(co)q(de:)157 2215 y fg(void)23 b(optimize\(\))g({)228 2271 y(if)h(\(conditional_jump)e(==)h(conditional_jump\))276 2328 y()228 2384 y(else)h(if)f(\(conditional_jump)f(==)h(unconditional\ _jump\))276 2441 y()228 2497 y(else)h(if)f(\(conditional\ _jump)f(==)h(return_statement\))276 2554 y()539 2610 y (})952 2760 y fl(79)g eop bop 108 42 a fl(Eliminating)14 b(dead)f(co)q(de)g (and)g(p)q(erforming)g(other)f(simpli\014cations)j(is)e(the)g(second)g(step)f (in)h(the)g(general)37 98 y(algorithm.)19 b(In)13 b(the)f(ab)q(o)o(v)o(e)f (example,)i(for)e(the)h(class)h ff(CondJumpFlo)o(wNo)q(de)e fl(the)h(\014rst) f(condition)i(is)g(trivially)37 154 y(true)e(and)f(the)g(conditional)i(can)f (b)q(e)f(reduced)i(to)d(co)q(de)i(segmen)o(t)f(S1.)18 b(Similarly)l(,)13 b (the)e(conditional)h(statemen)o(t)37 211 y(can)23 b(b)q(e)g(reduced)g(to)e (a)h(co)q(de)h(segmen)o(t)f(in)h(the)f(other)g(t)o(w)o(o)f(sub)q(classes.)42 b (This)22 b(step)h(w)o(ould)f(b)q(e)h(more)37 267 y(complicated)17 b(if)f(for) e(example)i(the)g(conditional)g(tests)f(had)g(side)i(e\013ects.)108 324 y(Mor\ e)c(p)q(o)o(w)o(erful)g(simpli\014cations)i(can)f(b)q(e)f(p)q(erformed)h(b)o (y)f(applying)h(constan)o(t)f(and)g(cop)o(y)g(propagation)37 380 y(using)24 b (class)e(in)o(v)m(arian)o(ts)h(and)g(other)f(program)f(prop)q(erties)i(determ\ inable)h(using)f(data)f(\015o)o(w)g(analysis.)37 437 y(These)d(tec)o(hniques) g(could)f(b)q(e)h(applied)g(to)e(simplify)j(some)d(conditionals)i(that)e(test) g(the)h(v)m(alue)h(returned)37 493 y(from)h(a)h(function)g(call,)i(if)e(the)g (v)m(alues)h(returned)f(from)f(the)g(function)i(could)f(b)q(e)h(en)o(umerated\ .)36 b(These)37 550 y(tec)o(hniques)17 b(can)e(also)g(b)q(e)h(applied)h(to)e (simplify)i(expressions)f(other)f(than)g(conditional)i(statemen)o(ts.)37 693 y fd(7.7)70 b(Refactoring:)30 b(Migrate)22 b(&)i(Simplify)c(Conditionals)37 794 y fl(In)14 b(this)f(step,)g(the)g(conditional)h(statemen)o(ts)e(to)g(b)q(e)h (simpli\014ed)i(are)e(separated)f(in)o(to)h(new)g(functions,)h(whic)o(h)37 851 y(are)h(copied)i(in)o(to)e(the)g(sub)q(classes)i(and)e(simpli\014ed.)108 907 y (This)23 b(refactoring)g(simpli\014es)i fi(a)d fl(conditional)j(statemen)o (t.)41 b(It)23 b(separates)f(the)h(conditional)h(in)o(to)f(a)37 964 y(separat\ e)15 b(function,)h(copies)g(it)f(in)o(to)g(the)h(sub)q(classes)g(and,)f(in)h (eac)o(h)f(sub)q(class,)h(simpli\014es)i(the)d(conditional)37 1020 y(based)h (on)f(the)g(class)h(in)o(v)m(arian)o(t.)k(The)c(argumen)o(t)e(to)h(this)g(ref\ actoring)g(is:)106 1114 y fj(\017)22 b fl(the)15 b(conditional)i(statemen)o (t)37 1220 y(After)e(c)o(hec)o(king)h(its)g(precondition)h(\(whic)o(h)e(is)h (the)f(same)g(as)g(the)g(precondition)i(for)e(the)g(primitiv)o(e)37 1277 y (refactoring)g(con)o(v)o(ert)s 14 2 v 13 w(co)q(de)s 14 2 v 14 w(segmen)o(t)s 14 2 v 13 w(to)s 14 2 v 13 w(function\),)g(this)h(refactoring:)93 1383 y(1.) 22 b(calls)c(the)e(con)o(v)o(ert)s 14 2 v 13 w(co)q(de)s 14 2 v 14 w(segmen)o (t)s 14 2 v 13 w(to)s 14 2 v 12 w(function)i(refactoring)e(to)f(separate)h (the)g(conditional)i(in)o(to)f(a)151 1439 y(separate)e(function,)g(assigning) h(it)g(a)f(unique)h(name)93 1533 y(2.)22 b(constructs)17 b(the)g(sets)g(of)g (all)h(mem)o(b)q(er)g(functions)g(and)f(v)m(ariables)i(referenced)f(b)o(y)f (the)g(conditional.)151 1590 y(F)l(or)e(eac)o(h)g(mem)o(b)q(er)g(where)h(mem) o(b)q(er.accessCon)o(trolMo)q(de)e(=)i(priv)m(ate,)f(calls)151 1646 y(c)o(han\ ge)s 14 2 v 14 w(access)s 14 2 v 13 w(con)o(trol)s 14 2 v 13 w(mo)q(de)h(to)e (mak)o(e)h(it)g(protected.)93 1740 y(3.)22 b(calls)15 b(the)g(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(function)g(refactoring)f(to)g(cop)o(y)g(the)g (new)g(function)h(to)f(eac)o(h)g(of)g(the)g(new)151 1796 y(sub)q(classes)93 1890 y(4.)22 b(if)11 b(\014rstConditionImpliedB)q(yIn)o(v)m(ari)q(an)o(t\(con\ ditional)j(statemen)o(t,)c(class)i(in)o(v)m(arian)o(t)f(of)g(sub)q(class\))g (can)151 1947 y(b)q(e)16 b(determined:)170 2040 y(\(a\))22 b(simpli\014es)c (the)d(conditional)i(statemen)o(t.)168 2114 y(\(b\))22 b(eliminates)12 b(all) f(branc)o(hes)g(that)e(test)h(false)g(\(without)g(side-e\013ects\))h(against) e(the)i(class)f(in)o(v)m(arian)o(t.)173 2187 y(\(c\))22 b(con)o(v)o(erts)12 b (an)o(y)h(branc)o(h)g(that)g(tests)f(false)h(\(but)g(has)g(side-e\013ects\))h (to)e(a)h(statemen)o(t)f(corresp)q(ond-)251 2243 y(ing)k(to)e(the)i(side-e\ \013ect.)669 2227 y fs(6)37 2324 y 750 2 v 89 2351 a fu(6)107 2367 y fp(If)9 b (all)h(conditions)j(test)c(false)h(\(without)g(side-e\013ects\),)i(the)d(en)o (tire)i(conditional)i(statemen)o(t)d(can)g(b)q(e)f(eliminated.)19 b(Detecting) 37 2413 y(side)c(e\013ects)e(is)h(in)f(general)i(di\016cult.)952 2760 y fl (80)g eop bop 37 42 a fe(7.7.1)56 b(Preconditions)37 127 y fl(The)16 b(precon\ ditions)h(for)d(this)i(refactoring)f(are:)106 234 y fj(\017)22 b fl(con)o(v)o (ertibleT)l(oF)l(unctionP\(conditionalStatemen)o(t\))151 290 y(\(the)15 b(con\ ditional)i(statemen)o(t)d(is)i(con)o(v)o(ertible)g(to)f(a)f(legal)i(function\ \))37 412 y fe(7.7.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 498 y fl(F)l (or)i(con)o(v)o(ert)s 14 2 v 12 w(co)q(de)s 14 2 v 14 w(segmen)o(t)s 14 2 v 13 w(to)s 14 2 v 13 w(function:)30 b(precondition)21 b(1)e(\(the)g(conditional)j (is)e(a)f(legal)i(function\))f(is)37 554 y(satis\014ed)c(b)o(y)f(precondition) i(1)e(of)g(this)g(refactoring.)108 610 y(F)l(or)d(c)o(hange)s 14 2 v 13 w(acc\ ess)s 14 2 v 14 w(con)o(trol)s 14 2 v 13 w(mo)q(de:)19 b(preconditions)14 b (1)e(and)g(3)g(are)h(satis\014ed,)g(since)g(they)g(only)g(apply)g(if)37 667 y (the)h(access)f(con)o(trol)f(mo)q(de)h(is)h(not)e(priv)m(ate;)j(precondition) f(2)f(\(v)m(ariables)h(referenced)f(in)h(the)f(common)g(co)q(de)37 723 y(are) j(not)g(priv)m(ate)h(v)m(ariables)h(that)d(are)h(rede\014ned)i(in)f(sub)q(cla\ sses\))g(is)f(satis\014ed)h(b)q(ecause)g(b)o(y)g(construction,)37 780 y(b)q (efore)f(this)g(step)f(the)g(v)m(ariable)i(or)d(function)i(is)g(not)f(lo)q (cally)i(de\014ned)f(in)g(the)g(sub)q(classes.)108 836 y(F)l(or)21 b(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(function:)33 b(preconditions)23 b(1-4) d(\(regarding)h(name)g(clashes)h(and)g(equiv)m(alence)37 893 y(with)13 b(func\ tions)g(inherited)h(from)e(the)g(sup)q(erclass\))h(are)f(satis\014ed)h(b)q (ecause)g(in)h(the)e(prior)g(step)h(it)f(w)o(as)g(added)37 949 y(to)j(the)g (sup)q(erclass)g(and)g(giv)o(en)h(a)e(unique)i(name,)f(while)h(in)g(this)f (step)g(it)g(is)g(copied)h(do)o(wn;)e(precondition)j(5)37 1006 y(\(regarding) 12 b(all)i(v)m(ariable)f(and)g(function)g(references)f(in)h(the)g(conditional) h(are)d(visible)k(from)c(the)i(sub)q(classes\))37 1062 y(is)j(satis\014ed)g (b)o(y)f(the)g(results)h(of)f(a)g(prior)g(step.)108 1119 y(F)l(or)h(step)h (4:)23 b(program)16 b(prop)q(ert)o(y)h(sev)o(en)g(\(seman)o(tically)h(equiv)m (alen)o(t)g(references)g(and)f(op)q(erations\))g(is)37 1175 y(preserv)o(ed)22 b(b)o(y)f(construction)h(-)f(side)h(e\013ects)f(of)g(conditional)i(tests)d (are)h(retained;)k(only)d(dead)f(co)q(de)h(is)37 1231 y(remo)o(v)o(ed.)e(Othe\ r)15 b(program)f(prop)q(erties)i(are)f(trivially)i(preserv)o(ed.)108 1288 y (This)j(refactoring)g(is)g(constructed)g(using)h(three)e(b)q(eha)o(vior)i(pre\ serving)f(refactorings,)g(for)g(whic)o(h)g(it)37 1344 y(satis\014es)13 b(the) g(preconditions,)h(and)e(a)g(fourth)g(op)q(eration)h(whic)o(h)g(b)o(y)g(const\ ruction)f(is)h(b)q(eha)o(vior)g(preserving.)37 1401 y(Therefore,)i(b)q(eha)o (vior)h(is)g(preserv)o(ed.)37 1544 y fd(7.8)70 b(Using)28 b(A)g(Class)g(In)n (v)l(arian)n(t)h(T)-6 b(o)29 b(Sp)r(ecialize)c(Expressions)j(That)194 1619 y (Create)22 b(Instances)37 1720 y fl(After)12 b(the)g(new)g(sub)q(classes)h (ha)o(v)o(e)f(b)q(een)h(de\014ned,)g(the)f(design)h(of)e(a)h(program)f(can)h (sometimes)g(b)q(e)g(impro)o(v)o(ed)37 1777 y(b)o(y)18 b(sp)q(ecializin)q(g)i (the)e(expressions)g(that)f(create)h(instances)g(of)g(the)g(sup)q(erclass;)h (that)e(is,)i(replace)f(an)g(ex-)37 1833 y(pression)f(that)d(creates)i(an)f (instance)h(of)f(the)h(sup)q(erclass)h(with)e(an)h(expression)g(that)f(create\ s)g(an)h(instance)37 1890 y(of)f(a)g(sub)q(class.)108 1946 y(T)l(o)20 b(exten\ d)h(the)f(ab)q(o)o(v)o(e)g(example)h(in)o(v)o(olving)h ff(Flo)o(wNo)q(des)p fl (,)g(consider)f(a)f(class)h ff(Program)n(Builder)d fl(that)37 2003 y(builds)g (new)d ff(Flo)o(wNo)q(des)p fl(.)20 b(In)c(one)g(of)e(its)i(functions,)f(the) h(statemen)o(t)e(to)g(create)h(a)g ff(Flo)o(wNo)q(de)g fl(is:)157 2109 y fg (newNode)23 b(=)g(new)h(FlowNode)f(\(\ ,)730 2165 y(unconditional_jump\))108 2272 y fl(The)11 b(constructor)f(for)g (the)h(class)h ff(Flo)o(w)e(No)q(de)h fl(b)q(egins)i(with)e(an)f(assignmen)o (t)h(of)g(the)g(second)g(argumen)o(t)f(to)37 2328 y(the)i(mem)o(b)q(er)g(v)m (ariable)i fi(\014nal)s 14 2 v 12 w(statement.)19 b fl(Th)o(us,)12 b(for)f (this)h(assignmen)o(t)g(statemen)o(t,)f(the)h(second)g(argumen)o(t)37 2384 y (passed)j(to)g(the)f(constructor)g(function)i(corresp)q(onds)f(to)f(the)h(cla\ ss)g(in)o(v)m(arian)o(t)g(of)g ff(UncondJumpFlo)o(wNo)q(de)p fl(.)37 2441 y (Supp)q(ose)f(that)d(mem)o(b)q(er)i(v)m(ariable)h fi(\014nal)s 14 2 v 12 w (statement)e fl(is)h(nev)o(er)f(reassigned.)20 b(In)13 b(the)f(ab)q(o)o(v)o (e)g(assignmen)o(t,)g(the)37 2497 y(expression)k(creating)g(an)f(instance)g (of)g(the)g(sup)q(erclass)h ff(Flo)o(wNo)q(de)f fl(can)g(b)q(e)h(replaced)g (with)g(an)f(expression)37 2554 y(creating)h(an)f(instance)h(of)f(the)g(sub)q (class)h ff(UncondJumpFlo)o(wNo)q(de)p fl(;)f(that)g(is:)952 2760 y(81)g eop bop 157 42 a fg(newNode)23 b(=)g(new)h(UncondJumpFlowNode)d(\(\))108 148 y fl(In)13 b(general,)g(this)f(op)q (eration)h(cannot)e(b)q(e)i(done)g(safely)f(unless)h(it)g(can)f(b)q(e)h(deter\ mined)g(that)f(no)g(instance)37 204 y(created)i(b)o(y)g(the)g(expression)h (violates)f(the)g(class)g(in)o(v)m(arian)o(t)h(of)e(the)h(sub)q(class.)21 b (Determining)15 b(this)f(in)o(v)o(olv)o(es)37 261 y(\014nding)24 b(where)f (the)g(instances)g(created)f(b)o(y)h(this)g(expression)g(are)f(initially)k (assigned,)e(recording)f(the)37 317 y(v)m(ariable)14 b(initially)g(assigned)f (the)f(instances)g(and)g(constructing)h(a)e(de\014nition-use)j(c)o(hain)f(for) e(that)g(v)m(ariable,)37 374 y(to)j(\014nd)h(all)g(places)g(where)g(the)f(v)m (ariable)i(ma)o(y)d(b)q(e)i(used.)20 b(If)15 b(the)f(v)m(ariable)i(is)f(alias\ ed)g(\(e.g.,)e(it)h(is)h(passed)g(b)o(y)37 430 y(reference)i(in)g(a)f(functio\ n)h(call\),)g(a)f(de\014nition-use)j(c)o(hain)e(for)e(all)i(v)m(ariables)h (to)e(whic)o(h)h(it)f(ma)o(y)g(b)q(e)g(aliased)37 487 y(m)o(ust)g(also)h(b)q (e)g(constructed.)24 b(In)17 b(order)f(to)g(determine)h(that)f(the)h(instance) g(can)g(b)q(e)g(sp)q(ecialized,)i(it)e(m)o(ust)37 543 y(b)q(e)g(pro)o(v)o(en) f(that)f(none)h(of)g(the)g(op)q(erations)g(on)g(these)g(v)m(ariables)h(violat\ e)f(the)g(class)h(in)o(v)m(arian)o(t)f(de\014ned)i(on)37 599 y(a)d(sub)q(clas\ s.)37 743 y fd(7.9)70 b(Refactoring:)26 b(Sp)r(ecialize)11 b(Expressions)16 b (That)g(Create)e(Instances)37 844 y fl(This)22 b(refactoring)e(sp)q(ecializes) j(an)e(expression)g(that)f(create\(s\))g(instances)h(of)f(the)h(sup)q(erclass) h(with)f(an)37 901 y(expression)c(that)d(creates)h(instance\(s\))g(of)g(one)g (of)g(its)h(sub)q(classes,)g(as)e(describ)q(ed)j(in)f(section)g(7.8.)1748 884 y fs(7)108 957 y fl(The)g(argumen)o(ts)e(to)g(this)i(refactoring)f(are:)106 1051 y fj(\017)22 b fl(the)15 b(expression)h(that)f(creates)g(an)g(instance)h (of)f(the)g(sup)q(erclass)h(\(C\))106 1145 y fj(\017)22 b fl(the)15 b(replaci\ ng)i(expression)f(that)f(creates)f(an)i(instance)g(of)e(the)i(new)f(sub)q(cla\ ss)37 1251 y(After)g(c)o(hec)o(king)h(its)g(preconditions,)g(this)g(refactori\ ng:)93 1357 y(1.)22 b(replaces)16 b(the)f(expression)h(with)f(an)g(equiv)m (alen)o(t)h(expression)g(that)e(creates)h(instance\(s\))g(of)f(the)h(sub-)151 1414 y(class.)37 1535 y fe(7.9.1)56 b(Preconditions)37 1621 y fl(The)16 b(pre\ conditions)h(for)d(this)i(refactoring)f(are:)93 1727 y(1.)22 b(satis\014esCla\ ssIn)o(v)m(arian)o(tP)16 b(\(expression,)f(sub)q(class\))151 1784 y(\(instanc\ es)g(created)f(b)o(y)g(the)h(expression)g(do)f(not)g(violate)h(the)f(sub)q (class)h(in)o(v)m(arian)o(t,)g(as)f(discussed)i(in)151 1840 y(section)g(7.8\)\ .)93 1934 y(2.)22 b fj(8)16 b fl(V)f fj(2)g fl(\(inheritedMem)o(b)q(erV)l(ari\ ables\(C\))i fj([)f fl(C.lo)q(callyDe\014nedMem)o(b)q(erV)l(ariables\),)226 1991 y fj(9)g fl(V2)f fj(2)g fl(\(inheritedMem)o(b)q(erV)l(ariables\(sub)q (cl)q(ass\))i fj([)301 2047 y fl(sub)q(class.lo)q(callyDe\014ned)q(Mem)o(b)q (erV)l(ariabl)q(es\))226 2104 y fj(^)f fl(matc)o(hingA)o(ttributesP\(V,)e(V2\ \).)151 2160 y(\(for)g(eac)o(h)i(v)m(ariable)g(in)g(the)g(sup)q(erclass)g(the\ re)f(is)h(a)f(matc)o(hing)g(v)m(ariable)i(in)f(the)f(sub)q(class\).)93 2254 y (3.)22 b fj(8)16 b fl(F)e fj(2)i fl(\(inheritedMem)o(b)q(erF)l(unctions\(C\)) h fj([)e fl(C.lo)q(callyDe\014nedMem)o(b)q(erF)l(unctions\),)226 2310 y fj (9)h fl(F2)e fj(2)i fl(\(inheritedMem)o(b)q(erF)l(unctions\(sub)q(class\))i fj ([)301 2367 y fl(sub)q(class.lo)q(callyDe\014ned)q(Mem)o(b)q(erF)l(unctions\)) 37 2450 y 750 2 v 89 2477 a fu(7)107 2493 y fp(In)11 b(general,)h(determining) i(whether)d(an)h(expression)h(can)e(b)q(e)h(sp)q(ecialized)i(is)e(undecidable\ .)19 b(In)11 b(a)g(program,)h(there)g(ma)o(y)f(b)q(e)37 2539 y(some)i(express\ ions)h(that)e(cannot)h(b)q(e)g(sp)q(ecialized)i(automatically)m(,)g(either)e (b)q(ecause)g(determining)i(whether)d(the)g(precondition)37 2584 y(is)i(true) f(is)h(undecidable,)i(or)d(b)q(ecause)h(the)f(instance)i(violates)g(the)e(in) o(v)n(arian)o(ts)i(of)e(all)h(of)f(the)g(sub)q(classes.)952 2760 y fl(82)g eop bop 226 42 a fj(^)16 b fl(matc)o(hingSignatureP\(F,F2\))226 98 y fj(^)g fl (giv)o(en)f(the)h(sub)q(class)g(in)o(v)m(arian)o(t,)f(F)g(and)g(F2)g(are)g (seman)o(tically)h(equiv)m(alen)o(t.)151 154 y(\(for)g(eac)o(h)h(function)h (in)f(the)g(sup)q(erclass,)h(there)f(is)h(a)e(function)i(in)g(the)f(sub)q(cla\ ss)h(with)f(a)f(matc)o(hing)151 211 y(signature)f(and)h(whic)o(h)g(is)g(seman) o(tically)g(equiv)m(alen)o(t,)h(giv)o(en)e(the)g(sub)q(class)i(in)o(v)m(arian) o(t\).)93 305 y(4.)22 b(if)16 b(the)f(expression)h(is)g(a)f(declaration)h(of) e(a)h(\(non-p)q(oin)o(ter\))h(v)m(ariable)1333 288 y fs(8)1354 305 y fl(:)170 399 y(\(a\))22 b(there)15 b(are)g(no)g(assignmen)o(ts)g fi(to)h fl(the)f(v)m (ariable)168 472 y(\(b\))22 b(assignmen)o(ts)15 b fi(of)g fl(the)h(v)m(ariabl\ e)g(remain)g(t)o(yp)q(e)f(safe.)1146 455 y fs(9)37 593 y fe(7.9.2)56 b(Beha)n (vior)18 b(Preserv)m(ation)37 679 y fl(F)l(or)f(step)g(one,)h(program)e(prop) q(ert)o(y)h(six)h(\(t)o(yp)q(e-safe)f(assignmen)o(ts\))g(is)h(preserv)o(ed)f (b)o(y)g(precondition)i(4)e(\(if)37 736 y(the)j(expression)g(is)f(a)g(declara\ tion)h(of)f(a)g(\(non-p)q(oin)o(ter\))g(v)m(ariable\);)j(otherwise,)e(program) e(prop)q(ert)o(y)h(six)37 792 y(is)j(preserv)o(ed)g(b)q(ecause)g(the)f(v)m (ariable)i(assigned)f(the)f(result)g(of)g(the)g(expression)i(m)o(ust)d(\(b)o (y)h(de\014nition\))37 848 y(accept)c(an)f(instance)h(of)f(the)g(sup)q(erclas\ s)h(and)f(hence)i(will)f(accept)g(an)f(instance)h(of)e(one)i(if)f(its)h(sub)q (classes.)37 905 y(Also)c(for)e(step)h(one,)g(program)f(prop)q(ert)o(y)g(sev) o(en)h(\(seman)o(tically)h(equiv)m(alen)o(t)h(references)e(and)g(op)q(eration\ s\))g(is)37 961 y(preserv)o(ed)g(b)o(y)g(preconditions)h(1)e(-)h(3)f(of)g(thi\ s)h(refactoring;)g(other)g(program)e(prop)q(erties)i(trivially)h(preserv)o (ed.)37 1018 y(Th)o(us,)i(b)q(eha)o(vior)h(is)g(preserv)o(ed.)37 1161 y fd (7.10)70 b(Discussion)37 1264 y fe(7.10.1)56 b(P)n(ossible)18 b(Extensions)g (In)g(Sub)r(classing)37 1350 y fl(Sometimes,)c(additional)h(impro)o(v)o(emen) o(ts)d(can)i(b)q(e)f(made)h(to)e(the)h(resulting)i(implemen)o(tation.)20 b (If)14 b(there)f(are)37 1406 y(no)j(instances)h(of)e(the)h(sup)q(erclass)h (remaining,)g(unreferenced)g(functions)g(can)f(then)g(b)q(e)h(deleted)g(from) e(the)37 1463 y(\(no)o(w,)e(abstract\))f(sup)q(erclass.)20 b(If)14 b(there)f (are)g(an)o(y)g(mem)o(b)q(er)h(v)m(ariables)g(de\014ned)h(in)f(the)g(sup)q (erclass)g(that)f(are)37 1519 y(only)h(referenced)g(in)f(a)g(subset)g(of)f (the)h(sub)q(classes,)i(then)e(they)g(can)g(b)q(e)g(migrated)g(do)o(wn)f(to)h (the)g(sub)q(classes.)108 1576 y(While)24 b(the)f(refactorings)f(in)i(this)f (c)o(hapter)f(sp)q(eci\014cally)k(consider)d(sp)q(ecializations)j(based)d(on) f(the)37 1632 y(conditions)17 b(of)e(a)g(conditional)i(statemen)o(t,)d(class) h(in)o(v)m(arian)o(ts)h(as)f(describ)q(ed)i(here)f(can)g(more)e(generally)j (b)q(e)37 1689 y(applied)h(for)c(other)h(sp)q(ecializations.)108 1745 y(There) 22 b(are)g(cases)g(where)h(the)f(state)f(of)h(an)g(instance)h(ma)o(y)e(c)o (hange)h(in)h(a)f(w)o(a)o(y)f(that)h(violates)g(the)37 1802 y(in)o(v)m(arian) o(ts)g(de\014ned)g(on)e(the)h(sub)q(classes.)38 b(Consider)21 b(the)g(TS)g (Compiler)g(example,)i(discussed)f(earlier.)37 1858 y(Supp)q(ose)16 b(that)f (the)g(\014nal)g(statemen)o(t)f(in)i(a)e ff(Flo)o(wNo)q(de)h fl(could)h(dynam\ ically)h(c)o(hange,)e(for)f(example)i(from)e(a)37 1915 y(conditional)h(jump)e (to)g(an)g(unconditional)i(jump,)e(as)g(part)f(of)h(a)g(compiler)h(optimizati\ on.)20 b(If)13 b(that)g(instance)37 1971 y(w)o(ere)19 b(\014rst)f(sp)q(eciali\ zed)k(to)c(b)q(e)h(an)g(instance)g(of)f(the)h ff(CondJumpFlo)o(wNo)q(de)f fl (class,)i(then)f(when)g(the)g(\014nal)37 2027 y(statemen)o(t)f(of)g(the)g(\ \015o)o(w)g(no)q(de)h(is)f(c)o(hanged)h(that)f(instance)h(should)g(b)q(e)g (c)o(hanged)f(to)g(or)g(replaced)h(b)o(y)g(an)37 2084 y(equiv)m(alen)o(t)e (instance)f(of)f(the)g ff(UncondJumpFlo)o(wNo)q(de)h fl(class.)108 2140 y(The) g(refactoring)f(in)i(section)f(7.9)f(disallo)o(ws)h(suc)o(h)g(an)g(instance)g (to)f(b)q(e)i(sp)q(ecialized,)h(since)f(it)f(violates)37 2197 y(the)e(\014rst) e(precondition.)21 b(There)13 b(are)f(other)h(alternativ)o(es.)19 b(One)14 b (is)f(to)g(replace)g(an)g(instance)h(of)f(the)g(curren)o(t)37 2253 y(sub)q (class)19 b(with)g(an)f(instance)g(of)g(a)f(new)h(sub)q(class,)i(when)e(the)g (state)f(of)h(an)g(instance)g(c)o(hanges)g(in)h(a)e(w)o(a)o(y)37 2310 y(that) f(violates)g(the)g(in)o(v)m(arian)o(t)h(of)f(its)g(class.)22 b(This)17 b(appr\ oac)o(h)f(requires)g(\014nding)i(all)f(references)f(to)g(the)g(old)37 2366 y (instance)j(and)f(c)o(hanging)g(them,)g(along)f(with)h(cop)o(ying)g(an)o(y)f (state)g(information)h(from)f(the)g(old)i(instance)37 2423 y(needed)k(b)o(y)d (the)h(new)g(instance.)37 b(This)22 b(approac)o(h)e(w)o(ork)o(ed)g(in)h(the)g fi(T)m(yp)n(e)n(dSmal)r(ltalk)e fl(example)j(but,)g(in)37 2504 y 750 2 v 89 2531 a fu(8)107 2546 y fp(See)13 b(discussion)j(of)c(the)i(con)o(v)o(ert)r 12 2 v 12 w(instance)r 12 2 v 14 w(v)n(ariable)r 12 2 v 14 w(to)r 12 2 v 12 w (p)q(oin)o(ter)g(refactoring.)89 2576 y fu(9)107 2592 y fp(See)f(precondition) j(t)o(w)o(o)c(of)h(the)g(c)o(hange)r 12 2 v 13 w(t)o(yp)q(e)h(refactoring.) 952 2760 y fl(83)g eop bop 37 42 a fl(general,)18 b(could)g(not)f(b)q(e)h(app\ lied)h(unless)f(all)g(parts)e(a)h(program)f(that)g(migh)o(t)h(p)q(oin)o(t)g (to)g(the)g(old)h(instance)37 98 y(w)o(ere)d(kno)o(wn.)20 b(Another)15 b(alte\ rnativ)o(e)g(is)h(to)e(refactor,)g(in)o(to)h(a)g(new)g(comp)q(onen)o(t)g(clas\ s,)g(the)h(b)q(eha)o(vior)f(that)37 154 y(di\013eren)o(tiates)g(the)f(cases)g (for)f(whic)o(h)i(sub)q(classes)h(should)f(b)q(e)f(created.)20 b(Then,)14 b (sp)q(ecialize)j(the)d(comp)q(onen)o(t)37 211 y(class)19 b(and)g(substitute)f (comp)q(onen)o(ts)h(when)f(the)h(condition)g(c)o(hanges.)29 b(In)19 b(this)g (case,)f(the)h(original)g(class)37 267 y(is)e(not)f(replaced)i(when)f(the)f (condition)i(c)o(hanges,)e(but)h(its)f(comp)q(onen)o(t)h(is)f(replaced)i(b)o (y)e(a)g(comp)q(onen)o(t)h(of)37 324 y(another)h(sub)q(class.)30 b(Refactorin\ gs)19 b(in)o(v)o(olving)g(comp)q(onen)o(ts)g(and)f(the)g(aggregate)f(ob)s(jec\ ts)h(that)f(con)o(tain)37 380 y(them)f(are)f(de\014ned)h(in)g(the)f(next)h (c)o(hapter.)37 502 y fe(7.10.2)56 b(Other)18 b(Uses)g(of)h(Class)g(In)n(v)m (arian)n(ts)37 588 y fl(The)i(term)f fi(class)g(invariant)g fl(is)h(used)g (in)g(sev)o(eral)g(other)f(w)o(a)o(ys)f(in)j(the)e(ob)s(ject-orien)o(ted)h (literature.)36 b(In)37 644 y(refactoring,)13 b(the)g(term)g fi(class)g(invar\ iant)f fl(is)i(used)g(in)f(a)g(manner)g(similar)h(to)f(Mey)o(er's)f([79)o(])g (use)i(of)e(the)h(term.)108 701 y(Mey)o(er)18 b(describ)q(es)j(a)d(class)h (in)o(v)m(arian)o(t)h(as)e(a)h(list)g(of)g(assertions)f(that)g(apply)i(to)e (ev)o(ery)h(instance)g(of)g(a)37 757 y(class.)141 741 y fs(10)199 757 y fl (His)d fi(invariant)g(rule)f fl(states)f(that,)g(for)h(a)g(class)g(in)o(v)m (arian)o(t)h(to)f(b)q(e)h(correct:)106 851 y fj(\017)22 b fl(in)o(v)o(oking) 16 b(the)f fi(cr)n(e)n(ate)g fl(pro)q(cedure)h(for)f(the)g(class)g(yields)i (a)e(state)g(satisfying)g(the)g(class)h(in)o(v)m(arian)o(t)106 945 y fj(\017) 22 b fl(ev)o(ery)14 b(exp)q(orted)g(routine)h(of)f(the)g(class,)g(when)g(in)o (v)o(ok)o(ed)h(in)f(a)g(state)f(satisfying)i(the)f(class)g(in)o(v)m(arian)o (t,)151 1001 y(will)j(yield)g(a)e(state)f(satisfying)i(the)f(class)g(in)o(v)m (arian)o(t.)1071 985 y fs(11)37 1107 y fl(In)h(this)g(rule:)106 1214 y fj(\ \017)22 b fl(ev)o(ery)15 b(class)h(is)f(considered)i(to)e(ha)o(v)o(e)f(a)h fi (cr)n(e)n(ate)g fl(pro)q(cedure)106 1308 y fj(\017)22 b fl(the)15 b(state)g (of)g(the)g(ob)s(ject)f(is)i(de\014ned)h(b)o(y)e(the)g(v)m(alues)i(of)d(its)i (attribute)f(\014elds)106 1401 y fj(\017)22 b fl(the)15 b(class)h(in)o(v)m (arian)o(t)g(ma)o(y)e(only)i(in)o(v)o(olv)o(e)g(the)f(state)f(of)h(an)g(ob)s (ject.)37 1508 y(This)h(de\014nition)i(is)e(similar)g(to)f(the)g(ab)q(o)o(v)o (e)g(de\014nition)j(used)e(in)g(refactoring,)f(but)g(there)h(is)g(an)f(imp)q (ortan)o(t)37 1564 y(di\013erence.)26 b(Mey)o(er)16 b(uses)h(class)g(in)o(v)m (arian)o(ts)g(to)f(ensure)h(correctness)g(at)f(the)h(in)o(terfaces)f(b)q(et)o (w)o(een)h(classes.)37 1621 y(F)l(or)g(these)h(purp)q(oses,)g(the)g(class)f (in)o(v)m(arian)o(t)h(need)h(only)f(hold)g(at)f(the)g(p)q(oin)o(ts)h(where)g (an)f(instance)h(of)f(the)37 1677 y(class)h(is)g(called)g(b)o(y)f(another)g (ob)s(ject;)g(the)h(class)f(in)o(v)m(arian)o(t)h(need)g(not)f(hold)h(at)e(oth\ er)h(p)q(oin)o(ts)g(during)h(the)37 1733 y(execution)i(of)f(an)g(exp)q(orted) g(routine,)h(nor)e(need)i(it)f(hold)h(when)f(the)g(class)g(calls)h(an)f(in)o (ternal)g(\(priv)m(ate\))37 1790 y(routine.)i(By)14 b(con)o(trast,)e(refactor\ ing)i(uses)g(a)g(class)h(in)o(v)m(arian)o(t)f(to)g(simplify)i(the)e(in)o(tern\ als)h(of)e(the)i(class;)f(for)37 1846 y(these)i(purp)q(oses)g(the)f(in)o(v)m (arian)o(t)h(m)o(ust)e(also)i(remain)f(true)g fi(as)h(viewe)n(d)g(fr)n(om)h (inside)e(the)i(class)p fl(.)108 1903 y(Another)k(use)g(of)f(the)h(term)f fi (class)g(invariant)g fl(is)i(made)e(b)o(y)h(Casais)f(in)i([31)o(].)36 b(Casai\ s)20 b(de\014nes)i(class)37 1959 y(in)o(v)m(arian)o(ts)11 b(as)g(in)o(tegrit) o(y)f(constrain)o(ts)g(that)g(m)o(ust)g(b)q(e)h(main)o(tained)g(across)f(c)o (hanges)g(to)g(the)h(sc)o(hema)f(\(system)37 2016 y(structure\).)248 1999 y fs (12)304 2016 y fl(These)i(constrain)o(ts)f(include,)k(for)c(example,)i(the)f fi(ful)r(l)h(inheritanc)n(e)f(invariant)p fl(,)g(whic)o(h)g(states)37 2072 y (that)j(a)g(class)h(inherits)h(all)f(attributes)g(from)e(its)i(ancestors)f (\(except)g(those)g(that)g(it)h(explicitly)i(rede\014nes\),)37 2129 y(and)j (the)e fi(typ)n(e)i(c)n(omp)n(atibility)f(invariant)p fl(,)g(whic)o(h)h(state\ s)e(that)g(the)h(t)o(yp)q(e)g(of)f(a)h(v)m(ariable)h(rede\014ned)g(in)g(a)37 2185 y(sub)q(class)d(m)o(ust)f(b)q(e)g(consisten)o(t)g(with)g(its)g(domain)h (as)e(sp)q(eci\014ed)j(in)f(the)f(sup)q(erclass.)26 b(In)o(v)m(arian)o(ts)17 b (suc)o(h)g(as)37 2242 y(these)g(are)e(imp)q(ortan)o(t)h(for)f(understanding)i (the)f(seman)o(tics)g(of)g(the)g(language)g(b)q(eing)h(used,)g(but)f(they)g (are)37 2298 y(distinct)h(from)d(the)i(constrain)o(ts)e(de\014ned)j(on)e(sp)q (eci\014c)i(classes.)37 2379 y 750 2 v 74 2406 a fu(10)107 2422 y fp(He)12 b (distingui)q(shes)k(these)d(from)g(preconditions)j(and)e(p)q(ostconditions)i (de\014ned)f(on)e(routines.)74 2452 y fu(11)107 2468 y fp(His)f(in)o(v)n(aria\ n)o(t)j(rule)e(also)g(requires)h(that,)e(when)h(these)f(pro)q(cedures)i(are)f (applied,)h(the)e(argumen)o(ts)i(and)f(state)f(satisfy)h(the)37 2513 y(precon\ dition)q(s)j(for)c(the)h(pro)q(cedures.)74 2543 y fu(12)107 2559 y fp(Casais) f([31])g(compares)g(the)g(GemStone)711 2542 y fw(R)701 2543 y fn(\015)752 2559 y fp([92],)f(Orion)i([9],)e fo(O)1034 2563 y fu(2)1063 2559 y fp(and)h(OTGen) g(ob)r(ject-orien)o(ted)i(database)f(systems)f(with)37 2604 y(resp)q(ect)i (to)f(class)h(in)o(v)n(arian)o(ts.)19 b(GemStone)14 b(is)g(a)f(registered)h (trademark)g(of)f(Servio)h(Logic.)952 2760 y fl(84)g eop bop 108 42 a fl(In) 16 b(summary)l(,)f(in)h(refactoring)f(the)h(term)f fi(class)g(invariant)g fl (is)h(used)g(in)g(a)f(manner)h(similar)h(to)d(Mey)o(er's)37 98 y([79])f(use)i (of)f(the)g(term,)f(although)i(in)g(refactoring)f(the)g(in)o(v)m(arian)o(t)h (applies)h(not)d(only)i(where)g(the)f(class)g(calls)37 154 y(other)h(classes,) h(but)f(also)g(for)g(states)f(in)o(ternal)i(to)f(the)g(class.)952 2760 y(85)g eop bop 37 353 a fc(Chapter)35 b(8)37 560 y fb(Refactoring)42 b(T)-10 b(o)40 b (Capture)37 685 y(Aggregations)j(&)c(Comp)s(onen)m(ts)37 926 y fd(8.1)70 b (Motiv)l(ation)37 1027 y fl(Inheritance)16 b(is)e(a)f(p)q(o)o(w)o(erful)h(tec) o(hnique,)h(but)f(in)g(mo)q(deling)h(the)f(relationships)h(among)e(classes)i (it)e(is)i(some-)37 1084 y(times)g(o)o(v)o(erused)e(and)h(incorrectly)h(used.) 20 b fi(A)n(ggr)n(e)n(gations)12 b fl(are)h(another)h(to)q(ol)f(for)g(mo)q (deling)j(these)e(relation-)37 1140 y(ships.)108 1197 y(T)l(o)22 b(summarize) h(from)f(c)o(hapter)g(3,)i(an)e(aggregation)f(is)i(a)g(sp)q(ecial)h(asso)q (ciation)f(b)q(et)o(w)o(een)f(ob)s(jects,)37 1253 y(represen)o(ting)g(a)f(par\ t-whole)g(relationship.)40 b(An)21 b(aggregate)f(ob)s(ject,)h(sometimes)g(cal\ led)i(a)e(comp)q(osite)37 1309 y(ob)s(ject)c(or)f(a)g(con)o(tainer,)h(con)o (tains)g(one)f(of)h(more)f(parts,)g(called)i(comp)q(onen)o(ts.)24 b(An)17 b (aggregate)f(class)h(is)g(a)37 1366 y(class)d(con)o(taining)h(one)e(or)g(more) g(comp)q(onen)o(t)h(mem)o(b)q(ers;)g(a)f(comp)q(onen)o(t)g(class)h(is)g(a)f (class)h(whose)g(instances)37 1422 y(are)h(comp)q(onen)o(ts)h(of)e(another)h (class.)108 1479 y(Comp)q(onen)o(ts)g(are)f(stored)g(as)h(mem)o(b)q(er)g(v)m (ariables)h(in)f(the)g(aggregate)e(ob)s(ject;)h(ho)o(w)o(ev)o(er,)g(as)h(desc\ rib)q(ed)37 1535 y(in)i(c)o(hapter)f(three,)g(not)g(all)h(mem)o(b)q(er)f(v)m (ariables)h(of)f(an)g(aggregate)e(class)j(store)e(comp)q(onen)o(t)h(ob)s(ject\ s.)22 b(F)l(or)37 1592 y(example,)16 b(mem)o(b)q(er)g(v)m(ariables)g(in)h(an) e ff(Automobile)e fl(class)j(migh)o(t)f(represen)o(t)g(its)h(color,)f(age,)f (or)h(n)o(um)o(b)q(er)h(of)37 1648 y(passengers;)h(these)g(mem)o(b)q(er)g(v)m (ariables)h(represen)o(t)f(attributes)f(of)h(an)f(automobile)i(but)f(are)f (not)g(comp)q(o-)37 1705 y(nen)o(ts)g(of)e(it,)i(in)g(the)f(sense)h(that)e (an)h(engine)i(or)d(left)i(fron)o(t)e(tire)h(is)h(a)f(comp)q(onen)o(t)g(of)g (an)g(automobile.)108 1761 y(An)f(aggregate)e(ob)s(ject)i(can)g(b)q(e)g(treat\ ed)f(as)h(a)f(unit)i(for)e(man)o(y)g(op)q(erations.)20 b(During)14 b(design,) h(recogniz-)37 1818 y(ing)h(that)f(an)g(asso)q(ciation)h(b)q(et)o(w)o(een)g (ob)s(jects)f(is)g(an)h(aggregation)e(can)h(help)i(determine)g(ho)o(w)d(to)h (partition)37 1874 y(b)q(eha)o(vior)21 b(and)g(resp)q(onsibilities)j(among)19 b(the)i(classes.)35 b(Sometimes)21 b(it)g(is)g(not)e(ob)o(vious)i(that)f(the) g(rela-)37 1930 y(tionship)i(b)q(et)o(w)o(een)e(ob)s(jects)g(is)h(an)f(aggreg\ ation)f(un)o(til)i(the)f(co)q(de)h(is)g(reused;)i(as)c(a)h(program)f(is)i(reu\ sed)37 1987 y(the)d(relationships)h(b)q(et)o(w)o(een)f(classes)f(b)q(ecome)h (more)f(ob)o(vious.)27 b(In)18 b(these)g(cases,)f(correctly)h(partitioning)37 2043 y(the)g(b)q(eha)o(vior)g(ma)o(y)e(require)i(mo)o(ving)f(mem)o(b)q(ers)h (b)q(et)o(w)o(een)f(aggregate)f(classes)i(and)f(the)g(classes)h(of)f(their)37 2100 y(comp)q(onen)o(ts.)25 b(These)17 b(c)o(hanges)g(ma)o(y)f(not)g(only)h (impro)o(v)o(e)g(the)g(design)g(of)g(the)f(aggregate)g(class,)h(but)f(also)37 2156 y(mak)o(e)f(the)g(comp)q(onen)o(t)h(classes)f(more)g(reusable.)108 2213 y (An)i(example)f(of)g(where)h(suc)o(h)f(a)g(mo)o(v)o(e)f(migh)o(t)h(b)q(e)h (made)f(is)h(when)g(the)f ff(Automobile)e fl(class)j(con)o(tains)f(a)37 2269 y (comp)q(onen)o(t)e(mem)o(b)q(er)f(v)m(ariable)i fi(autoEngine)p fl(,)d(whic)o (h)i(holds)g(an)f(instance)h(of)f(the)g(class)h ff(Engine)p fl(.)20 b(The)13 b (class)37 2326 y ff(Engine)18 b fl(con)o(tains)e(the)g(mem)o(b)q(er)h(v)m(ari\ able)h fi(milesPerGal)r(lon)d fl(whic)o(h,)i(for)e(design)j(reasons,)d(really) j(b)q(elongs)37 2382 y(in)j(the)e(\(aggregate\))e(class)j ff(Automobile)p fl (.)30 b(The)20 b(refactoring)e(describ)q(ed)k(in)e(section)g(8.7)e(de\014nes) i(ho)o(w)f(to)37 2439 y(automate)c(suc)o(h)g(a)g(design)h(c)o(hange.)108 2495 y(This)g(c)o(hapter)f(de\014nes)h(sev)o(eral)f(refactorings)g(in)o(v)o(olving) i(aggregations:)106 2589 y fj(\017)22 b fl(mo)o(ving)15 b(mem)o(b)q(ers)h(fro\ m)e(an)h(aggregate)f(class)h(to)g(the)g(class)h(of)f(one)g(of)g(its)g(comp)q (onen)o(ts)952 2760 y(86)g eop bop 106 42 a fj(\017)22 b fl(mo)o(ving)12 b (mem)o(b)q(ers)h(from)f(a)g(comp)q(onen)o(t)g(class)h(to)f(the)g(aggregate)f (classes)i(that)f(con)o(tain)g(comp)q(onen)o(t)151 98 y(mem)o(b)q(ers)j(that) g(are)g(instances)h(of)f(the)g(comp)q(onen)o(t)g(class)106 191 y fj(\017)22 b fl(con)o(v)o(erting)15 b(a)g(relationship,)i(mo)q(deled)f(using)g(inheritance\ ,)h(in)o(to)e(an)g(aggregation.)108 283 y(Eac)o(h)k(of)g(these)h(refactorings) f(requires)h(that)f(the)g(comp)q(onen)o(ts)h(of)f(a)g(class)h(b)q(e)g(determi\ nable.)34 b(F)l(or)37 339 y(example,)24 b(mo)o(ving)d(a)g(mem)o(b)q(er)h(safe\ ly)f(from)g(an)g(aggregate)f(to)h(a)g(comp)q(onen)o(t)g(class)h(\(or)f(vice-v) o(ersa\),)37 395 y(requires)e(that)e(there)g(m)o(ust)g(b)q(e)h(a)g(one-for-on\ e)f(mapping)h(b)q(et)o(w)o(een)g(the)g(mem)o(b)q(er)f(b)q(eing)i(remo)o(v)o (ed)e(from)37 452 y(the)e(old)h(class)f(and)g(the)g(mem)o(b)q(er)g(b)q(eing)h (added)f(to)f(its)h(new)g(class)g(\(or)f(set)h(of)f(classes\).)20 b fi(F)m (or)15 b(the)h(purp)n(oses)37 508 y(of)e(r)n(efactoring,)g(an)g(imp)n(ortant) g(char)n(acteristic)f(of)h(c)n(omp)n(onents)e(is)i(that)g(a)g(c)n(omp)n(onent) f(obje)n(ct)g(c)n(an)g(only)g(b)n(e)37 565 y(assigne)n(d)f(to)h(one)f(aggr)n (e)n(gate)g(obje)n(ct)h(at)g(a)f(time.)852 548 y fs(1)891 565 y fl(Put)f(anot\ her)g(w)o(a)o(y)l(,)g(ob)s(jects)f(assigned)i(to)f(one)g(comp)q(onen)o(t)37 621 y(mem)o(b)q(er)k(v)m(ariable)g(m)o(ust)f(not)g(sim)o(ultaneously)i(b)q (e)e(assigned)h(to)f(another)g(comp)q(onen)o(t)g(mem)o(b)q(er)g(v)m(ariable.) 37 678 y(F)l(or)20 b(example,)i(in)f(an)f ff(Automobile)f fl(ob)s(ject)h(the) g(same)g ff(Tire)g fl(ob)s(ject)f(cannot)h(b)q(e)h(assigned)g(as)f(b)q(oth)g (the)37 734 y fi(leftF)m(r)n(ontTir)n(e)f fl(and)h fi(rightF)m(r)n(ontTir)n (e)p fl(;)h(similarly)l(,)j(it)c(cannot)h(b)q(e)g(assigned)g(to)f(t)o(w)o(o)f ff(Automobiles)g fl(at)g(the)37 791 y(same)c(time.)108 847 y(The)f(follo)o (wing)h(section)f(de\014nes)h(some)f(algorithms)g(for)f(c)o(hec)o(king)i(that) e(a)h(mem)o(b)q(er)g(v)m(ariable)h(quali\014es)37 904 y(as)e(a)g(comp)q(onen) o(t)g(mem)o(b)q(er)g(v)m(ariable.)20 b(The)13 b(subsequen)o(t)h(sections)f (de\014ne)h(the)f(refactorings.)19 b(The)13 b(c)o(hapter)37 960 y(closes)j (with)g(a)f(discussion)i(of)d(related)i(issues.)37 1103 y fd(8.2)70 b(Chec)n (king)22 b(If)h(A)g(V)-6 b(ariable)22 b(Quali\014es)f(As)i(A)g(Comp)r(onen)n (t)37 1204 y fl(There)g(are)g(sev)o(eral)f(w)o(a)o(ys)g(to)g(determine)i(whet\ her)e(a)h(v)m(ariable)h(quali\014es)g(as)e(a)h(comp)q(onen)o(t)f(mem)o(b)q (er)37 1261 y(v)m(ariable;)h(that)18 b(is,)i(that)e(ev)o(ery)h(ob)s(ject)g (assigned)h(to)e(it)h(is)h(not)f(also)g(assigned)g(to)g(another)f(comp)q(onen) o(t)37 1317 y(v)m(ariable.)j(One)14 b(common)e(case)h(that)g(is)g(trivial)h (to)f(c)o(hec)o(k)g(is)g(when)h(the)f(v)m(ariable)h(is)g(only)g(directly)g (assigned)37 1374 y(the)f(result)h(of)e(an)h fi(obje)n(ct)h(cr)n(e)n(ation)f (expr)n(ession)f fl(\(i.e.)19 b(b)o(y)13 b(a)g(call)h(to)e(the)h(C++)g fi(new) g fl(function\))g(and)g(its)g(v)m(alue)37 1430 y(is)j(not)f(reassigned)h(to)e (another)h(v)m(ariable.)108 1487 y(F)l(or)h(example,)h(the)f fi(Choic)n(es)f fl(Virtual)i(Memory)f(system)g([104)o(])f(has)i(t)o(w)o(o)e(kinds)i(of)f(ob)s (jects,)f ff(Memo)o(r)o(y-)37 1543 y(Objects)20 b fl(and)e ff(Memo)n(ryObject\ Caches)p fl(.)26 b(A)18 b ff(Memo)n(ryObjectCache)f fl(is)g(a)g(comp)q(onen)o (t)h(of)f(a)g ff(Memo)n(ryObject)p fl(.)37 1599 y(A)k ff(Memo)o(r)o(yObject)e fl(do)q(es)i(not)f(alw)o(a)o(ys)g(ha)o(v)o(e)g(a)g ff(Memo)o(ryObjectCache)p fl(,)h(but)f(once)h(it)g(gets)f(one)h(it)f(nev)o(er)37 1656 y(c)o(hanges.)g (The)c(co)q(de)g(to)e(initialize)k(the)e(mem)o(b)q(er)f(v)m(ariable)i fi(c)n (ache)e fl(lo)q(oks)g(something)h(lik)o(e)g(this:)157 1759 y fg(if)23 b(\(cac\ he)g(==)h(0\))g({)276 1816 y(cache)f(=)h(new)f(MemoryObjectCache\(this\))e (})108 1919 y fl(Pro)o(vided)f(that)e(the)h(v)m(alue)i(of)e(mem)o(b)q(er)g (v)m(ariable)h fi(c)n(ache)f fl(is)h(not)f(assigned)h(to)e(another)h(v)m(aria\ ble,)i(it)37 1975 y(quali\014es)c(as)e(a)g(comp)q(onen)o(t)g(for)g(the)g(purp) q(oses)h(of)f(refactoring.)108 2032 y(The)20 b(algorithms)h(de\014ned)g(b)q (elo)o(w)g(handle)g(the)g(more)e(general)i(case)f(where)h(the)f(v)m(ariable)h (ma)o(y)f(not)37 2088 y(b)q(e)e(priv)m(ate)g(to)e(its)h(class,)g(or)f(it)h (ma)o(y)f(b)q(e)i(assigned)f(an)g(ob)s(ject)f(created)h(in)h(another)e(\(serv) o(er\))g(class.)25 b(The)37 2145 y(section)16 b(is)g(structured)f(in)h(four)f (parts:)93 2236 y(1.)22 b(it)15 b(describ)q(es)h(a)e(conserv)m(ativ)o(e)h(dat\ a)e(\015o)o(w)h(algorithm)g(that)g(assumes)g(that)g(the)g(program)f(con)o(tai\ ns)i(a)151 2293 y(single)i(instance)f(of)e(the)i(aggregate)d(class;)93 2386 y (2.)22 b(it)11 b(extends)g(the)g(initial)i(algorithm)e(to)f(b)q(etter)h(handl\ e)h(cases)f(where)g(comp)q(onen)o(t)g(ob)s(jects)f(are)g(created)151 2442 y (b)o(y)15 b(classes)h(other)f(than)g(the)g(aggregate)f(class;)37 2522 y 750 2 v 89 2548 a fu(1)107 2564 y fp(This)e(de\014nition)i(is)e(consisten)o(t)h(wit\ h)f(the)g(meaning)h(of)e fm(exclusive)e fp(comp)q(osite)k(references)f(in)g (ob)r(ject-orien)o(ted)h(databases,)37 2610 y(as)h(de\014ned)g(b)o(y)f(Kim)h ([66].)952 2760 y fl(87)g eop bop 93 42 a fl(3.)22 b(it)d(further)f(extends)h (the)g(algorithm)f(to)g(handle)i(the)e(case)h(where)g(a)f(program)f(con)o(tai\ ns)i(m)o(ultiple)151 98 y(instances)d(of)f(the)g(aggregate)f(class;)93 192 y (4.)22 b(\014nally)l(,)17 b(it)e(discusses)h(additional)h(extensions)f(that)f (could)h(mak)o(e)e(the)i(algorithm)f(more)g(p)q(o)o(w)o(erful.)108 286 y(The) k(assumption)g(in)g(parts)f(one)g(and)h(t)o(w)o(o)e(that)h(the)h(program)e (con)o(tains)i(a)f(single)i(instance)f(of)f(the)37 342 y(aggregate)c(class)i (is)g(v)o(ery)g(restrictiv)o(e,)f(but)h(these)g(parts)e(illustrate)j(imp)q (ortan)o(t)e(p)q(oin)o(ts.)21 b(P)o(arts)15 b(three)g(and)37 399 y(four)g(des\ crib)q(e)i(less)f(restrictiv)o(e)g(extensions,)f(that)g(build)i(up)q(on)f(the) f(analysis)h(in)g(the)f(earlier)h(parts.)37 520 y fe(8.2.1)56 b(Assumptions) 18 b(and)h(T)-5 b(erminology)37 606 y fl(T)l(o)15 b(simplify)i(the)f(presen)o (tation,)f(the)g(follo)o(wing)h(assumptions)f(are)g(made)g(ab)q(out)g(the)g (program:)106 700 y fj(\017)22 b fl(all)d(ob)s(jects)d(are)i(created)f(dynami\ cally)j(b)o(y)d(an)h fi(obje)n(ct)g(cr)n(e)n(ation)f(expr)n(ession)g fl(\(i.e\ .)27 b(a)17 b(p)q(oin)o(t)h(in)g(the)151 756 y(program)c(where)h(the)g(C++)g fi(new)f fl(function)i(is)f(called\),)h(rather)e(than)h(b)q(eing)h(statically) g(assigned)f(to)151 813 y(a)g(v)m(ariable)i(at)d(compile)j(time.)106 907 y fj (\017)22 b fl(eac)o(h)15 b(return)h(statemen)o(t)e(of)g(a)h(function)h(is)g (of)f(the)g(form:)k fi(r)n(eturn)d fk(V)1337 914 y fr(x)1359 907 y fl(,)f(whe\ re)g fk(V)1545 914 y fr(x)1582 907 y fl(is)g(a)g(v)m(ariable.)106 1000 y fj (\017)22 b fl(the)15 b(set)f(of)g(aliasing)i(relationships)g(are)e(kno)o(wn;) g(that)g(is)h(it)g(is)g(kno)o(wn)f(whic)o(h)h(v)m(ariables)h(are)e(aliased) 151 1057 y(to)k(other)f(v)m(ariables.)30 b(C++)19 b(reference)f(v)m(ariables) i(\(where)e(a)f(v)m(ariable)j(is)f(passed)f(b)o(y)g(reference)h(in)151 1113 y (a)g(function)g(call\))h(are)f(an)g(example)g(of)g(aliasing.)32 b(Aliasing)20 b(relationships)h(are)d(more)h(di\016cult)h(to)151 1170 y(determine)c(when)g (p)q(oin)o(ters)g(are)f(passed.)108 1264 y(All)20 b(v)m(ariables)h(\(global,) f(mem)o(b)q(er,)g(argumen)o(t)e(and)h(lo)q(cal\))h(are)f(uniquely)i(iden)o (ti\014ed.)34 b(Ho)o(w)o(ev)o(er,)19 b(all)37 1320 y(references)e(to)e(the)h (same)f(mem)o(b)q(er)h(v)m(ariable,)h(ev)o(en)f(if)g(the)g(references)g(are)g (to)f(di\013eren)o(t)h(instances)g(of)f(the)37 1376 y(same)g(class,)h(will)g (map)f(to)g(the)g(same)g(iden)o(ti\014er.)108 1433 y(V)l(ariables)k(ha)o(v)o (e)e(their)h(v)m(alues)h(set)e(b)o(y)g(assignmen)o(t)h(statemen)o(ts)e(and)i (\(for)e(argumen)o(t)h(v)m(ariables\))i(b)o(y)37 1489 y(function)e(calls.)j (A)c(v)m(ariable)g(\()p fk(V)599 1496 y fr(x)620 1489 y fl(\))f(ma)o(y)g(b)q (e)h(assigned:)93 1583 y(1.)22 b(the)15 b(v)m(alue)i(of)e(another)f(v)m(ariab\ le)j(\()p fk(V)781 1590 y fr(y)801 1583 y fl(\).)93 1677 y(2.)22 b(a)15 b(con\ stan)o(t)f(\()p fk(C)423 1684 y fr(i)437 1677 y fl(\))93 1771 y(3.)22 b(the) 15 b(return)h(v)m(alue)g(of)f(a)g(function)h(\()p fk(F)801 1778 y fr(j)819 1771 y fl(\(\)\))93 1865 y(4.)22 b(an)15 b(ob)s(ject)g(returned)g(b)o(y)h(an) f(ob)s(ject)s 14 2 v 13 w(creation)s 14 2 v 13 w(expression)h(\()p fk(O)1249 1872 y fr(z)1268 1865 y fl(\))108 1958 y(Asso)q(ciated)11 b(with)f(eac)o(h)h (v)m(ariable)g fk(V)719 1965 y fr(x)751 1958 y fl(is)f(an)g(\(initially)j(emp\ t)o(y\))c(set)h fk(D)1285 1965 y fr(V)1306 1969 y ft(x)1337 1958 y fl(of)g (ob)s(ject)f(creation)i(expressions.)37 2015 y(When)19 b(analysis)h(is)f(comp\ lete,)h fk(D)644 2022 y fr(V)665 2026 y ft(x)704 2015 y fl(will)g(con)o(tain) f(the)f(set)h(of)f(all)h(ob)s(ject)f(creation)h(expressions)h(whose)37 2071 y (return)c(v)m(alues)g(\(newly)g(created)f(ob)s(jects\))f(ma)o(y)h(b)q(e)h(ass\ igned)f(to)g fk(V)1215 2078 y fr(x)1236 2071 y fl(.)108 2128 y fk(R)143 2135 y fr(F)165 2140 y ft(j)198 2128 y fl(denotes)h(the)f(set)g(of)g(v)m(ariables)h (that)f(app)q(ear)g(in)h(return)f(statemen)o(ts)f(of)h(function)h fk(F)1681 2135 y fr(j)1700 2128 y fl(\(\).)108 2184 y fk(D)146 2191 y fr(R)173 2197 y ft (F)192 2205 y(j)234 2184 y fl(denotes)22 b(the)g(set)g(of)g(ob)s(ject)f(creat\ ion)h(expressions)h(whose)f(ob)s(jects)f(ma)o(y)g(b)q(e)i(returned)g(b)o(y)37 2248 y(function)e fk(F)249 2255 y fr(j)268 2248 y fl(\(\);)g(that)e(is,)i fk (D)543 2255 y fr(R)570 2261 y ft(F)589 2268 y(j)629 2248 y fl(=)g(\()703 2216 y fa(S)737 2259 y fr(V)758 2263 y ft(y)776 2259 y fq(2)p fr(R)827 2265 y ft (F)846 2273 y(j)874 2248 y fk(D)912 2255 y fr(V)933 2259 y ft(y)953 2248 y fl (\).)33 b(F)l(or)19 b(example,)j(if)e(function)h fk(F)1558 2255 y fr(j)1576 2248 y fl(\(\))e(con)o(tained)i(t)o(w)o(o)37 2313 y(return)16 b(statemen)o (ts:)i fi(r)n(eturn)f fk(V)589 2320 y fr(x)625 2313 y fl(and)f fi(r)n(eturn)g fk(V)879 2320 y fr(y)899 2313 y fl(,)f(then)g fk(D)1068 2320 y fr(R)1095 2326 y ft(F)1114 2334 y(j)1147 2313 y fl(=)e fk(D)1233 2320 y fr(V)1254 2324 y ft (x)1285 2313 y fj([)d fk(D)1363 2320 y fr(V)1384 2324 y ft(y)1404 2313 y fl (.)952 2760 y(88)g eop bop 37 42 a fe(8.2.2)56 b(Basic)18 b(Algorithm:)23 b (Single)17 b(Instance)i(of)f(Aggregate)h(Class)37 127 y fl(Asso)q(ciated)h (with)f(eac)o(h)g(assignmen)o(t)g(\(assignmen)o(t)f(statemen)o(t)g(and)h(func\ tion)h(call\))g(is)f(a)g(set)g(of)f(ob)s(ject)37 184 y(creation)g(expressions) h(that)d(are)i(added)g(to)f fk(D)865 191 y fr(V)886 195 y ft(x)906 184 y fl (,)h(where)g fk(V)1098 191 y fr(x)1137 184 y fl(is)g(the)f(v)m(ariable)i(on)f (the)g(left)f(hand)h(side)h(of)37 240 y(the)d(assignmen)o(t.)k(The)15 b fi (gen)g fl(sets)f(for)h(eac)o(h)g(assignmen)o(t)g(statemen)o(t)f(S)i(are)f(as) g(follo)o(ws:)1569 224 y fs(2)21 b(3)108 302 y 844 2 v 107 359 a 2 57 v 133 342 a fl(Assignmen)o(t)15 b(\(S\))463 359 y 2 57 v 489 342 a(gen[S])g(\(added) g(to)g fk(D)868 349 y fr(V)889 353 y ft(x)909 342 y fl(\))951 359 y 2 57 v 108 361 a 844 2 v 108 371 a 844 2 v 107 427 a 2 57 v 133 410 a fk(V)160 417 y fr (x)197 410 y fl(=)g fk(V)274 417 y fr(y)463 427 y 2 57 v 489 410 a fk(D)527 417 y fr(V)548 421 y ft(y)951 427 y 2 57 v 107 483 a 2 57 v 133 467 a fk(V) 160 474 y fr(x)197 467 y fl(=)g fk(C)280 474 y fr(i)463 483 y 2 57 v 489 467 a fj(;)951 483 y 2 57 v 107 548 a 2 65 v 133 523 a fk(V)160 530 y fr(x)197 523 y fl(=)g fk(F)276 530 y fr(j)295 523 y fl(\(\))463 548 y 2 65 v 489 523 a fk (D)527 530 y fr(R)554 536 y ft(F)573 544 y(j)951 548 y 2 65 v 107 605 a 2 57 v 133 588 a fk(V)160 595 y fr(x)197 588 y fl(=)g fk(O)282 595 y fr(z)463 605 y 2 57 v 489 588 a fj(f)p fk(O)547 595 y fr(z)566 588 y fj(g)951 605 y 2 57 v 108 607 a 844 2 v 108 645 a fl(After)f fk(D)264 652 y fr(V)285 656 y ft(x)320 645 y fl(has)g(b)q(een)h(computed)g(\(using)f(data)g(\015o)o(w)f(tec)o(hniques\)) j(for)d(all)i(v)m(ariables)h(in)f(the)f(program,)37 701 y(the)19 b(sets)g(of) f(ob)s(ject)h(creation)g(expressions)g(for)f(aliased)i(v)m(ariables)g(m)o(ust) f(b)q(e)g(merged;)h(that)f(is,)g(if)h fk(V)1842 708 y fr(x)1882 701 y fl(is) 37 758 y(aliased)d(as)e fk(V)270 765 y fr(y)290 758 y fl(,)g(then:)20 b fk (D)477 765 y fr(V)498 769 y ft(x)534 758 y fl(=)15 b fk(D)622 765 y fr(V)643 769 y ft(y)678 758 y fl(=)h(\()p fk(D)785 765 y fr(V)806 769 y ft(x)836 758 y fj([)11 b fk(D)915 765 y fr(V)936 769 y ft(y)956 758 y fk(:)p fl(\))108 814 y (Assuming)18 b(that)f(the)h(program)e(con)o(tains)i(only)g(a)g(single)g(insta\ nce)h(of)e(the)h(aggregate)e(class,)i(at)f(this)37 871 y(p)q(oin)o(t)h(it)f (can)f(b)q(e)i(determined)g(whether)f(a)f(v)m(ariable)i fk(V)1006 878 y fr (c)1039 871 y fl(can)f(b)q(e)h(designated)f(as)f(a)h(comp)q(onen)o(t)f(v)m (ariable.)37 927 y(It)j(can)f(b)q(e)g(designated)h(as)f(suc)o(h)g(if)h(all)g (v)m(alues)g(assigned)g(to)e(it)h(are)g(not)g(assigned)g(to)g(other)f(comp)q (onen)o(t)37 983 y(v)m(ariables.)30 b(This)18 b(is)h(certainly)g(true)e(if)i (all)f(expressions)h(that)e(create)h(ob)s(jects)f(reac)o(hing)h fk(V)1652 990 y fr(c)1687 983 y fl(do)g(not)f(also)37 1040 y(create)e(ob)s(jects)g(reac)o (hing)h(a)f(v)m(ariable)h(already)g(designated)g(as)e(a)h(comp)q(onen)o(t)h (v)m(ariable,)g(that)e(is:)108 1096 y(Comp)q(onen)o(tIfSingleAggregateInstanc\ eP\(v)m(ariable)k fk(V)1100 1103 y fr(c)1116 1096 y fl(\))d fj(\021)187 1153 y (8)h fk(V)255 1160 y fr(y)290 1153 y fj(2)g fl(comp)q(onen)o(tV)l(ariables\(P\ rogram\),)262 1209 y fk(V)289 1216 y fr(y)325 1209 y fj(6)p fl(=)f fk(V)402 1216 y fr(c)434 1209 y fj(\))337 1266 y fk(D)375 1273 y fr(V)396 1277 y ft (y)432 1266 y fj(\\)g fk(D)515 1273 y fr(V)536 1277 y ft(c)569 1266 y fl(=)g fj(;)p fl(.)37 1387 y fe(8.2.3)56 b(An)19 b(Impro)n(v)n(emen)n(t)d(to)i(the)g (Basic)h(Algorithm)37 1473 y fl(One)i(w)o(a)o(y)d(in)i(whic)o(h)h(the)e(ab)q (o)o(v)o(e)g(approac)o(h)g(is)h(conserv)m(ativ)o(e)g(is)g(that)f(it)h(do)q (es)g(not)f(distinguish)i(among)37 1530 y(ob)s(jects)14 b(created)f(b)o(y)h (the)g(same)f(ob)s(ject)g(creation)h(expression.)20 b(Supp)q(ose)15 b(there)f (is)g(a)f(function)i fk(F)1723 1537 y fr(j)1741 1530 y fl(\(\))e(\(a)g(tire) 37 1586 y(distributor\))g(that)f(returns)h(a)f(new)h(tire)g(with)g(eac)o(h)g (call)h(to)e(it.)19 b(One)13 b(of)g(the)f(mem)o(b)q(er)h(functions)h(of)e(the) h ff(Au-)37 1643 y(tomobile)h fl(class)j(con)o(tains)f(the)g(co)q(de)h(segmen) o(t:)22 b fi(leftF)m(r)n(ontTir)n(e)15 b(=)i fk(F)1236 1650 y fr(j)1254 1643 y fi(\(\);)g(rightF)m(r)n(ontTir)n(e)f(=)h fk(F)1705 1650 y fr(j)1723 1643 y fi (\(\);)p fl(.)22 b(With)37 1699 y(the)e(ab)q(o)o(v)o(e)g(algorithm,)g fk(D) 517 1706 y fr(R)544 1712 y ft(F)563 1720 y(j)603 1699 y fl(w)o(ould)g(b)q(e)g (added)h(to)e(b)q(oth)h fk(D)1155 1706 y fr(lef)t(tF)5 b(r)q(ontT)g(ir)q(e) 1403 1699 y fl(and)20 b fk(D)1534 1706 y fr(r)q(ig)q(htF)5 b(r)q(ontT)g(ir)q (e)1782 1699 y fl(;)21 b(since)37 1760 y fk(D)75 1767 y fr(lef)t(tF)5 b(r)q (ontT)g(ir)q(e)317 1760 y fl(and)13 b fk(D)441 1767 y fr(r)q(ig)q(htF)5 b(r)q (ontT)g(ir)q(e)701 1760 y fl(w)o(ould)13 b(con)o(tain)g(common)f(ob)s(ject)g (creation)h(expressions,)h(the)f(ab)q(o)o(v)o(e)37 1817 y(analysis)20 b(w)o (ould)g(conclude)h(that)d(they)h(cannot)g(b)q(oth)g(b)q(e)h(designated)g(as)f (a)f(comp)q(onen)o(t)h(mem)o(b)q(er)h(v)m(ari-)37 1873 y(able.)k(Ho)o(w)o(ev) o(er,)15 b(since)i(the)f(v)m(ariables)i(are)e(assigned)g(di\013eren)o(t)h(tir\ es,)f(they)g(ma)o(y)f(qualify)j(as)d(comp)q(onen)o(t)37 1930 y(v)m(ariables.) 108 1986 y(T)l(o)g(handle)h(this,)g(the)f(data)g(\015o)o(w)f(equations)i(are) f(c)o(hanged)g(to:)37 2115 y 750 2 v 89 2142 a fu(2)107 2157 y fp(The)e fm (Kil)r(le)n(d)e fp(sets)j(are)f(n)o(ull)89 2187 y fu(3)107 2203 y fp(In)i(C++\ ,)h(the)g(v)n(ariable)i fm(this)c fp(referenced)j(in)f(a)g(mem)o(b)q(er)g(fun\ ction)h(p)q(oin)o(ts)h(to)d(the)h(ob)r(ject)g(for)g(whic)o(h)h(the)e(function) j(is)37 2249 y(called)c([41].)i(F)m(or)11 b(an)h(assignmen)o(t)i(of)d(the)h (form)f fo(V)766 2253 y ft(x)797 2249 y fp(=)h fo(V)861 2253 y ft(y)880 2249 y fp(,)f(where)h fo(V)1034 2253 y ft(y)1064 2249 y fp(is)g(the)g(v)n(ariable)i fm(this)p fp(,)c(add)i(to)g fo(D)1542 2253 y ft(V)1560 2257 y fv(x)1591 2249 y fp(the)g(set)g(of)f(all)i(ob)r(ject)37 2294 y(creation)k(expressions)g(that)f (create)f(instances)i(of)d(classes)j(that)e(de\014ne)h(or)f(inherit)i(the)e (mem)o(b)q(er)h(function)g(con)o(taining)i(the)37 2340 y(assignmen)o(t.)952 2760 y fl(89)g eop bop 108 2 a 844 2 v 107 58 a 2 57 v 133 41 a fl(Assignmen) o(t)15 b(\(S\))463 58 y 2 57 v 489 41 a(gen[S])g(\(added)g(to)g fk(D)868 48 y fr(V)889 52 y ft(x)909 41 y fl(\))951 58 y 2 57 v 108 60 a 844 2 v 108 70 a 844 2 v 107 126 a 2 57 v 133 109 a fk(V)160 116 y fr(x)197 109 y fl(=)g fk (V)274 116 y fr(y)463 126 y 2 57 v 489 109 a fk(D)527 116 y fr(V)548 120 y ft (y)951 126 y 2 57 v 107 183 a 2 57 v 133 166 a fk(V)160 173 y fr(x)197 166 y fl(=)g fk(C)280 173 y fr(i)463 183 y 2 57 v 489 166 a fj(;)951 183 y 2 57 v 107 253 a 2 71 v 133 222 a fk(V)160 229 y fr(x)197 222 y fl(=)g fk(F)276 229 y fr(j)295 222 y fl(\(\))463 253 y 2 71 v 489 222 a fk(D)528 206 y fq(0)527 235 y fr(R)554 241 y ft(F)573 249 y(j)951 253 y 2 71 v 107 310 a 2 57 v 133 293 a fk(V)160 300 y fr(x)197 293 y fl(=)g fk(O)282 300 y fr(z)463 310 y 2 57 v 489 293 a fj(f)p fk(O)547 300 y fr(z)566 293 y fj(g)951 310 y 2 57 v 108 311 a 844 2 v 108 351 a fl(This)g(is)h(the)f(same)f(as)h(the)f(ab)q(o)o(v)o(e)h(set,)f (except)h(that)f(for)h(a)f(function)i(call)g(the)e(set)h fk(D)1588 334 y fq (0)1587 363 y fr(R)1614 369 y ft(F)1633 377 y(j)1668 351 y fl(\(rather)f(than) 37 420 y fk(D)75 427 y fr(R)102 433 y ft(F)121 441 y(j)141 420 y fl(\))h(is)h (added)g(to)e fk(D)447 427 y fr(V)468 431 y ft(x)489 420 y fl(.)108 484 y fk (D)147 468 y fq(0)146 497 y fr(R)173 503 y ft(F)192 511 y(j)227 484 y fl(is)i (de\014ned)g(as)f(follo)o(ws:)106 595 y fj(\017)22 b fl(if)15 b(\015o)o(w)f (analysis)i(sho)o(w)o(ed)e(that)g fk(F)740 602 y fr(j)759 595 y fl(\(\))g(cre\ ates)g(and)h(returns)f(a)h(new)g(ob)s(ject)f(eac)o(h)g(time)h(it)g(is)h(calle\ d,)1892 579 y fs(4)151 652 y fl(and)22 b(that)g fk(F)381 659 y fr(j)399 652 y fl(\(\))g(do)q(es)g(not)g(store)f(the)i(ob)s(ject)e(b)q(efore)i(returning)f (it,)i(then)e fk(D)1568 635 y fq(0)1567 664 y fr(R)1594 670 y ft(F)1613 678 y (j)1655 652 y fj(\021)h fl(the)f(set)g(of)151 721 y(ob)s(ject)17 b(creation)g (expression\(s\))g(con)o(tained)h(in)g fk(D)1042 728 y fr(R)1069 734 y ft(F) 1088 741 y(j)1108 721 y fl(,)f(eac)o(h)h(app)q(ended)h(with)e(the)g(iden)o (ti\014er)i(that)151 785 y(distinguishes)f(one)d(call)h(to)f fk(F)671 792 y fr (j)689 785 y fl(\(\))g(from)f(another.)106 878 y fj(\017)22 b fl(otherwise,) 15 b fk(D)405 862 y fq(0)404 891 y fr(R)431 897 y ft(F)450 905 y(j)485 878 y fj(\021)h fk(D)574 885 y fr(R)601 891 y ft(F)620 899 y(j)640 878 y fl(.)37 985 y(This)g(w)o(ould)f(\(in)g(the)f(ab)q(o)o(v)o(e)g(example\))h(cause)g(the)g (expressions)g(added)g(to)f fk(D)1404 992 y fr(lef)t(tF)5 b(r)q(ontT)g(ir)q (e)1647 985 y fl(to)14 b(b)q(e)h(distinct)37 1042 y(from)g(those)g(added)h (to)e fk(D)491 1049 y fr(r)q(ig)q(htF)5 b(r)q(ontT)g(ir)q(e)739 1042 y fl(.) 37 1163 y fe(8.2.4)56 b(A)22 b(F)-5 b(urther)22 b(Impro)n(v)n(emen)n(t:)28 b (Handling)22 b(Multiple)f(Instances)g(of)i(the)e(Aggre-)209 1221 y(gate)d(Ob) s(ject)37 1307 y fl(Recall)f(that)d(in)i(the)f(ab)q(o)o(v)o(e)f(analysis,)h fk (V)741 1314 y fr(c)773 1307 y fl(\(eg,)f fi(leftF)m(r)n(ontTir)n(e)p fl(\))e (in)k(one)f(ob)s(ject)f(is)h(not)g(distinguished)i(from)37 1364 y fk(V)64 1371 y fr(c)98 1364 y fl(in)g(another)f(ob)s(ject)f(of)h(the)g(same)g(class.)24 b (This)17 b(is)f(not)g(a)g(problem)h(if)g(it)f(is)h(kno)o(wn)f(that)g(there)g (is)h(only)37 1420 y(one)f(instance)g(of)f(the)g(aggregate)f(class;)h(that)f (is,)i(there)f(is)h(only)f(ob)s(ject)g(in)h(the)f(program)f(con)o(taining)i fk (V)1869 1427 y fr(c)1886 1420 y fl(.)108 1477 y(Ho)o(w)o(ev)o(er,)d(more)h (often)g(there)h(ma)o(y)f(b)q(e)h(more)f(than)g(one)g(instance)i(of)e(the)g (aggregate)f(class.)20 b(Consider)37 1533 y(the)c(follo)o(wing)g(example:)157 1683 y fg(car1)23 b(=)h(new)f(Automobile\(\);)157 1740 y(car2)g(=)h(new)f(Aut\ omobile\(\);)157 1796 y(temp)g(=)h(new)f(tire\(\);)157 1853 y(car1.leftFrontT\ ire)e(=)j(temp;)157 1909 y(car2.leftFrontTire)d(=)j(temp;)108 2059 y fl(In)11 b(this)h(case,)f(the)g(same)f(tire)h(is)g(assigned)h(as)e(the)h(left)g(fron)o (t)f(tire)h(of)f(t)o(w)o(o)g(di\013eren)o(t)h(cars,)f(indicating)j(that)37 2116 y fi(leftF)m(r)n(ontTir)n(e)h fl(of)h(class)h ff(Automobile)d fl(cannot) j(b)q(e)g(designated)g(as)g(an)f(\(exclusiv)o(e\))i(comp)q(onen)o(t.)k(Ho)o (w)o(ev)o(er,)37 2172 y(the)e(ab)q(o)o(v)o(e)f(algorithms)h(do)f(not)g(detect) h(this)g(violation,)g(since)h(they)f(do)f(not)g(distinguish)j(b)q(et)o(w)o (een)d(the)37 2229 y fi(leftF)m(r)n(ontTir)n(e)i fl(of)g fi(c)n(ar1)i fl(from) f(the)g fi(leftF)m(r)n(ontTir)n(e)e fl(or)i fi(c)n(ar2)p fl(;)j(\015o)o(w)d (analysis)h(for)f(eac)o(h)g(of)g(the)h(\014nal)g(t)o(w)o(o)37 2285 y(assignme\ n)o(ts)16 b(listed)g(ab)q(o)o(v)o(e)f(will)i(add)e fk(D)752 2292 y fr(temp) 847 2285 y fl(to)g fk(D)941 2292 y fr(lef)t(tF)5 b(r)q(ontT)g(ir)q(e)1169 2285 y fl(.)108 2342 y(T)l(o)15 b(generalize)h(the)f(ab)q(o)o(v)o(e)f(algorithms,) g(a)h(v)m(ariable)h fk(V)1062 2349 y fr(c)1093 2342 y fl(can)f(b)q(e)h(design\ ated)f(as)f(a)h(comp)q(onen)o(t)g(only)g(if)37 2398 y(b)q(oth)h(of)f(the)g (follo)o(wing)h(conditions)g(are)f(true:)37 2479 y 750 2 v 89 2506 a fu(4)107 2522 y fp(Supp)q(ose)g(that)f fo(D)374 2526 y ft(R)397 2532 y fv(F)415 2538 y (j)448 2522 y fp(only)h(con)o(tains)g(ob)r(ject)f(creation)h(expressions)h (lo)q(cal)f(to)f fo(F)1314 2526 y ft(j)1330 2522 y fp(\(\).)19 b(Then,)13 b (eac)o(h)i(function)g(in)o(v)o(o)q(cation)37 2579 y(returns)f(a)f(unique)i (ob)r(ject.)952 2760 y fl(90)g eop bop 93 42 a fl(1.)22 b(the)17 b(v)m(alues) g(assigned)g(to)f fk(V)632 49 y fr(c)665 42 y fl(are)g(distinct)h(from)f(the) g(v)m(alues)i(assigned)f(to)e(other)h(comp)q(onen)o(t)h(v)m(ari-)151 98 y(abl\ es;)f(that)e(is,)h(Comp)q(onen)o(tIfSingleAggregateInstanceP\()p fk(V)1254 105 y fr(c)1272 98 y fl(\),)g(de\014ned)h(ab)q(o)o(v)o(e;)93 190 y(2.)22 b(the)f (v)m(alues)h(assigned)f(to)f fk(V)649 197 y fr(c)687 190 y fl(in)i(one)f(inst\ ance)g(of)f(its)h(aggregate)f(class)h(m)o(ust)f(also)h(b)q(e)g(di\013eren)o (t)151 247 y(from)15 b(v)m(alues)i(assigned)f(to)f fk(V)658 254 y fr(c)691 247 y fl(in)h(another)g(instance)g(of)f(that)g(class)h(\(i.e.)22 b(the)16 b fi (leftF)m(r)n(ontTir)n(e)d fl(of)i(one)151 303 y ff(Automobile)e fl(m)o(ust)i (b)q(e)h(distinct)g(from)f(the)g fi(leftF)m(r)n(ontTir)n(e)e fl(of)i(another) f ff(Automobile)p fl(\).)37 394 y(The)19 b(second)g(condition)h(is)f(not)f (decidable)j(in)e(general)g(but)f(can)h(b)q(e)g(determined)h(to)e(b)q(e)h(tru\ e)f(for)g(some)37 450 y(common)d(cases,)g(where)h(all)g(assignmen)o(ts)f(to)f fk(V)875 457 y fr(c)907 450 y fl(are)h(of)g(the)g(follo)o(wing)h(forms:)93 540 y(1.)22 b fk(V)178 547 y fr(x)215 540 y fl(=)15 b fk(O)300 547 y fr(z)320 540 y fl(;)g(that)f(is,)h fk(V)531 547 y fr(c)563 540 y fl(is)h(alw)o(a)o(ys)f (assigned)g(a)g(newly)h(created)g(comp)q(onen)o(t)f(ob)s(ject)93 633 y(2.)22 b fk(V)178 640 y fr(x)218 633 y fl(=)d fk(F)301 640 y fr(j)319 633 y fl(\(\),)g (where)f fk(F)550 640 y fr(j)569 633 y fl(\(\))g(is)h(kno)o(wn)f(to)g(return) g(a)g(di\013eren)o(t)h(comp)q(onen)o(t)g(ob)s(ject)f(eac)o(h)g(time)h(it)g (is)151 689 y(in)o(v)o(ok)o(ed)93 781 y(3.)j(all)17 b(assignmen)o(ts)e(to)g fk (V)550 788 y fr(c)582 781 y fl(are)g(generated)h(b)o(y)f(an)h(ob)s(ject)f(cre\ ation)h(expression)g(in)g(the)g(curren)o(t)f(in)o(v)o(o-)151 838 y(cation)g (of)g(the)h(function)g(con)o(taining)f(the)h(assignmen)o(t.)k(As)15 b(noted)g (in)h(the)f(prior)h(section,)f(reac)o(hing)151 894 y(de\014nitions)i(analysis) f(can)f(determine)i(this)e(in)h(some)f(cases.)37 1015 y fe(8.2.5)56 b(Limitat\ ions)16 b(of)i(This)h(Approac)n(h)37 1101 y fl(One)c(limitation)f(of)f(the)h (ab)q(o)o(v)o(e)e(approac)o(h)h(is)h(that)f(it)g(do)q(esn't)h(distinguish)h (among)d(m)o(ultiple)k(assignmen)o(ts)37 1158 y(of)e(or)f(to)g(the)h(same)f (v)m(ariable.)21 b(That)13 b(is,)h(for)f(an)g(assignmen)o(t)h(of)f(the)h(form\ :)k fk(V)1382 1165 y fr(x)1417 1158 y fl(=)c fk(V)1493 1165 y fr(y)1513 1158 y fl(,)g(this)g(approac)o(h)f(adds)37 1214 y(all)j(of)e fk(D)189 1221 y fr(V) 210 1225 y ft(y)244 1214 y fl(to)f fk(D)336 1221 y fr(V)357 1225 y ft(x)378 1214 y fl(,)h(ev)o(en)h(though)f(only)h(a)f(subset)g(of)g(the)g(expressions)h (in)g fk(D)1389 1221 y fr(V)1410 1225 y ft(y)1445 1214 y fl(migh)o(t)f(actual\ ly)h(generate)37 1271 y(ob)s(jects)g(\(assigned)h(to)e fk(V)473 1278 y fr(y) 493 1271 y fl(\))h(that)g(reac)o(h)g(the)g(assignmen)o(t)g(of)g fk(V)1136 1278 y fr(y)1171 1271 y fl(to)g fk(V)1254 1278 y fr(x)1275 1271 y fl(.)108 1327 y (A)22 b(less)h(conserv)m(ativ)o(e)g(approac)o(h)f(w)o(ould)g(b)q(e)h(to)f(dis\ tinguish)i(among)d(m)o(ultiple)j(assignmen)o(ts)e(to)g(a)37 1384 y(v)m(ariabl\ e.)35 b(Assign)20 b(a)g(unique)h(iden)o(ti\014er)g fk(A)813 1391 y fr(n)856 1384 y fl(to)e(eac)o(h)h(assignmen)o(t,)g(and)g(asso)q(ciate)f(with)h(eac)o (h)g(assign-)37 1440 y(men)o(t)25 b fk(A)196 1447 y fr(n)243 1440 y fl(the)g (set)f fk(D)449 1447 y fr(V)470 1451 y ft(y)488 1447 y fr(;A)524 1451 y ft (n)548 1440 y fl(,)i(where)e fk(V)754 1447 y fr(y)799 1440 y fl(is)h(the)f (left-hand-side)j(v)m(ariable)f(of)e(the)g(assignmen)o(t.)47 b(De-)37 1496 y (\014ne)23 b(the)f(gen)g(sets)f(for)h(eac)o(h)f(assignmen)o(t)h(to)f(include) j(only)f(the)f(reac)o(hing)g(de\014nitions)i(for)d(the)h(righ)o(t)37 1553 y (hand)f(side)g(expression.)35 b(F)l(or)19 b(example,)j(for)d(the)h(assignmen) o(t)g fk(V)1209 1560 y fr(x)1250 1553 y fl(=)g fk(V)1332 1560 y fr(y)1353 1553 y fl(,)g(the)g(gen)g(set)g(is)h fk(D)1723 1536 y fq(0)1722 1566 y fr(V)1743 1570 y ft(y)1763 1553 y fl(,)f(where)37 1614 y fk(D)76 1597 y fq(0)75 1627 y fr(V)96 1631 y ft(y)129 1614 y fl(=)13 b(\()195 1582 y fa(S)229 1625 y fr(A) 255 1629 y ft(n)277 1625 y fq(2)p fr(Reaching)q(D)q(ef)t(initionsO)q(f)t(V) 710 1629 y ft(y)739 1614 y fk(D)777 1621 y fr(V)798 1625 y ft(y)816 1621 y fr (;A)852 1625 y ft(n)875 1614 y fl(\).)108 1670 y(When)20 b(the)f(analysis)h (is)g(completed,)h fk(D)825 1677 y fr(V)846 1681 y ft(y)885 1670 y fl(is)f (computed)g(as)f(the)g(union)h(of)f(the)h(sets)f(for)f(all)j(places)37 1727 y (where)16 b(the)f(v)m(ariable)i(ma)o(y)d(b)q(e)i(assigned;)g(that)e(is,)h fk (D)965 1734 y fr(V)986 1738 y ft(y)1019 1727 y fl(=)e(\()1085 1695 y fa(S) 1119 1738 y fr(A)1145 1742 y ft(n)1167 1738 y fq(2)p fr(Assig)q(nmentsT)5 b (oV)1461 1742 y ft(y)1490 1727 y fk(D)1528 1734 y fr(V)1549 1738 y ft(y)1567 1734 y fr(;A)1603 1738 y ft(n)1627 1727 y fl(\).)108 1783 y(Another)16 b(limi\ tation)g(is)g(that)f(the)h(ab)q(o)o(v)o(e)f(algorithm)g(do)q(es)h(not)f(handl\ e)i(represen)o(tations)e(other)h(than)37 1840 y(comp)q(onen)o(t)e(mem)o(b)q (er)g(v)m(ariables)g(for)f(denoting)h(comp)q(onen)o(t/aggregate)e(relationshi\ ps.)21 b(F)l(or)12 b(example,)j(in)37 1896 y(one)c(prop)q(osed)g(new)g(design) g(for)f(the)h fi(Choic)n(es)e fl(Virtual)i(Memory)f(system,)h(instead)g(of)f (storing)g(a)g(comp)q(onen)o(t)37 1953 y ff(Memo)o(ryObjectCache)i fl(as)h (a)g(mem)o(b)q(er)g(v)m(ariable)h(of)f ff(Memo)o(r)o(yObject)p fl(,)f(a)h(has\ h)g(table)g(has)g(b)q(een)i(prop)q(osed)e(for)37 2009 y(storing)18 b(all)h (comp)q(onen)o(t/aggregate)d(relationships)j(in)g(one)f(place.)29 b(The)18 b (ab)q(o)o(v)o(e)f(algorithms)h(w)o(ould)g(not)37 2065 y(handle)f(this.)108 2122 y(As)f(with)h(all)g(data)f(\015o)o(w)g(algorithms,)g(the)g(algorithms)g (prop)q(osed)h(here)g(are)f(conserv)m(ativ)o(e.)23 b(Whether)37 2178 y(they) 17 b(are)f(p)q(o)o(w)o(erful)g(enough)h(to)e(b)q(e)i(useful)h(can)e(only)h (b)q(e)g(learned)g(b)o(y)f(exp)q(erience.)25 b(There)17 b(probably)g(are)37 2235 y(more)d(p)q(o)o(w)o(erful)h(data\015o)o(w)e(algorithms)h(that)g(could)h (b)q(e)g(in)o(v)o(en)o(ted)g(for)e(this)i(problem,)g(but)f(that)g(is)h(not)e (the)37 2291 y(fo)q(cus)j(of)f(this)g(thesis.)37 2434 y fd(8.3)70 b(Adding)29 b(A)g(Mem)n(b)r(er)g(V)-6 b(ariable)28 b(T)-6 b(o)30 b(The)f(Set)f(Of)h(Comp) r(onen)n(t)194 2509 y(V)-6 b(ariables)37 2610 y fl(This)16 b(refactoring)f (adds)g(a)g(mem)o(b)q(er)h(v)m(ariable)g(to)f(the)g(set)g(of)g(comp)q(onen)o (t)g(v)m(ariables)i(for)d(its)i(class.)952 2760 y(91)g eop bop 37 42 a fl(The) 16 b(argumen)o(t)e(to)h(this)h(refactoring)e(is:)106 135 y fj(\017)22 b fl (the)15 b(mem)o(b)q(er)h(v)m(ariable)g(\(V\))f(to)g(b)q(e)g(added)h(to)f(the) g(comp)q(onen)o(t)g(list.)37 241 y(After)g(c)o(hec)o(king)h(its)g(preconditio\ n,)g(this)g(refactoring:)93 347 y(1.)22 b(adds)15 b(V)h(to)e(con)o(tainingCla\ ss\(V\).SetOfComp)q(onen)o(ts.)37 469 y fe(8.3.1)56 b(Preconditions)37 555 y fl(The)16 b(precondition)h(of)d(this)i(refactoring)f(is:)93 648 y(1.)22 b(qua\ li\014esAsComp)q(onen)o(tP\(mem)o(b)q(er)s 14 2 v 15 w(v)m(ariable\).)37 770 y fe(8.3.2)56 b(Beha)n(vior)18 b(Preserv)m(ation)37 856 y fl(This)g(refactoring) e(is)i(b)q(eha)o(vior)f(preserving)g(b)q(ecause)h(it)f(merely)h(annotates)e (design)h(information)g(to)f(the)37 912 y(program.)37 1055 y fd(8.4)70 b(Remo) n(ving)22 b(A)g(Mem)n(b)r(er)g(V)-6 b(ariable)22 b(F)-6 b(rom)23 b(The)f(Set) g(Of)h(Comp)r(o-)194 1130 y(nen)n(t)g(V)-6 b(ariables)37 1231 y fl(This)17 b (refactoring)f(remo)o(v)o(es)g(a)g(mem)o(b)q(er)g(v)m(ariable)i(from)d(the)i (list)g(of)e(comp)q(onen)o(t)i(v)m(ariables)g(for)f(its)g(class.)37 1288 y (the)g(argumen)o(t)e(to)h(this)g(refactoring)g(is:)106 1381 y fj(\017)22 b fl (the)15 b(mem)o(b)q(er)h(v)m(ariable)g(\(V\))f(to)g(b)q(e)g(remo)o(v)o(ed)g (from)g(the)g(comp)q(onen)o(t)g(list.)37 1487 y(This)h(refactoring:)93 1593 y (1.)22 b(remo)o(v)o(es)14 b(V)i(from)e(con)o(tainingClass\(V\).SetOfComp)q (onen)o(ts.)37 1715 y fe(8.4.1)56 b(Preconditions)37 1801 y fl(None.)37 1923 y fe(8.4.2)g(Beha)n(vior)18 b(Preserv)m(ation)37 2008 y fl(This)g(refactoring)f (is)h(b)q(eha)o(vior)g(preserving)g(b)q(ecause)g(it)g(merely)g(deletes)g(desi\ gn)g(information)g(from)e(the)37 2065 y(program.)37 2208 y fd(8.5)70 b(Mo)n (ving)30 b(Mem)n(b)r(ers)e(in)n(to)g(a)i(Comp)r(onen)n(t)e(\(P)n(oin)n(ter)g (to)h(Aggre-)194 2283 y(gate)23 b(Stored)g(in)f(Comp)r(onen)n(t\))37 2384 y fl (This)15 b(section)g(and)g(section)g(8.6)e(de\014ne)i(refactorings)f(for)g (mo)o(ving)g(a)g(set)g(of)g(mem)o(b)q(ers)g(from)g(an)g(aggregate)37 2441 y (class)h(to)f(the)h(class)g(of)f(one)h(of)f(its)h(comp)q(onen)o(ts.)20 b(One) 15 b(issue)h(in)f(mo)o(ving)g(suc)o(h)g(mem)o(b)q(ers)f(is)i(whether)e(they) 37 2497 y(can)g(still)g(reference)g(mem)o(b)q(ers)f(remaining)h(in)g(the)f (aggregate)f(class.)19 b(The)13 b(t)o(w)o(o)f(refactorings)h(di\013er)g(in)h (ho)o(w)37 2554 y(they)f(handle)h(references)f fi(by)g fl(a)f(mem)o(b)q(er)h (b)q(eing)h(mo)o(v)o(ed)e fi(to)h fl(a)g(mem)o(b)q(er)f(that)g(will)j(remain) e(in)g(the)g(aggregate)37 2610 y(class.)23 b(This)16 b(section)h(describ)q (es)g(a)f(refactoring)g(where)g(a)f(p)q(oin)o(ter)i(to)e(the)h(aggregate)e (ob)s(ject)i(is)g(stored)g(in)952 2760 y(92)g eop bop 37 42 a fl(the)18 b(com\ p)q(onen)o(t,)g(so)f(that)g(references)h(bac)o(k)g(to)f(mem)o(b)q(ers)h(of)f (the)g(aggregate)g(ob)s(ject)g(can)g(b)q(e)i(made)e(via)37 98 y(this)g(p)q (oin)o(ter.)25 b(The)17 b(next)f(section)h(describ)q(es)h(a)f(refactoring)f (where)g(the)h(aggregate)e(ob)s(ject)h(is)h(passed)g(as)37 154 y(an)f(argumen) o(t)e(in)i(calls)g(to)f(all)h(functions)g(that)e(reference)i(mem)o(b)q(ers)g (remaining)g(in)g(the)f(aggregate)f(class.)108 211 y(During)23 b(refactoring,) g(the)f(new)g(mem)o(b)q(ers)g(of)g(the)g(comp)q(onen)o(t)g(class)h(are)f(adde\ d)g(b)q(efore)h(the)f(old)37 267 y(mem)o(b)q(ers)16 b(are)g(deleted)h(from)e (the)h(aggregate)e(class.)23 b(Sometimes,)15 b(a)h(comp)q(onen)o(t)g(class)g (will)i(b)q(e)e(a)g(sup)q(er-)37 324 y(class)h(\(or)f(sub)q(class\))h(of)f (an)g(aggregate)f(class.)24 b(F)l(or)15 b(example,)i(in)h(a)e(user)g(in)o(ter\ face)h(framew)o(ork)e(the)h(class)37 380 y ff(Windo)o(w)i fl(migh)o(t)f(inclu\ de)j(comp)q(onen)o(ts)d(of)g(class)h ff(Sub-Windo)o(w)p fl(;)h(these)f(t)o (w)o(o)e(classes)h(w)o(ould)h(probably)g(b)q(e)37 437 y(part)g(of)g(the)g(sam\ e)g(inheritance)i(hierarc)o(h)o(y)l(.)29 b(In)19 b(this)g(cases,)f(naming)h (con\015icts)g(could)g(o)q(ccur)g(when)f(the)37 493 y(mem)o(b)q(ers)i(are)g (added)g(to)f(the)h(comp)q(onen)o(t)g(class.)34 b(When)20 b(p)q(oten)o(tial)h (naming)f(con\015icts)h(are)e(detected,)37 550 y(the)e(mem)o(b)q(ers)f(b)q (eing)h(added)g(to)e(the)h(comp)q(onen)o(t)g(class)g(are)g(giv)o(en)h(an)e (\(automatically)i(generated\))e(new)37 606 y(name.)27 b(After)17 b(the)g(ref\ actoring)g(is)h(\014nished,)h(the)f(user)f(could)h(rename)g(the)f(mo)o(v)o (ed)g(mem)o(b)q(ers)g(using)h(the)37 663 y fi(change)s 14 2 v 14 w(variable)s 14 2 v 14 w(name)d fl(or)f fi(change)s 14 2 v 14 w(memb)n(er)s 14 2 v 13 w (function)s 14 2 v 14 w(name)h fl(refactoring.)37 769 y(The)h(argumen)o(ts)e (to)h(this)g(refactoring)g(are:)106 875 y fj(\017)22 b fl(the)15 b(aggregate) f(class)i(\(C\))106 969 y fj(\017)22 b fl(the)15 b(set)g(of)g(mem)o(b)q(er)h (v)m(ariables)g(b)q(eing)h(mo)o(v)o(ed)d(\(setOfMo)o(vingV)l(ars\))106 1063 y fj(\017)22 b fl(the)15 b(set)g(of)g(mem)o(b)q(er)h(functions)f(b)q(eing)i(mo) o(v)o(ed)e(\(setOfMo)o(vingF)l(uncs\))106 1156 y fj(\017)22 b fl(the)15 b(com\ p)q(onen)o(t)h(mem)o(b)q(er)f(v)m(ariable)i(\(V\))108 1263 y(In)d(this)h(desc\ ription,)g(the)f(class)g(of)f(the)h(comp)q(onen)o(t)g(mem)o(b)q(er)g(v)m(aria\ ble)h(\(ie)f(V.t)o(yp)q(e\))g(is)g(referred)g(to)f(as)37 1319 y(comp)q(onen)o (tClass.)37 1425 y(After)i(c)o(hec)o(king)h(its)g(preconditions,)g(this)g(ref\ actoring:)93 1532 y(1.)22 b(mak)o(es)17 b fi(A)n(ggr)n(e)n(gateObje)n(ct)f fl (a)h(mem)o(b)q(er)h(v)m(ariable)h(of)e(comp)q(onen)o(tClass,)h(with)g(a)f(t)o (yp)q(e)g(that)g(accepts)151 1588 y(an)e(instance)h(of)f(class)h(C:)170 1682 y (\(a\))22 b(if)g(the)g(mem)o(b)q(er)g(v)m(ariable)h fi(A)n(ggr)n(e)n(gateObje) n(ct)c fl(is)k(already)e(a)h(mem)o(b)q(er)f(of)h(comp)q(onen)o(tClass,)251 1738 y(then:)288 1812 y(i.)h(if)12 b(the)g(curren)o(t)f(t)o(yp)q(e)g(of)g fi (A)n(ggr)n(e)n(gateObje)n(ct)f fl(is)i(not)f(C)g(\(or)g(a)g(sup)q(erclass)h (of)f(C\),)g(c)o(hange)s 14 2 v 13 w(t)o(yp)q(e)336 1868 y(is)16 b(called)g (to)e(c)o(hange)h(the)g(t)o(yp)q(e)g(of)g fi(A)n(ggr)n(e)n(gateObje)n(ct)e fl (to)h(b)q(e)h(a)g(sup)q(erclass)h(common)e(to)h(C)336 1924 y(and)h(the)f(curr\ en)o(t)g(t)o(yp)q(e)g(of)g fi(A)n(ggr)n(e)n(gateObje)n(ct)p fl(.)168 1998 y (\(b\))22 b(else,)16 b(if)g fi(A)n(ggr)n(e)n(gateObje)n(ct)d fl(is)j(already) f(a)g(mem)o(b)q(er)g(of)g(one)g(or)g(more)g(sub)q(classes)h(of)f(C:)288 2071 y (i.)23 b(for)12 b(eac)o(h)g(sub)q(class)h(where)f(the)g(lo)q(cally)i(de\014ne\ d)f fi(A)n(ggr)n(e)n(gateObje)n(ct)d fl(has)i(a)g(t)o(yp)q(e)g(that)f(is)i (not)336 2127 y(C)e(\(or)g(a)g(sup)q(erclass)h(of)f(C\),)f(c)o(hange)s 14 2 v 14 w(t)o(yp)q(e)h(is)h(called)h(to)e(c)o(hange)g(the)g(t)o(yp)q(e)h(of)f fi (A)n(ggr)n(e)n(gateOb-)336 2183 y(je)n(ct)k fl(to)f(b)q(e)i(a)f(sup)q(erclass) h(common)f(to)g(C)g(and)g(the)g(curren)o(t)g(t)o(yp)q(e)h(of)f fi(A)n(ggr)n (e)n(gateObje)n(ct)p fl(.)276 2248 y(ii.)23 b(mo)o(v)o(e)s 14 2 v 13 w(mem)o (b)q(er)s 14 2 v 13 w(v)m(ariable)s 14 2 v 15 w(to)s 14 2 v 13 w(sup)q(erclas\ s)18 b(is)f(called)i(to)d(mo)o(v)o(e)g fi(A)n(ggr)n(e)n(gateObje)n(ct)f fl (to)i(com-)336 2305 y(p)q(onen)o(tClass.)173 2378 y(\(c\))22 b(else,)15 b(cre\ ate)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)g(is)f(called)i(to)c (add)i(the)g(v)m(ariable)h fi(A)n(ggr)n(e)n(gateObje)n(ct)d fl(\(t)o(yp)q(e:) 18 b(the)251 2434 y(aggregate)c(class\))h(as)g(a)g(protected)g(mem)o(b)q(er)g (of)g(comp)q(onen)o(tClass.)93 2528 y(2.)22 b(if)c(access)f(to)f(V)i(is)f(not) g(already)g(abstracted,)g(calls)h(abstract)s 14 2 v 12 w(access)s 14 2 v 14 w (to)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)h(to)d(ab-)151 2584 y (stract)e(access)i(in)g(C)f(to)f(V.)952 2760 y(93)g eop bop 93 42 a fl(3.)22 b (in)16 b(the)f(up)q(date)h(function)g(\(created)f(in)h(the)f(previous)h(step\ \),)f(adds)g(the)h(assignmen)o(t:)270 131 y fg(AggregateObject)22 b(=)i(<`thi\ s',)f(the)g(aggregate)g(object>)151 221 y fl(\(steps)17 b(t)o(w)o(o)e(and)j (three)f(are)f(needed)j(so)d(that)g(all)i(ob)s(jects)f(assigned)g(to)g(V)g (will)h(con)o(tain)f(a)g(p)q(oin)o(ter)151 278 y(to)e(the)g(aggregate\))93 364 y(4.)22 b(for)15 b(eac)o(h)h(v)m(ariable)h(in)g(setOfMo)o(vingV)l(ars,)e(call\ s)i(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)g(to)e(add)h (an)g(equiv)m(alen)o(t)151 420 y(\(p)q(ossibly)h(renamed\))e(v)m(ariable)h (as)f(a)g(public)i(mem)o(b)q(er)f(of)e(comp)q(onen)o(tClass.)93 507 y(5.)22 b (for)12 b(eac)o(h)g(function)g(in)h(setOfMo)o(vingF)l(uncs,)g(calls)g(create) s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(function)g(to)e(add)h(the)g(signatur\ e)151 563 y(of)g(the)g(\(p)q(ossibly)h(renamed\))f(function)h(as)e(a)h(public) i(mem)o(b)q(er)e(of)f(comp)q(onen)o(tClass.)19 b(Then,)13 b(for)e(eac)o(h)151 620 y(function)16 b(in)f(setOfMo)o(vingF)l(uncs,)g(calls)h(add)s 14 2 v 14 w (function)s 14 2 v 14 w(b)q(o)q(dy)g(to)e(add)h(the)g(function)g(b)q(o)q(dy)h (of)e(eac)o(h)151 676 y(function)h(b)q(eing)h(mo)o(v)o(ed.)j(References)c(to) f(mem)o(b)q(ers)h(that)e(will)j(remain)f(in)g(the)f(aggregate)f(class)i(are) 151 732 y(pre\014xed)h(with)g fi(A)n(ggr)n(e)n(gateObje)n(ct)p fl(.)93 819 y (6.)22 b(replaces)12 b(eac)o(h)g(reference)g fi(to)g fl(a)f(mem)o(b)q(er)g (b)q(eing)i(mo)o(v)o(ed,)e(with)h(a)f(reference)h(to)f(its)h(replacing)g(mem) o(b)q(er)151 875 y(in)k(comp)q(onen)o(tClass.)93 961 y(7.)22 b(calls)16 b(del\ ete)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 14 w(functions)f(and)g(delete)s 14 2 v 15 w(unreferenced)s 14 2 v 14 w(v)m(ariable)h(to)e(remo)o(v)o(e)g(the)h(no)o (w)f(unref-)151 1018 y(erenced)i(mem)o(b)q(ers)g(from)e(V.)37 1136 y fe(8.5.1) 56 b(Preconditions)37 1222 y fl(The)16 b(preconditions)h(for)d(this)i(refacto\ ring)f(are:)93 1302 y(1.)22 b(quali\014esAsComp)q(onen)o(tP\(V\))151 1358 y (\(V)15 b(quali\014es)i(as)e(a)g(comp)q(onen)o(t)g(mem)o(b)q(er)g(v)m(ariable) i(of)e(C.\))1181 1342 y fs(5)93 1445 y fl(2.)22 b fj(8)16 b fl(F)e fj(2)i fl (setOfMo)o(vingF)l(uncs,)226 1501 y fj(8)g fl(referencedMem)o(b)q(er)g fj(2)f fl(\(v)m(ariablesReferencedBy\(F\))i fj([)301 1557 y fl(functionsCalledBy\(F\ \)\),)451 1614 y(if)f(referencedMem)o(b)q(er)g fj(2)f fl(mem)o(b)q(ersOf\(com\ p)q(onen)o(tClass\))h fj(^)526 1670 y fl(referencedMem)o(b)q(er)g fj(62)g fl (\(setOfV)l(ars)e fj([)i fl(setOfF)l(uncs\),)601 1727 y(referencedMem)o(b)q (er.accessCon)o(trolMo)q(de)g(=)f(public.)151 1783 y(\(if)k(an)o(y)e(function\ s)i(in)g(setOfF)l(uncs)g(reference)g(mem)o(b)q(ers)g(remaining)g(in)g(comp)q (onen)o(tClass,)g(those)151 1840 y(referenced)d(mem)o(b)q(ers)g(are)e(public\ \).)93 1926 y(3.)22 b(the)15 b(v)m(alue)h(of)e(V)g(is)h(assigned)g(b)q(efore) g(an)o(y)f(mem)o(b)q(er)h fj(2)g fl(\(setOfMo)o(vingV)l(ars)f fj([)h fl(setOf\ Mo)o(vingF)l(uncs\))151 1982 y(is)20 b(referenced;)h(V)e(is)g(not)g(reassigne\ d.)31 b(This)19 b(is)h(needed)g(to)e(ensure)i(that)e(all)i(references)f(to)f (eac)o(h)151 2039 y(mo)o(ving)13 b(mem)o(b)q(er)h(will)h(p)q(oin)o(t)e(to)g (the)g(same)g(lo)q(cation)h(at)f(all)h(times.)20 b(Program)11 b(\015o)o(w)i (analysis)h(w)o(ould)151 2095 y(b)q(e)i(needed)h(to)d(determine)i(this.)93 2182 y(4.)22 b fj(8)16 b fl(class)f fj(2)h fl(\(comp)q(onen)o(tClass)f fj([)g fl(sub)q(classesOf\(comp)q(onen)o(tClass\)\),)226 2238 y(mem)o(b)q(erV)l(aria\ bleNamed\(class,)i fi(A)n(ggr)n(e)n(gateObje)n(ct)p fl(\))c fj(\))301 2295 y fl(commonSup)q(erclass\(mem)o(b)q(erV)l(ariableNamed\(class,)k fi(A)n(ggr)n (e)n(gateObje)n(ct)p fl(\),)c(C\).)151 2351 y(\(if)i fi(A)n(ggr)n(e)n(gateObj\ e)n(ct)e fl(is)j(a)f(mem)o(b)q(er)g(of)f(comp)q(onen)o(tClass)h(or)g(one)g (its)g(sub)q(classes,)h(the)f(t)o(yp)q(e)g(of)g fi(A)n(g-)151 2407 y(gr)n(e)n (gateObje)n(ct)10 b fl(shares)h(a)g(common)g(sup)q(erclass)h(with)g(C)f(\(the) g(aggregate)f(class)h(in)h(this)g(refactoring\)\).)37 2476 y 750 2 v 89 2503 a fu(5)107 2519 y fp(The)18 b(requiremen)o(t)h(here)g(is)g(that)f(the)g(ob)r (ject)h(assigned)h(to)e(V)g(in)h(one)g(instance)g(of)f(C)g(is)h(not)f(aliased) i(as)f(the)f(v)n(alue)37 2564 y(assigned)g(to)e(V)f(in)i(another)f(instance)i (of)d(C.)g(This)h(condition)j(is)d(implied)i(if)e(V)f(quali\014es)k(as)c(a)h (comp)q(onen)o(t)h(v)n(ariable.)27 b(F)m(or)37 2610 y(further)14 b(discussion\ s,)h(see)e(section)i(8.8.)952 2760 y fl(94)g eop bop 37 42 a fe(8.5.2)56 b (Beha)n(vior)18 b(Preserv)m(ation:)23 b(Steps)18 b(1-5)37 127 y fl(F)l(or)j (step)g(1-\(a\):)31 b(for)21 b(c)o(hange)s 14 2 v 13 w(t)o(yp)q(e:)32 b(preco\ ndition)23 b(1)d(\(assignmen)o(ts)h(to)g(the)g(v)m(ariable)h(w)o(ould)g(remai\ n)37 184 y(t)o(yp)q(e)16 b(safe\))f(is)h(satis\014ed)g(b)q(ecause)h(the)e(new) h(t)o(yp)q(e)g(w)o(ould)g(b)q(e)g(a)f(sup)q(ert)o(yp)q(e)i(b)q(oth)e(of)h(C)f (and)h(of)f(its)h(curren)o(t)37 240 y(t)o(yp)q(e;)g(precondition)h(2)f(\(rega\ rding)f(assignmen)o(ts)g(of)h(the)f(v)m(ariable\))i(is)f(satis\014ed)g(b)q (ecause)h(b)o(y)e(con)o(v)o(en)o(tion)37 297 y(the)21 b(v)m(ariable)h(is)f (only)g(used)g(as)f(a)g(reference)h(p)q(oin)o(ter,)h(and)e(is)h(not)f(reassig\ ned.)36 b(F)l(or)20 b(step)h(1-\(b\):)29 b(the)37 353 y(preconditions)22 b (of)e(c)o(hange)s 14 2 v 14 w(t)o(yp)q(e)g(are)g(satis\014ed)h(for)e(the)i (same)f(reasons)f(as)h(giv)o(en)h(for)f(step)g(1-\(a\).)34 b(F)l(or)37 410 y (mo)o(v)o(e)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)s 14 2 v 15 w (to)s 14 2 v 12 w(sup)q(erclass:)h(precondition)23 b(1)f(\(regarding)g(matc)o (hing)g(attributes\))f(is)i(sat-)37 466 y(is\014ed)g(b)o(y)e(the)h(prior)f (step)g(\(when)h(c)o(hange)s 14 2 v 13 w(t)o(yp)q(e)g(is)f(applied\);)26 b (precondition)d(2)e(\(that)f(the)h(v)m(ariable)i(is)37 523 y(not)f(already)g (de\014ned)h(in)f(the)g(sup)q(erclass\))h(b)o(y)e(the)h(conditions)h(of)e(ste\ p)h(1-\(b\).)39 b(F)l(or)21 b(step)h(1-\(c\):)32 b(for)37 579 y(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable:)21 b(precondition)16 b(1)e(\(t\ he)f(new)i(v)m(ariable)g(do)q(esn't)f(collide)j(with)d(another)g(v)m(ariable) 37 635 y(referenced)g(within)h(its)e(in)o(tended)h(scop)q(e\))f(is)h(triviall\ y)g(satis\014ed)g(b)q(ecause)g(this)f(step)g(is)g(in)o(v)o(ok)o(ed)g(only)h (when)37 692 y(the)i(v)m(ariable)i(is)e(not)g(de\014ned)h(in)g(a)e(sup)q(ercl\ ass)i(or)e(sub)q(class.)23 b(Also,)16 b(b)o(y)g(con)o(v)o(en)o(tion,)g fi(A)n (ggr)n(e)n(gateObje)n(ct)e fl(is)37 748 y(a)j(reserv)o(ed)g(name)g(only)h(use\ d)f(as)g(a)f(mem)o(b)q(er)h(v)m(ariable)i(to)d(p)q(oin)o(t)h(to)g(a)f(comp)q (onen)o(t)h(ob)s(ject's)f(aggregate;)37 805 y(therefore)f(there)h(will)h(not) d(b)q(e)i(an)o(y)f(lo)q(cal)h(or)f(global)h(v)m(ariables)g(that)f(collide)i (with)f(it.)108 861 y(F)l(or)e(abstract)s 14 2 v 13 w(access)s 14 2 v 13 w (to)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)j(\(step)d(2\):)19 b (precondition)d(1)f(\(access)f(to)h(the)f(v)m(ariable)j(has)37 918 y(not)d (already)h(b)q(een)g(abstracted\))f(is)h(satis\014ed)g(b)q(ecause)g(step)f (2-\(a\))f(is)i(only)g(in)o(v)o(ok)o(ed)g(when)f(this)h(condition)37 974 y (is)h(true.)108 1031 y(F)l(or)i(the)h(assignmen)o(t)g(added)g(to)g(the)g(up)q (date)g(function)h(in)f(step)g(3,)g(program)f(prop)q(ert)o(y)g(sev)o(en)i(\(s\ e-)37 1087 y(man)o(tically)f(equiv)m(alen)o(t)f(references)g(and)f(op)q(erati\ ons\))g(is)g(preserv)o(ed)h(b)q(ecause)g(the)f(statemen)o(t)f(assigns)h(a)37 1144 y(v)m(alue)g(to)e(a)g(newly)h(created)g(and)g(unreferenced)g(v)m(ariable\ .)22 b(By)16 b(preconditions)h(7)e(and)h(8,)f(and)g(steps)h(1-\(a\))37 1200 y (and)f(1-\(b\),)e(the)h(v)m(ariable)i fi(A)n(ggr)n(e)n(gateObje)n(ct)c fl(wil\ l)k(b)q(e)f(de\014ned)g(in)g(the)f(comp)q(onen)o(t)h(class)f(and)g(its)h(t)o (yp)q(e)f(will)37 1256 y(accept)i(an)f(instance)h(of)f(the)g(aggregate)f(clas\ s.)20 b(Other)15 b(program)g(prop)q(erties)g(are)g(trivially)i(preserv)o(ed.) 108 1313 y(F)l(or)e(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariab\ le)i(\(step)e(4\):)21 b(precondition)c(1)e(\(the)h(new)g(v)m(ariable)h(do)q (esn't)e(collide)j(with)37 1369 y(another)f(v)m(ariable)h(referenced)g(within) g(its)f(in)o(tended)h(scop)q(e\))f(is)g(satis\014ed)g(b)q(ecause)h(it)f(is)g (giv)o(en)g(a)g(unique)37 1426 y(name)f(in)g(cases)f(where)g(a)g(name)g(con\ \015ict)i(w)o(ould)e(o)q(ccur.)108 1482 y(F)l(or)h(create)s 14 2 v 13 w(mem)o (b)q(er)s 14 2 v 14 w(function)i(\(step)e(5\):)23 b(preconditions)18 b(1)f (through)f(4)g(\(regarding)h(collisions)i(with)37 1539 y(mem)o(b)q(ers)c(de\ \014ned)h(in)f(sup)q(erclasses)h(or)e(sub)q(classes\))h(is)g(satis\014ed)h (b)q(ecause)f(it)g(is)g(giv)o(en)g(a)f(unique)i(name)f(in)37 1595 y(cases)j (where)g(a)f(name)h(con\015ict)g(w)o(ould)h(o)q(ccur;)f(precondition)i(5)d (is)h(trivially)h(satis\014ed)g(b)q(ecause)f(there)g(is)37 1652 y(no)e(functi\ on)g(b)q(o)q(dy)l(.)108 1708 y(F)l(or)c(add)s 14 2 v 13 w(function)s 14 2 v 14 w(b)q(o)q(dy)h(\(step)f(5\):)18 b(precondition)c(1)e(\(all)g(v)m(ariables)i (and)e(functions)h(referenced)g(in)g(the)37 1765 y(function)j(b)q(o)q(dy)g (are)f(visible)i(from)d(the)h(sup)q(erclass\))h(is)g(satis\014ed)f(b)o(y)g (precondition)i(2)d(of)h(this)g(refactoring;)37 1821 y(precondition)21 b(2)d (\(the)g(mem)o(b)q(er)h(function)g(is)h(not)e(called\))i(is)f(satis\014ed)g (b)q(ecause)g(the)g(function)h(is)f(newly)37 1877 y(added)d(to)f(the)g(comp)q (onen)o(t)h(and)f(is)h(not)e(y)o(et)h(referenced.)37 1999 y fe(8.5.3)56 b(Beh\ a)n(vior)18 b(Preserv)m(ation:)23 b(Step)18 b(6)h(\(Replacing)e(References\)) 37 2085 y fl(The)h(k)o(ey)f(step)h(in)g(the)f(refactoring)g(is)h(step)g(6,)f (where)g(references)h(to)f(mem)o(b)q(ers)h(in)g(the)f(aggregate)f(class)37 2141 y(are)g(replaced)h(b)o(y)f(references)h(to)e(mem)o(b)q(ers)h(in)h(the)f (comp)q(onen)o(t.)22 b(There)16 b(are)g(sev)o(eral)g(things)g(that)g(migh)o (t)37 2198 y(happ)q(en)h(that)d(could)j(prev)o(en)o(t)e(this)g(from)g(b)q(ein\ g)h(done)g(safely:)108 2254 y(Eac)o(h)e(new)f(mem)o(b)q(er)h(migh)o(t)g(not)f (b)q(e)h(visible)i(in)f(all)f(places)h(where)f(the)f(old)i(mem)o(b)q(er)e(\(i\ t)h(replaces\))g(w)o(as)37 2311 y(visible.)23 b(Ho)o(w)o(ev)o(er,)13 b(in)j (steps)g(four)e(and)i(\014v)o(e)f(the)g(new)h(mem)o(b)q(ers)f(are)g(public.) 108 2367 y(One)f(or)f(more)h(of)f(the)g(functions)i(b)q(eing)f(mo)o(v)o(ed)g (migh)o(t)f(mak)o(e)g(references)h(to)f(v)m(ariables)i(and)f(functions)37 2424 y(that)g(are)g(visible)j(from)c(the)i(aggregate)d(class)j(but)g(not)e(from)h (the)g(comp)q(onen)o(t)h(class.)20 b(By)14 b(precondition)i(2,)952 2760 y(95) g eop bop 37 42 a fl(suc)o(h)17 b(references)f(will)h(b)q(e)g(visible,)g(pro) o(vided)g(that)e(a)g(p)q(oin)o(ter)h(to)f(the)h(aggregate)e(ob)s(ject)h(is)i (stored)e(in)h(the)37 98 y(comp)q(onen)o(t;)f(b)o(y)h(step)f(3)g(of)f(this)i (refactoring,)e(suc)o(h)i(a)f(p)q(oin)o(ter)h(is)f(assigned.)1381 81 y fs(6) 108 154 y fl(The)e(t)o(yp)q(e)g(of)f(the)h(new)g(mem)o(b)q(er)g(migh)o(t)g (b)q(e)g(di\013eren)o(t)g(from)f(the)h(t)o(yp)q(e)g(of)f(the)h(old)g(mem)o (b)q(er,)g(and)g(hence)37 211 y(not)j(supp)q(ort)g(the)h(same)e(op)q(erations\ .)23 b(This)17 b(will)h(not)d(happ)q(en)i(\(b)o(y)f(construction\))g(since)i (in)e(steps)g(4)g(and)37 267 y(5)f(the)h(new)f(mem)o(b)q(ers)g(ha)o(v)o(e)g (the)g(same)g(t)o(yp)q(es)h(as)e(the)i(mem)o(b)q(ers)f(they)g(are)g(replacing\ .)108 324 y(Mem)o(b)q(er)g(v)m(ariables)h(in)g(the)f(comp)q(onen)o(t)h(are)e (referenced)i(through)f(a)g(lev)o(el)h(of)f(indirection)i(\(the)e(com-)37 380 y(p)q(onen)o(t)h(v)m(ariable\);)g(this)g(could)g(lead)g(to)e(problems:)93 474 y(1.)22 b(if)d(an)g(instance)h(of)e(the)h(comp)q(onen)o(t)g(class)g(if)g(not) g(assigned)g(to)f(the)h(comp)q(onen)o(t)g(v)m(ariable)h(b)q(efore)151 531 y (a)e(reference)g(is)g(made)g(through)g(that)f(v)m(ariable,)i(the)f(reference) h(will)g(b)q(e)g(in)o(v)m(alid.)30 b(Precondition)19 b(3)151 587 y(ensures)d (this)f(will)i(not)e(happ)q(en.)93 681 y(2.)22 b(if)13 b(the)f(v)m(alue)h(of) f(the)g(comp)q(onen)o(t)h(v)m(ariable)g(c)o(hanges)f(\(i.e.)19 b(a)12 b(new)h (ob)s(ject)e(is)i(assigned)g(to)e(it\))h(b)q(et)o(w)o(een)151 737 y(reference\ s)21 b(made)f(via)g(the)h(comp)q(onen)o(t)f(v)m(ariable,)i(the)e(references)h (will)h(not)e(b)q(e)g(consisten)o(t)h(\(i.e.)151 794 y(adjacen)o(t)g(reads)h (ma)o(y)f(not)g(return)h(the)g(same)f(v)m(alue,)k(and)c(a)h(read)f(ma)o(y)g (not)h(return)f(the)h(most)151 850 y(recen)o(tly)16 b(written)f(v)m(alue\).) 21 b(Precondition)16 b(3)f(ensures)h(this)g(will)h(not)d(happ)q(en.)93 944 y (3.)22 b(if)c(t)o(w)o(o)e(di\013eren)o(t)i(aggregate)d(ob)s(jects)i(use)h(the) f(same)g(indirection)j(\(i.e.)26 b(p)q(oin)o(t)18 b(through)f(the)h(same)151 1000 y(comp)q(onen)o(t)d(ob)s(ject\),)e(then)i(up)q(dates)g(made)g(b)o(y)f (one)h(aggregate)e(ob)s(ject)h(will)i(not)e(b)q(e)h(distinct)h(from)151 1057 y (up)q(dates)j(made)f(b)o(y)g(the)g(other)g(aggregate)f(ob)s(ject.)28 b(Precon\ dition)19 b(1)f(ensures)h(that)e(this)i(will)h(not)151 1113 y(happ)q(en.)108 1207 y(A)o(t)14 b(this)h(p)q(oin)o(t,)g(it)f(has)h(b)q(een)g(argued)f(that)g (v)m(ariables)i(and)f(functions)g(will)h(b)q(e)f(visible)i(to)c(their)i(calle\ rs)37 1264 y(b)q(efore)i(and)g(after)f(the)g(mo)o(v)o(e,)g(that)g(the)h(t)o (yp)q(es)f(of)g(mem)o(b)q(ers)h(will)h(b)q(e)f(the)g(same,)f(and)h(that,)f (despite)h(the)37 1320 y(lev)o(el)h(of)d(indirection,)j(references)f(to)e(the) h(old)h(mem)o(b)q(er\(s\))e(in)i(the)f(aggregate)e(class)i(will)i(consisten)o (tly)f(b)q(e)37 1377 y(replaced)c(b)o(y)f(references)g(to)f(the)g(new)h(mem)o (b)q(ers)g(in)g(the)g(comp)q(onen)o(t.)18 b(Belo)o(w)12 b(is)g(a)f(more)g(for\ mal)h(argumen)o(t.)37 1433 y(It)17 b(considers)g(the)f(case)g(of)g(mo)o(ving) g(a)f(single)j(v)m(ariable)f(from)f(an)g(aggregate)e(class)j(to)e(the)h(class) h(of)f(one)g(of)37 1489 y(its)g(comp)q(onen)o(ts.)k(It)15 b(can)g(trivially)i (b)q(e)f(extended)g(to)f(handle)h(m)o(ultiple)h(mem)o(b)q(ers.)108 1546 y(Con\ sider)d(a)f(program)f(execution)i(trace)f(as)g(a)g(series)g(of)g(reads)g(and) h(writes)f(to)f(memory)l(.)19 b(F)l(or)13 b(b)q(eha)o(vior)37 1602 y(to)j(b)q (e)h(preserv)o(ed,)f(the)g(execution)i(traces)d(b)q(efore)i(and)f(after)f(the) i(refactoring)e(m)o(ust)h(b)q(e)h(equiv)m(alen)o(t.)24 b(F)l(or)37 1659 y(the) 16 b(traces)e(to)h(b)q(e)h(equiv)m(alen)o(t,)g(equiv)m(alen)o(t)h(op)q(eratio\ ns)f(m)o(ust)e(b)q(e)i(p)q(erformed)g(on)f(equiv)m(alen)o(t)i(v)m(alues.)108 1715 y(Regarding)h(equiv)m(alen)o(t)g(op)q(erations,)f(there)g(is)g(a)g(funct\ ion)g(that)f(maps)h fi(e)n(ach)g(step)g fl(in)h(the)e(\014rst)h(trace)37 1772 y(\(b)q(efore)e(the)h(refactoring\))e(to)g(an)h fi(e)n(quivalent)g(set)h(of)g (steps)f fl(in)h(the)f(second)g(trace.)20 b(Usually)l(,)c(a)e(step)i(in)f(the) 37 1828 y(\014rst)h(trace)g(maps)g(to)g(a)f(single)j(step)e(in)h(the)g(second) f(trace,)g(but)g(not)g(alw)o(a)o(ys.)22 b(The)17 b(refactoring)e(will)j(add) 37 1885 y(in)i(an)e(extra)g(lev)o(el)i(of)e(indirection)j(\(the)d(comp)q(onen) o(t\))h(for)f(some)g(references,)h(requiring)h(an)f(extra)f(read)37 1941 y (op)q(eration.)108 1998 y(Regarding)f(the)f(v)m(alues)h(read)e(or)h(written,) f(they)h(are)g(either)g(n)o(um)o(b)q(ers)h(or)e(addresses)h(of)f(ob)s(jects.) 22 b(Al-)37 2054 y(though)c(equiv)m(alen)o(t)i(v)m(alues)f(in)g(equiv)m(alen) o(t)h(traces)d(will)j(b)q(e)f(iden)o(tical)g(if)g(they)f(are)g(n)o(um)o(b)q (ers,)g(addresses)37 2110 y(ma)o(y)c(not)g(b)q(e)g(iden)o(tical)j(since)e(the) f(refactoring)g(c)o(hanges)g(the)g(sizes)h(of)f(ob)s(jects.)19 b(Instead,)14 b (there)g(is)h(a)f(func-)37 2167 y(tion)f(that)e(maps)g(v)m(ariables)j(and)e (functions)g(in)h(one)f(trace)f(to)h(their)g(equiv)m(alen)o(t)i(v)m(ariables) f(and)f(functions)h(in)37 2223 y(the)i(other)g(trace.)k(One)d(w)o(a)o(y)d(to) h(create)h(this)g(function)h(is)f(to)f(sa)o(y)g(that)g(the)h(n'th)g(new)g(add\ ress)f(referenced)37 2280 y(as)k(a)g(v)m(alue)i(\(i.e.)29 b(not)17 b(just)h (as)g(a)g(mem)o(b)q(er)g(v)m(ariable\))i(of)e(one)g(trace)g(will)i(b)q(e)e (mapp)q(ed)h(to)f(the)g(n'th)g(new)37 2336 y(address)e(referenced)g(as)f(a)g (v)m(alue)h(of)f(the)g(other.)108 2393 y ff(Lemm)m(a:)i fl(If)e(traces)g(are) g(equiv)m(alen)o(t)i(then)e(equiv)m(alen)o(t)i(lo)q(cations)f(con)o(tain)f (equiv)m(alen)o(t)i(v)m(alues.)37 2474 y 750 2 v 89 2501 a fu(6)107 2517 y fp (F)m(or)f(the)g(refactoring)h(in)g(the)g(next)f(section,)i(suc)o(h)f(referenc\ es)g(will)h(b)q(e)e(visible)j(b)q(ecause)e(a)f(p)q(oin)o(ter)i(to)e(the)g(agg\ regate)37 2562 y(ob)r(ject)e(is)f(passed)h(in)g(calls)h(to)e(functions)h(that) f(reference)h(mem)o(b)q(ers)f(not)g(otherwise)h(visible)i(to)d(the)g(comp)q (onen)o(t.)952 2760 y fl(96)g eop bop 108 42 a ff(De\014nition:)33 b fl(The) 21 b(i'th)g(mem)o(b)q(er)g(v)m(ariable)h(of)f(equiv)m(alen)o(t)h(ob)s(jects)e (are)h(equiv)m(alen)o(t)i(except)e(for)f(the)37 98 y(v)m(ariable)j(b)q(eing)f (mo)o(v)o(ed)f(from)f(an)h(aggregate)f(to)g(a)h(comp)q(onen)o(t.)37 b(In)22 b (this)g(case,)g(the)f(v)m(ariable)h(in)g(the)37 154 y(aggregate)14 b(in)i(the) f(\014rst)g(trace)g(is)h(equiv)m(alen)o(t)h(to)d(the)i(v)m(ariable)g(in)g(the) f(comp)q(onen)o(t)h(in)g(the)f(second.)108 211 y ff(Theo)o(rem:)k fl(T)l(race\ s)d(b)q(efore)h(and)g(after)e(the)i(refactoring)f(of)g(mo)o(ving)g(a)g(v)m (ariable)i(from)d(a)i(con)o(tainer)f(to)37 267 y(a)f(comp)q(onen)o(t)h(are)f (equiv)m(alen)o(t.)108 324 y ff(Pro)q(of:)20 b fl(By)c(induction.)22 b(Base) 16 b(case)g(is)g(the)f(empt)o(y)h(trace.)k(Induction)d(step)f(is)g(to)f(consi\ der)h(a)g(trace)f(of)37 380 y(n)i(steps.)23 b(By)16 b(the)g(lemma,)h(after)e (the)h(instruction)i(corresp)q(onding)f(to)e(the)i(n'th)f(instruction)h(of)f (the)g(\014rst)37 437 y(trace,)e(equiv)m(alen)o(t)i(lo)q(cations)f(con)o(tain) f(equiv)m(alen)o(t)i(v)m(alues.)21 b(Due)14 b(to)f(the)i(lev)o(el)g(of)f(indi\ rection)i(in)o(tro)q(duced)37 493 y(b)o(y)d(mo)o(ving)g(a)g(v)m(ariable)h(to) e(the)h(comp)q(onen)o(t,)g(a)g(single)h(instruction)g(in)f(the)g(old)h(trace) e(ma)o(y)g(map)h(to)f(sev)o(eral)37 550 y(instructions)18 b(in)g(the)f(new)g (trace,)f(so)h(the)g(trace)f(of)h(n)g(steps)f(in)i(the)f(old)g(trace)g(corres\ p)q(onds)g(to)f(m)h(\()p fj(\025)g fl(n\))37 606 y(steps)f(in)g(the)f(new)g (trace.)20 b(The)15 b(n'th)g(step)g(migh)o(t)g(b)q(e)h(a)f(read,)g(write,)g (or)g(a)f(function)j(call.)108 663 y(If)h(the)f(step)g(do)q(es)h(not)f(refere\ nce)h(the)f(v)m(ariable)i(b)q(eing)g(mo)o(v)o(ed,)e(then)g(in)i(the)e(new)h (trace)e(it)i(maps)f(to)37 719 y(the)d(same)f(instruction)i(applied)g(to)e (an)g(equiv)m(alen)o(t)i(lo)q(cation)f(in)h(the)e(old)h(trace.)19 b(If)14 b (it)f(is)h(a)f(read)h(op)q(eration,)37 775 y(then)j(b)o(y)g(the)f(induction)i (assumption)f(the)f(lo)q(cation)h(in)h(the)e(old)h(trace)f(will)i(con)o(tain) f(the)f(same)g(v)m(alue)i(as)37 832 y(the)i(equiv)m(alen)o(t)i(lo)q(cation)e (in)h(the)f(new)g(trace,)g(therefore)f(the)h(reads)g(are)f(equiv)m(alen)o(t.) 36 b(If)20 b(it)g(is)g(a)f(write)37 888 y(op)q(eration,)c(since)g(the)f(lo)q (cation)h(in)g(the)f(old)h(trace)f(is)h(equiv)m(alen)o(t)g(to)f(the)g(lo)q (cation)h(in)g(the)f(new)h(trace,)e(and)37 945 y(the)i(v)m(alues)h(written)e (are)g(the)g(same,)g(the)h(writes)f(are)g(equiv)m(alen)o(t.)22 b(If)14 b(it)h (is)g(a)f(function)h(call,)g(an)g(equiv)m(alen)o(t)37 1001 y(function)j(is)g (called)h(in)f(eac)o(h)f(case,)g(and)h(the)f(v)m(alues)h(passed)g(in)g(the)f (call)h(will)h(b)q(e)f(equiv)m(alen)o(t;)h(therefore,)37 1058 y(the)d(functio\ n)g(calls)g(are)f(equiv)m(alen)o(t.)22 b(Therefore,)14 b(the)i(traces)e(are)h (equiv)m(alen)o(t)i(after)d(the)i(n+1'st)e(step.)108 1114 y(If)21 b(the)f(ste\ p)g(do)q(es)g(reference)h(the)g(v)m(ariable)g(b)q(eing)h(mo)o(v)o(ed,)e(in)h (the)f(new)h(trace)f(there)g(is)h(a)e(lev)o(el)j(of)37 1171 y(indirection)e (that)d(will)i(result)f(in)g(a)f(set)g(of)g(steps)g(in)h(the)g(new)f(trace)g (corresp)q(onding)i(to)d(the)i(single)g(step)37 1227 y(in)f(the)e(old)h(trace\ .)k(Ho)o(w)o(ev)o(er,)14 b(after)g(the)i(indirection)h(the)f(address)f(read)g (from,)f(written)i(to,)e(or)h(branc)o(hed)37 1284 y(to)i(in)g(the)g(new)g(tra\ ce)f(will)i(b)q(e)f(equiv)m(alen)o(t)i(to)d(the)h(address)f(in)i(the)e(old)i (trace,)e(and)h(the)f(op)q(erations)h(and)37 1340 y(v)m(alues)g(are)e(equiv)m (alen)o(t,)h(therefore)f(the)g(traces)g(are)g(equiv)m(alen)o(t)i(after)d(the) i(n+1'st)e(step.)37 1462 y fe(8.5.4)56 b(Beha)n(vior)18 b(Preserv)m(ation:)23 b(Step)18 b(7)37 1548 y fl(F)l(or)11 b(delete)s 14 2 v 15 w(mem)o(b)q(er)s 14 2 v 13 w(functions)i(\(step)e(7\):)17 b(precondition)c(1)e(\(the)g(function)h (to)f(b)q(e)h(deleted)h(is)f(unreferenced)37 1604 y(or)j(redundan)o(t\))g(is) h(satis\014ed)g(b)q(ecause,)g(as)e(a)h(result)h(of)f(the)g(prior)g(step,)g (the)h(function)g(is)f(redundan)o(t.)108 1660 y(F)l(or)g(delete)s 14 2 v 15 w (unreferenced)s 14 2 v 15 w(v)m(ariable)i(\(step)e(7\):)21 b(precondition)c (1)f(\(the)f(v)m(ariable)i(b)q(eing)g(deleted)h(is)e(un-)37 1717 y(referenced\ \))g(is)g(satis\014ed)g(b)q(ecause,)g(as)e(a)h(result)h(of)f(the)g(prior)g (step,)g(the)g(v)m(ariable)i(is)f(unreferenced.)37 1839 y fe(8.5.5)56 b(Beha) n(vior)18 b(Preserv)m(ation:)23 b(Summary)37 1924 y fl(Eac)o(h)17 b(of)e(the) i(steps)f(\(1-7\))f(of)h(this)h(refactoring)f(are)g(b)q(eha)o(vior)h(preservi\ ng,)g(therefore)f(the)g(refactoring)g(is)37 1981 y(b)o(y)g(construction)f(b)q (eha)o(vior)h(preserving.)37 2124 y fd(8.6)70 b(Mo)n(ving)31 b(Mem)n(b)r(ers) e(in)n(to)g(a)h(Comp)r(onen)n(t)g(\(Aggregate)g(P)n(assed)194 2199 y(as)24 b (F)-6 b(unction)22 b(Argumen)n(t\))37 2300 y fl(This)c(and)f(the)f(prior)h (section)g(de\014ne)h(refactorings)e(for)g(mo)o(ving)h(a)f(set)h(of)f(mem)o (b)q(ers)h(from)e(an)i(aggregate)37 2357 y(class)22 b(to)e(the)h(class)h(of)e (one)i(of)e(its)h(comp)q(onen)o(ts.)38 b(This)21 b(section)h(describ)q(es)h (a)d(refactoring)h(where)g(the)37 2413 y(aggregate)f(ob)s(ject)h(is)h(passed) f(as)g(an)g(argumen)o(t)g(in)h(calls)g(to)f(all)h(functions)g(that)e(referenc\ e)i(mem)o(b)q(ers)37 2470 y(remaining)17 b(in)f(the)f(aggregate)f(class.)37 2576 y(The)i(argumen)o(ts)e(to)h(this)g(refactoring)g(are:)952 2760 y(97)g eop bop 106 42 a fj(\017)22 b fl(the)15 b(aggregate)f(class)i(\(C\))106 135 y fj (\017)22 b fl(the)15 b(set)g(of)g(mem)o(b)q(er)h(v)m(ariables)g(b)q(eing)h (mo)o(v)o(ed)d(\(setOfMo)o(vingV)l(ars\))106 229 y fj(\017)22 b fl(the)15 b (set)g(of)g(mem)o(b)q(er)h(functions)f(b)q(eing)i(mo)o(v)o(ed)e(\(setOfMo)o (vingF)l(uncs\))106 323 y fj(\017)22 b fl(the)15 b(comp)q(onen)o(t)h(mem)o (b)q(er)f(v)m(ariable)i(\(V\))108 429 y(F)l(or)12 b(eac)o(h)g(mem)o(b)q(er)h (in)g(\(setOfMo)o(vingV)l(ars)f fj([)g fl(setOfMo)o(vingF)l(uncs\),)h(a)f(new) h(name)f(ma)o(y)g(b)q(e)h(sp)q(eci\014ed.)37 486 y(This)18 b(is)g(needed)g (to)f(a)o(v)o(oid)f(naming)i(con\015icts)g(that)e(could)i(arise)g(when)f(the) g(aggregate)f(and)h(comp)q(onen)o(t)37 542 y(classes)f(share)f(an)g(inheritan\ ce)i(relationship.)108 599 y(In)d(this)h(description,)g(the)f(class)g(of)f (the)h(comp)q(onen)o(t)g(mem)o(b)q(er)g(v)m(ariable)h(\(ie)f(V.t)o(yp)q(e\))g (is)g(referred)g(to)f(as)37 655 y(comp)q(onen)o(tClass.)37 761 y(After)i(c)o (hec)o(king)h(the)g(preconditions,)g(this)g(refactoring:)93 868 y(1.)22 b(for) 15 b(eac)o(h)h(v)m(ariable)h(in)g(setOfMo)o(vingV)l(ars,)e(calls)i(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)g(to)e(add)h(an)g(equiv)m(ale\ n)o(t)151 924 y(\(p)q(ossibly)h(renamed\))e(v)m(ariable)h(as)f(a)g(public)i (mem)o(b)q(er)f(of)e(comp)q(onen)o(tClass.)93 1018 y(2.)22 b(Let)e fi(F)m(unc\ tionsR)n(eferringBackT)m(oA)n(ggr)m(e)n(gate)d fl(b)q(e)j(the)g(subset)g(of)g (functions)g(con)o(tained)h(in)f(setOf-)151 1074 y(Mo)o(vingF)l(uncs)f(that)e (refer)h(to)g(v)m(ariables)h(and)g(functions)g(visible)h(from)e(C)g(but)g(not) g(from)f(comp)q(o-)151 1131 y(nen)o(tClass.)151 1206 y(F)l(or)e(eac)o(h)h(fun\ ction)g(in)h(setOfMo)o(vingF)l(uncs,)e(this)h(refactoring)f(calls)i(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(function)f(to)151 1262 y(add)k(the)f (signature)g(of)g(an)g(equiv)m(alen)o(t)i(\(p)q(ossibly)g(renamed\))e(functio\ n)h(as)f(a)g(public)i(mem)o(b)q(er)f(of)151 1319 y(comp)q(onen)o(tClass.)39 b (\(F)l(or)20 b(functions)j(in)f fi(F)m(unctionsR)n(eferringBackT)m(oA)n(gg)o (r)n(e)n(gate)p fl(,)e(an)h(additional)151 1375 y(argumen)o(t)15 b(is)g(inclu\ ded,)j(that)c(p)q(oin)o(ts)i(to)e(the)i(aggregate)d(ob)s(ject.\))151 1450 y (Then,)22 b(this)f(refactoring)g(calls)h(add)s 14 2 v 13 w(function)s 14 2 v 14 w(b)q(o)q(dy)g(to)e(add)h(the)g(function)g(b)q(o)q(dy)h(of)e(the)h(newly) 151 1507 y(created)14 b(mem)o(b)q(er)f(functions.)20 b(F)l(or)13 b(eac)o(h)h (function)g(in)g fi(F)m(unctionsR)n(eferringBackT)m(oA)n(ggr)m(e)n(gate)p fl (,)c(ref-)151 1563 y(erences)17 b(only)f(visible)j(through)c(the)h(aggregate) f(ob)s(ject)g(are)h(pre\014xed)h(with)f(the)g(name)h(of)e(the)h(new)151 1620 y (argumen)o(t)f(v)m(ariable)h(that)f(p)q(oin)o(ts)g(to)g(the)g(aggregate.)93 1714 y(3.)22 b(replaces)d(eac)o(h)f(reference)g(to)g(a)f(mem)o(b)q(er)h(in)h (\(setOfMo)o(vingV)l(ars)e fj([)h fl(setOfMo)o(vingF)l(uncs\))g(with)g(a)151 1770 y(reference)d(to)f(the)h(corresp)q(onding)g(mem)o(b)q(er)g(in)g(comp)q (onen)o(tClass.)20 b(Some)15 b(function)g(calls)g(will)i(pass)151 1826 y(a)e (p)q(oin)o(ter)h(to)e(the)i(aggregate)d(ob)s(ject)i(as)g(an)g(additional)h (argumen)o(t.)93 1920 y(4.)22 b(calls)i(delete)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 14 w(functions)f(and)g(delete)s 14 2 v 15 w(unreferenced)s 14 2 v 14 w (v)m(ariable)h(to)e(remo)o(v)o(e)g(the)h(unrefer-)151 1977 y(enced)16 b(mem)o (b)q(ers)g(from)e(C.)37 2098 y fe(8.6.1)56 b(Preconditions)37 2184 y fl(The) 16 b(preconditions)h(for)d(these)i(refactorings)e(are)h(the)g(same)g(as)g(pre\ conditions)i(1-3)e(of)f(the)i(prior)37 2241 y(refactoring.)37 2362 y fe(8.6.2) 56 b(Beha)n(vior)18 b(Preserv)m(ation)37 2448 y fl(F)l(or)j(create)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)i(\(step)e(1\):)32 b(precondition)24 b(1)d(\(the)g(new)h(v)m(ariable)h(do)q(esn't)e(collide)j(with)37 2505 y(anoth\ er)e(v)m(ariable)g(referenced)h(within)f(its)g(in)o(tended)h(scop)q(e\))f(is) g(satis\014ed)g(b)o(y)f(precondition)i(3)e(of)g(this)37 2561 y(refactoring.) 952 2760 y(98)g eop bop 108 42 a fl(F)l(or)16 b(create)s 14 2 v 13 w(mem)o (b)q(er)s 14 2 v 14 w(function)i(\(step)e(2\):)23 b(preconditions)18 b(1)f (through)f(4)g(\(regarding)h(collisions)i(with)37 98 y(mem)o(b)q(ers)14 b(de\ \014ned)i(in)e(sup)q(erclasses)h(or)f(sub)q(classes\))g(is)h(satis\014ed)f (b)o(y)g(precondition)h(3)f(of)f(this)h(refactoring;)37 154 y(precondition)h (5)f(\(all)g(referenced)g(v)m(ariables)h(and)e(functions)i(are)e(reac)o(hable\ \))h(is)g(satis\014ed)g(b)o(y)f(precondition)37 211 y(4)i(of)g(this)h(refacto\ ring.)108 267 y(F)l(or)c(add)s 14 2 v 13 w(function)s 14 2 v 14 w(b)q(o)q(dy) h(\(step)f(2\):)18 b(precondition)c(1)e(\(all)g(v)m(ariables)i(and)e(function\ s)h(referenced)g(in)g(the)37 324 y(function)j(b)q(o)q(dy)g(are)f(visible)i (from)d(the)h(sup)q(erclass\))h(is)g(satis\014ed)f(b)o(y)g(precondition)i(4)d (of)h(this)g(refactoring;)37 380 y(precondition)i(2)d(\(the)g(mem)o(b)q(er)h (function)g(is)g(unreferenced)h(lo)q(cally)g(in)g(the)e(sup)q(erclass)i(or)e (the)g(sup)q(erclass)37 437 y(is)i(abstract\))e(is)i(satis\014ed)f(b)o(y)h (precondition)g(3)f(of)g(this)h(refactoring.)108 493 y(The)d(k)o(ey)g(step)g (in)h(the)f(refactoring)f(is)i(step)f(3,)g(where)g(references)g(to)g(mem)o (b)q(ers)g(in)h(the)f(aggregate)e(class)37 550 y(are)j(replaced)h(b)o(y)f(ref\ erences)g(to)f(mem)o(b)q(ers)h(in)h(the)e(comp)q(onen)o(t.)20 b(Beha)o(vior) 14 b(is)g(preserv)o(ed)g(in)h(section)f(8.5.3)37 606 y(for)h(step)g(5)g(of)g (the)g(prior)h(refactoring.)108 663 y(F)l(or)d(delete)s 14 2 v 15 w(mem)o(b)q (er)s 14 2 v 13 w(functions)i(\(step)e(4\):)18 b(precondition)d(1)f(\(the)f (function)i(to)e(b)q(e)h(deleted)h(is)f(unrefer-)37 719 y(enced)h(or)d(redund\ an)o(t\))h(is)h(satis\014ed)g(b)q(ecause,)g(as)e(a)h(result)h(of)e(the)h(prio\ r)h(step,)f(the)g(function)h(is)f(redundan)o(t.)108 775 y(F)l(or)i(delete)s 14 2 v 15 w(unreferenced)s 14 2 v 15 w(v)m(ariable)i(\(step)e(4\):)21 b(precondi\ tion)c(1)f(\(the)f(v)m(ariable)i(b)q(eing)g(deleted)h(is)e(un-)37 832 y(refer\ enced\))g(is)g(satis\014ed)g(b)q(ecause,)g(as)e(a)h(result)h(of)f(the)g(prior) g(step,)g(the)g(v)m(ariable)i(is)f(unreferenced.)108 888 y(Eac)o(h)e(of)f(the) h(steps)g(of)f(this)i(refactoring)e(are)h(preserving,)g(therefore)g(the)g(ref\ actoring)f(is)i(b)o(y)e(construc-)37 945 y(tion)j(b)q(eha)o(vior)g(preserving\ .)37 1088 y fd(8.7)70 b(Mo)n(ving)24 b(Mem)n(b)r(ers)e(in)n(to)g(Aggregate\(s\ \))37 1226 y fl(This)16 b(refactoring)f(adds)h(mem)o(b)q(ers)f(to)g(an)g(aggr\ egate)f(class,)i(to)e(replace)j(mem)o(b)q(ers)e(in)h(one)g(of)f(its)g(comp)q (o-)37 1283 y(nen)o(ts.)37 1423 y(The)h(argumen)o(ts)e(to)h(this)g(refactorin\ g)g(are:)106 1563 y fj(\017)22 b fl(the)15 b(aggregate)f(class)i(\(C\))106 1656 y fj(\017)22 b fl(the)15 b(comp)q(onen)o(t)h(mem)o(b)q(er)f(v)m(ariable) i(\(V\))106 1749 y fj(\017)22 b fl(the)16 b(set)f(of)f(mem)o(b)q(er)i(v)m(ari\ ables)g(in)h(comp)q(onen)o(tClass)e(\(V.t)o(yp)q(e\))f(b)q(eing)j(replaced)f (in)h(the)e(aggregate)151 1805 y(class)h(\(setOfV)l(ars\))106 1898 y fj(\017) 22 b fl(the)f(set)g(of)g(mem)o(b)q(er)g(functions)h(in)g(comp)q(onen)o(tClass) f(b)q(eing)i(replaced)f(in)g(the)f(aggregate)f(class)151 1955 y(\(setOfF)l (uncs\))37 2095 y(After)15 b(c)o(hec)o(king)h(its)g(preconditions,)g(this)g (refactoring:)93 2235 y(1.)22 b(for)11 b(eac)o(h)h(v)m(ariable)h(in)f(setOfV) l(ars,)g(calls)h(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable) g(to)e(add)g(an)h(equiv)m(alen)o(t)h(\(p)q(ossibly)151 2291 y(renamed\))i(v)m (ariable)i(as)e(a)g(public)i(mem)o(b)q(er)e(of)g(comp)q(onen)o(tClass.)93 2384 y(2.)22 b(for)e(eac)o(h)i(function)f(in)h(setOfF)l(uncs,)h(calls)f(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(function)g(to)f(add)g(the)g(signature)g (of)151 2441 y(the)16 b(\(p)q(ossibly)i(renamed\))e(function)g(as)g(a)g(publi\ c)i(mem)o(b)q(er)e(of)g(comp)q(onen)o(tClass.)23 b(Then,)16 b(for)f(eac)o(h) 151 2497 y(function)k(in)g(setOfMo)o(vingMem)o(b)q(ers,)g(calls)g(add)s 14 2 v 14 w(function)s 14 2 v 14 w(b)q(o)q(dy)g(to)f(add)g(the)h(function)g(b)q(o)q (dy)g(of)151 2554 y(eac)o(h)e(function)h(b)q(eing)h(mo)o(v)o(ed.)25 b(Referen\ ces)19 b(to)d(mem)o(b)q(ers)h(that)g(remain)g(in)h(comp)q(onen)o(tClass)g(are) 151 2610 y(pre\014xed)e(with)g(V.)952 2760 y(99)g eop bop 93 42 a fl(3.)22 b (for)14 b(instances)h(of)f(C,)f(replaces)j(eac)o(h)e(reference)h fi(to)g fl (a)f(mem)o(b)q(er)g(in)h(\(setOfV)l(ars)f fj([)h fl(setOfF)l(uncs\))f(with) 151 98 y(a)h(reference)h(to)e(its)i(replacing)g(mem)o(b)q(er)g(in)g(C.)93 192 y(4.)22 b(for)15 b(eac)o(h)g(mem)o(b)q(er)g(of)g(\(setOfV)l(ars)g fj([)g fl (setOfF)l(uncs\))h(that)e(is)i(no)o(w)f(unreferenced,)1576 175 y fs(7)1612 192 y fl(calls)151 248 y(delete)s 14 2 v 15 w(mem)o(b)q(er)s 14 2 v 13 w(function\ s)h(or)f(delete)s 14 2 v 14 w(unreferenced)s 14 2 v 15 w(v)m(ariable)i(to)d (remo)o(v)o(e)h(it.)37 407 y fe(8.7.1)56 b(Preconditions)37 531 y fl(The)16 b (preconditions)h(for)d(this)i(refactoring)f(are:)93 675 y(1.)22 b(quali\014es\ AsComp)q(onen)o(tP\(V\))151 731 y(\(V)15 b(quali\014es)i(as)e(a)g(comp)q(onen) o(t)g(mem)o(b)q(er)g(v)m(ariable)i(of)e(C.\))1181 714 y fs(8)93 825 y fl(2.) 22 b fj(8)16 b fl(F)e fj(2)i fl(setOfF)l(uncs,)226 881 y fj(8)g fl(referenced\ Mem)o(b)q(er)g fj(2)f fl(\(v)m(ariablesReferencedBy\(F\))i fj([)301 938 y fl (functionsCalledBy\(F\)\),)376 994 y(if)f(referencedMem)o(b)q(er)g fj(2)f fl (mem)o(b)q(ersOf\(comp)q(onen)o(tClass\))h fj(^)451 1051 y fl(referencedMem)o (b)q(er)g fj(62)g fl(\(setOfV)l(ars)e fj([)i fl(setOfF)l(uncs\),)526 1107 y (referencedMem)o(b)q(er.accessCon)o(trolMo)q(de)g(=)f(public.)151 1164 y(\(if) c(an)o(y)g(of)g(the)g(functions)h(b)q(eing)h(added)f(to)e(C)h(reference)h(mem) o(b)q(ers)f(remaining)i(in)f(comp)q(onen)o(tClass,)151 1220 y(those)j(referen\ ced)h(mem)o(b)q(ers)g(are)e(public\).)93 1314 y(3.)22 b(for)14 b(all)i(instan\ ces)f(of)f(comp)q(onen)o(tClass)h(assigned)g(to)f(an)h(instance)g(of)g(C,)f (all)h(references)h(to)e(\(setOf-)151 1370 y(V)l(ars)f fj([)h fl(setOfF)l(unc\ s\))f(are)g(made)h(via)f(V.)g(Program)f(\015o)o(w)h(analysis)h(w)o(ould)g(b)q (e)g(needed)h(to)d(determine)151 1427 y(this.)37 1586 y fe(8.7.2)56 b(Beha)n (vior)18 b(Preserv)m(ation)37 1709 y fl(F)l(or)j(create)s 14 2 v 14 w(mem)o (b)q(er)s 14 2 v 13 w(v)m(ariable)i(\(step)e(1\):)32 b(precondition)24 b(1)d (\(the)g(new)h(v)m(ariable)h(do)q(esn't)e(collide)j(with)37 1766 y(another)17 b(v)m(ariable)h(referenced)g(within)g(its)f(in)o(tended)h(scop)q(e\))f(is)g (satis\014ed)g(b)q(ecause)h(it)f(is)g(giv)o(en)g(a)g(unique)37 1822 y(name)f (in)g(cases)f(where)g(a)g(name)g(con\015ict)i(w)o(ould)e(o)q(ccur.)108 1916 y (F)l(or)h(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(function)i(\(step)e (2\):)23 b(preconditions)18 b(1)f(through)f(4)g(\(regarding)h(collisions)i (with)37 1973 y(mem)o(b)q(ers)c(de\014ned)h(in)f(sup)q(erclasses)h(or)e(sub)q (classes\))h(is)g(satis\014ed)h(b)q(ecause)f(it)g(is)g(giv)o(en)g(a)f(unique) i(name)f(in)37 2029 y(cases)j(where)g(a)f(name)h(con\015ict)g(w)o(ould)h(o)q (ccur;)f(precondition)i(5)d(is)h(trivially)h(satis\014ed)g(b)q(ecause)f(there) g(is)37 2085 y(no)e(function)g(b)q(o)q(dy)l(.)108 2179 y(F)l(or)c(add)s 14 2 v 13 w(function)s 14 2 v 14 w(b)q(o)q(dy)h(\(step)f(2\):)18 b(precondition)c (1)e(\(all)g(v)m(ariables)i(and)e(functions)h(referenced)g(in)g(the)37 2236 y (function)j(b)q(o)q(dy)g(are)f(visible)i(from)d(the)h(sup)q(erclass\))h(is)g (satis\014ed)f(b)o(y)g(precondition)i(2)d(of)h(this)g(refactoring;)37 2319 y 750 2 v 89 2346 a fu(7)107 2362 y fp(Instances)e(of)g(comp)q(onen)o(tClass)i (migh)o(t)e(b)q(e)g(assigned)i(to)e(v)n(ariables)i(other)e(than)g(V.)f(The)h (mem)o(b)q(ers)g(can)g(not)g(b)q(e)g(deleted)37 2408 y(unless)i(they)e(are)h (not)f(referenced)g(for)g(all)h(instances)h(of)e(comp)q(onen)o(tClass.)89 2438 y fu(8)107 2454 y fp(The)18 b(requiremen)o(t)h(here)g(is)g(that)f(the)g(ob)r (ject)h(assigned)h(to)e(V)g(in)h(one)g(instance)g(of)f(C)g(is)h(not)f(aliased) i(as)f(the)f(v)n(alue)37 2499 y(assigned)g(to)e(V)f(in)i(another)f(instance)i (of)d(C.)g(This)h(condition)j(is)d(implied)i(if)e(V)f(quali\014es)k(as)c(a)h (comp)q(onen)o(t)h(v)n(ariable.)27 b(F)m(or)37 2545 y(further)14 b(discussion\ s,)h(see)e(section)i(8.8.)941 2760 y fl(100)g eop bop 37 42 a fl(precondition) 21 b(2)d(\(the)g(mem)o(b)q(er)h(function)g(is)h(not)e(called\))i(is)f(satis\ \014ed)g(b)q(ecause)g(the)g(function)h(is)f(newly)37 98 y(added)d(to)f(the)g (comp)q(onen)o(t)h(and)f(is)h(not)e(y)o(et)h(referenced.)108 192 y(The)h(k)o (ey)g(step)f(in)i(the)f(refactoring)f(is)h(step)g(3,)f(where)h(references)g (to)f(mem)o(b)q(ers)h(in)h(a)e(comp)q(onen)o(t)h(are)37 248 y(replaced)h(b)o (y)f(references)h(to)e(mem)o(b)q(ers)h(in)g(the)g(aggregate)e(class.)22 b(The\ re)16 b(are)f(sev)o(eral)h(things)h(that)e(migh)o(t)37 305 y(happ)q(en)i(that) d(could)j(prev)o(en)o(t)e(this)g(from)g(b)q(eing)h(done)g(safely:)108 399 y (Eac)o(h)e(new)f(mem)o(b)q(er)h(migh)o(t)g(not)f(b)q(e)h(visible)i(in)f(all)f (places)h(where)f(the)f(old)i(mem)o(b)q(er)e(\(it)h(replaces\))g(w)o(as)37 455 y(visible.)29 b(Ho)o(w)o(ev)o(er,)16 b(b)o(y)h(precondition)i(3)e(all)h(refer\ ences)g(to)f(the)g(old)h(mem)o(b)q(ers)f(are)g(made)g(via)h(V,)f(whic)o(h)37 512 y(implies)f(that)e(all)g(references)h(m)o(ust)e(either)i(b)q(e)f(from)f (within)i(the)f(aggregate)e(ob)s(ject)i(or)f(via)h(the)g(aggregate)37 568 y (ob)s(ject.)19 b(By)14 b(steps)g(one)g(and)h(t)o(w)o(o,)d(the)i(new)g(mem)o (b)q(ers)g(are)g(public)i(mem)o(b)q(ers)e(of)g(the)g(aggregate)e(class)i(and) 37 625 y(hence)j(are)e(visible)i(in)f(all)g(places)g(where)g(the)f(old)h(mem) o(b)q(ers)f(w)o(ere)g(referenced.)108 719 y(One)f(or)f(more)h(of)f(the)g(func\ tions)i(b)q(eing)f(mo)o(v)o(ed)g(migh)o(t)f(mak)o(e)g(references)h(to)f(v)m (ariables)i(and)f(functions)37 775 y(that)22 b(are)g(visible)i(from)e(the)g (comp)q(onen)o(t)g(class)h(but)f(not)g(from)f(the)h(aggregate)f(class.)41 b (Ho)o(w)o(ev)o(er,)23 b(b)o(y)37 831 y(precondition)17 b(2)e(suc)o(h)h(refere\ nces)f(will)i(b)q(e)f(visible.)108 925 y(The)d(t)o(yp)q(e)g(of)f(the)h(new)g (mem)o(b)q(er)g(migh)o(t)g(b)q(e)g(di\013eren)o(t)g(from)f(the)h(t)o(yp)q(e)g (of)f(the)h(old)g(mem)o(b)q(er,)g(and)g(hence)37 982 y(not)j(supp)q(ort)g(the) h(same)e(op)q(erations.)23 b(This)17 b(will)h(not)d(happ)q(en)i(\(b)o(y)f(con\ struction\))g(since)i(in)e(steps)g(1)g(and)37 1038 y(2)f(the)h(new)f(mem)o (b)q(ers)g(ha)o(v)o(e)g(the)g(same)g(t)o(yp)q(es)h(as)e(the)i(mem)o(b)q(ers)f (they)g(are)g(replacing.)108 1132 y(If)h(t)o(w)o(o)e(di\013eren)o(t)h(aggrega\ te)f(ob)s(jects)h(\(b)q(oth)g(of)g(class)h(C\))e(assigned)i(the)g(same)f(comp) q(onen)o(t)g(ob)s(ject)g(to)37 1189 y(their)g(mem)o(b)q(er)e(v)m(ariable)i (V,)e(then)h(with)g(this)g(refactoring)f(some)h(mem)o(b)q(ers)f(that)g(previo\ usly)i(w)o(ere)e(shared)37 1245 y(b)q(et)o(w)o(een)h(the)f(t)o(w)o(o)f(aggreg\ ate)f(ob)s(jects)i(w)o(ould)g(no)g(longer)h(b)q(e)f(shared.)20 b(Ho)o(w)o(ev) o(er,)12 b(b)o(y)h(precondition)i(1)d(eac)o(h)37 1302 y(comp)q(onen)o(t)k(ob) s(ject)e(is)i(exclusiv)o(e)h(to)e(one)g(aggregate)f(ob)s(ject,)g(so)h(this)g (will)i(not)e(happ)q(en.)108 1396 y(A)o(t)f(this)h(p)q(oin)o(t,)g(it)f(has)h (b)q(een)g(argued)f(that)g(v)m(ariables)i(and)f(functions)g(will)h(b)q(e)f (visible)i(to)c(their)i(callers)37 1452 y(b)q(efore)20 b(and)f(after)f(the)h (mo)o(v)o(e,)g(that)f(the)h(t)o(yp)q(es)g(of)f(mem)o(b)q(ers)i(will)g(b)q(e)g (the)f(same,)g(and)g(that)f(there)h(is)h(a)37 1509 y(one-for-one)c(mapping)g (of)e(the)i(old)f(mem)o(b)q(ers)h(to)e(the)i(new)f(mem)o(b)q(ers)g(that)g(are) g(replacing)h(them.)108 1602 y(As)11 b(argued)g(in)h(section)f(8.5.3,)f(the)h (program)f(traces)g(b)q(efore)i(and)f(after)f(the)h(refactoring)f(are)h(equiv) m(alen)o(t.)37 1659 y(References)18 b fi(by)e fl(the)h(mem)o(b)q(ers)f(added) h(to)f(the)g(aggregate,)f fi(to)h fl(mem)o(b)q(ers)h(of)f(comp)q(onen)o(tClas\ s)g(not)g(b)q(eing)37 1715 y(mo)o(v)o(ed,)g(will)i(include)g(an)e(extra)f(lev) o(el)j(of)d(indirection)j(\(ie)f(V\).)e(Con)o(v)o(ersely)l(,)h(references)h fi (to)f fl(the)g(mem)o(b)q(ers)37 1772 y(added)g(to)e(the)h(aggregate)e(\(other) h(than)g(those)h(made)f fi(by)h fl(the)g(mem)o(b)q(ers)f(b)q(eing)i(mo)o(v)o (ed\))e(will)j(ha)o(v)o(e)d(a)g(lev)o(el)37 1828 y(of)f(indirection)j(remo)o (v)o(ed.)j(These)14 b(replacing)g(references)g(will)h(b)q(e)f(equiv)m(alen)o (t)h(to)e(the)h(replaced)g(references,)37 1885 y(and)20 b(other)f(steps)g(wil\ l)i(b)q(e)f(the)f(same,)h(so)f(the)g(program)f(traces)h(are)g(equiv)m(alen)o (t)i(b)q(efore)e(and)h(after)e(the)37 1941 y(refactoring.)108 2035 y(In)d(ste\ p)g(4,)f(the)h(precondition)i(for)d(delete)s 14 2 v 14 w(mem)o(b)q(er)s 14 2 v 14 w(functions)h(and)g(delete)s 14 2 v 15 w(unreferenced)s 14 2 v 15 w(v)m (ariable)h(is)37 2092 y(satis\014ed)e(b)q(ecause)f(these)g(refactorings)f(are) g(only)h(applied)h(if)f(the)g(v)m(ariable)h(\(or)d(function\))i(is)g(unrefere\ nced.)108 2186 y(Eac)o(h)h(of)g(the)h(steps)f(\(1-4\))g(of)g(this)h(refactori\ ng)f(are)g(b)q(eha)o(vior)h(preserving,)g(therefore)f(the)h(refactoring)37 2242 y(is)h(b)o(y)f(construction)h(b)q(eha)o(vior)g(preserving.)941 2760 y (101)g eop bop 37 45 a fd(8.8)70 b(Discussion:)29 b(Comp)r(onen)n(ts)23 b(and) h(Refactoring)e(\(Revisite)o(d\))37 184 y fl(The)c(refactorings)e(in)i(sectio\ ns)g(8.5)e(through)h(8.7)f(ha)o(v)o(e)g(as)h(a)g(precondition)h(that)f(the)g (mem)o(b)q(er)g(v)m(ariable)37 240 y(in)o(to)12 b(\(or)f(out)h(of)t(\))e(whic) o(h)j(mem)o(b)q(ers)f(are)g(mo)o(v)o(ed)f(m)o(ust)g(b)q(e)i(an)f fi(exclusive) g(c)n(omp)n(onent)p fl(,)f(as)h(de\014ned)h(in)g(section)37 297 y(8.2.)24 b (As)17 b(noted)g(in)h(a)e(fo)q(otnote)g(for)g(eac)o(h)h(of)g(these)g(refactor\ ings,)f(a)h(less)g(stringen)o(t)g(precondition)h(w)o(ould)37 353 y(b)q(e)j (su\016cien)o(t:)29 b(that)19 b(the)h(instance)g(assigned)h(to)e(the)g(mem)o (b)q(er)h(v)m(ariable)h(in)g(one)f(aggregate)e(ob)s(ject)h(b)q(e)37 410 y(dis\ tinct)g(from)e(the)g(instance)i(assigned)f(to)f(the)g(same)g(mem)o(b)q(er)h (v)m(ariable)h(of)e(another)g(aggregate)f(ob)s(ject)37 466 y(of)g(the)f(same) h(t)o(yp)q(e.)21 b(This)16 b(condition)h(is)f(implied)i(if)e(the)f(mem)o(b)q (er)h(v)m(ariable)h(is)f(an)f(exclusiv)o(e)j(comp)q(onen)o(t,)37 523 y(but)e (is)g(nonetheless)g(a)f(less)h(stringen)o(t)f(precondition.)108 616 y(This)22 b(raises)g(a)f(question:)33 b(is)22 b(the)f(precondition)i(regarding)e(exclus\ iv)o(e)j(comp)q(onen)o(ts)d(p)q(erhaps)h(to)q(o)37 673 y(restrictiv)o(e)16 b (for)f(refactorings)f(in)o(v)o(olving)j(aggregates)c(and)j(comp)q(onen)o(ts?) 108 767 y(Not)10 b(in)h(general.)19 b(More)10 b(p)q(o)o(w)o(erful)g(refactori\ ngs)g(could)i(b)q(e)f(written)f(in)o(v)o(olving)i(aggregates)d(and)h(comp)q (o-)37 823 y(nen)o(ts)15 b(w)o(ould)f(require)h(other)e(conditions)j(implied) g(b)o(y)e(exclusiv)o(e)i(comp)q(onen)o(ts.)j(Here)c(are)e(t)o(w)o(o)g(example\ s:)93 955 y(1.)22 b(F)l(or)14 b(cases)g(where)g(an)h(aggregate)d(ob)s(ject)i (con)o(tained)h(sev)o(eral)f(comp)q(onen)o(ts)g(that)g(w)o(ere)g(instances)h (of)151 1011 y(the)h(same)f(comp)q(onen)o(t)h(class,)g(a)g(refactoring)f(coul\ d)i(b)q(e)f(de\014ned)h(that)e(replaced)i(sev)o(eral)f(mem)o(b)q(ers)151 1068 y(in)g(the)f(aggregate)f(class)i(with)f(a)g(single)i(mem)o(b)q(er)e(added)h (to)e(the)i(comp)q(onen)o(t)f(class.)151 1143 y(F)l(or)21 b(example,)i(supp)q (ose)g(the)e ff(Automobile)f fl(class)i(con)o(tains)f(the)h(comp)q(onen)o(t)f (mem)o(b)q(er)h(v)m(ariables)151 1199 y fi(leftF)m(r)n(ontTir)n(e)p fl(,)15 b fi(rightF)m(r)n(ontTir)n(e)p fl(,)g fi(leftR)n(e)n(arTir)n(e)h fl(and)h fi (rightR)n(e)n(arTir)n(e)p fl(,)g(all)h(of)e(whic)o(h)i(w)o(ere)f(assigned)151 1256 y(instances)k(of)g(the)f ff(Tire)g fl(class.)37 b(The)20 b ff(Automobile) f fl(class)i(also)g(con)o(tains)f(four)g(mem)o(b)q(er)h(v)m(ariables)151 1312 y(that)c(record,)i(resp)q(ectiv)o(ely)l(,)h(the)e(w)o(arran)o(t)o(y)e(expirat\ ion)i(for)g(eac)o(h)g(of)f(the)h(tires.)29 b(The)18 b(refactoring)151 1369 y (w)o(ould)g(add)g(a)f(single)i(mem)o(b)q(er)f(v)m(ariable)h fi(warr)n(antyExp\ ir)n(ation)f fl(to)f(the)h ff(Tire)f fl(class,)h(replacing)h(the)151 1425 y (four)13 b(mem)o(b)q(er)h(v)m(ariables)h(in)f(the)f ff(Automobile)f fl(class) i(that)e(record)i(tire)f(w)o(arran)o(t)o(y)f(expirations.)20 b(This)151 1481 y (requires,)13 b(ho)o(w)o(ev)o(er,)e(not)g(only)h(that)f(the)g(instance)h(assi\ gned)g(to)f(eac)o(h)h(comp)q(onen)o(t)f(mem)o(b)q(er)h(v)m(ariable)151 1538 y (\(sa)o(y)l(,)g fi(leftF)m(r)n(ontTir)n(e)p fl(\))d(in)k(one)f(car)g(b)q(e)g (distinct)i(from)d(instance)i(assigned)f(to)g(the)g(same)g(mem)o(b)q(er)g(v)m (ari-)151 1594 y(able)k(\()p fi(leftF)m(r)n(ontTir)n(e)p fl(\))d(in)j(another) f(car,)g(but)g(also)h(that)e(it)i(b)q(e)g(distinct)h(from)e(the)g(ob)s(jects) g(assigned)151 1651 y(to)g(other)g(comp)q(onen)o(t)g(mem)o(b)q(er)g(v)m(ariab\ les)i(represen)o(ting)f(tires.)93 1745 y(2.)22 b(In)c(cases)f(where)g(instanc\ es)h(of)f(the)g(same)g(class)g(are)g(comp)q(onen)o(ts)g(of)g(sev)o(eral)g(di\ \013eren)o(t)g(classes,)h(a)151 1801 y(refactoring)g(could)i(b)q(e)f(de\014ne\ d)h(that)d(mo)o(v)o(es)h(a)g(v)m(ariable)i(out)e(of)g(the)h(comp)q(onen)o(t)f (class)h(in)o(to)f(the)151 1858 y(class)e(of)e(eac)o(h)i(of)f(its)g(aggregate) f(classes.)151 1933 y(F)l(or)k(example,)j(while)f(the)f ff(Automobile)e fl (class)i(ma)o(y)f(hold)i(an)e(instance)i(of)f(the)f ff(Engine)i fl(class)f (as)g(a)151 1989 y(comp)q(onen)o(t,)k(the)f ff(T)l(ruck)g fl(class)f(ma)o(y)g (also)h(hold)g(another)f(instance)h(of)f(the)h ff(Engine)g fl(class)g(as)f (its)151 2046 y(comp)q(onen)o(t.)h(Mo)o(ving)15 b fi(milesPerGal)r(lon)f fl (out)i(of)f(the)h ff(Engine)g fl(class)g(means)g(adding)h(it)f(to)f(b)q(oth)g (the)151 2102 y ff(Automobile)e fl(and)j ff(T)l(ruck)g fl(classes.)151 2177 y (F)l(or)d(this)i(refactoring)e(to)g(b)q(e)h(b)q(eha)o(vior)h(preserving,)f (eac)o(h)g(instance)h(of)e(the)h(comp)q(onen)o(t)g(class)g(m)o(ust)151 2234 y (b)q(e)i(assigned)g(to)e(a)h(distinct)i(aggregate)c(ob)s(ject.)20 b(This)15 b (is)h(implied)i(if)d(the)h(comp)q(onen)o(t)f(is)h(exclusiv)o(e.)108 2365 y (In)j(summary)l(,)e(the)h(precondition)i(regarding)e(exclusiv)o(e)i(comp)q (onen)o(ts,)e(while)h(more)f(stringen)o(t)g(than)37 2421 y(is)e(necessary)g (for)f(the)h(refactorings)e(in)j(sections)f(8.5)e(through)h(8.7,)g(is)h(nonet\ heless)g(useful)h(for)e(these)g(and)37 2478 y(other)c(more)g(p)q(o)o(w)o(erfu\ l)h(refactorings)f(that)g(could)h(b)q(e)g(dev)o(elop)q(ed)h(regarding)e(aggre\ gates)f(and)i(comp)q(onen)o(ts.)941 2760 y(102)g eop bop 37 42 a fd(8.9)70 b (Con)n(v)n(erting)31 b(an)h(Asso)r(ciation,)g(Mo)r(deled)f(Using)g(Inheritanc\ e,)194 116 y(in)n(to)22 b(an)i(Aggregation)37 257 y fe(8.9.1)56 b(Motiv)m(ati\ on)37 380 y fl(Consider)14 b(the)f(inheritance)h(hierarc)o(h)o(y)f(sho)o(wn)g (in)g(Figure)g(8.1.)18 b(The)13 b(class)h ff(GraphicalObject)h fl(de\014ned)f (func-)37 437 y(tions)i(for)e(displa)o(ying)j(itself)f(and)g(determining)g (whether)f(a)g(particular)h(p)q(oin)o(t)g(\(lo)q(cation\))f(w)o(as)f(inside)j (the)37 493 y(ob)s(ject.)30 b(Sev)o(eral)20 b(sub)q(classes)g(w)o(ere)e(de\ \014ned,)j(the)e(most)f(recen)o(t)g(b)q(eing)i ff(ArchitecturalObject)q fl (.)33 b ff(Architec-)37 550 y(turalObject)17 b fl(needed)e(the)f(functions)h (pro)o(vided)g(b)o(y)f ff(GraphicalObject)i fl(and)e(w)o(as)g(initially)j(mad\ e)d(a)f(sub)q(class)37 606 y(of)i(it.)306 656 y 21115945 7959593 11577589 43810652 32693534 51770245 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Courier-Bold %%Pages: 1 %%BoundingBox: 176 666 497 787 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 1 -6 ] concat %I 158 461 158 461 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 312.217 980.952 ] concat %I [ (GraphicalObject:) ( displaySelf\(\);) ( containsPointP\(...\);) ( *) ( *) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 312.217 980.952 ] concat %I [ (GraphicalObject:) ( displaySelf\(\);) ( containsPointP\(...\);) ( *) ( *) () ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 18.4337 2.1687 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 203.024 855.494 ] concat %I [ (Circle) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 292.265 855.819 ] concat %I [ (Square) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 385.843 857.229 ] concat %I [ (Text) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 468.578 856.47 ] concat %I [ (ArchitecturalObject) () ] Text End End %I eop Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 306.867 ] concat %I 293 563 221 514 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 306.867 ] concat %I 327 563 307 516 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 306.867 ] concat %I 361 563 385 518 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 1.08434 306.867 ] concat %I 394 563 496 515 Line End End %I eop showpage %%Trailer end endTexFig 444 1288 a fh(Figure)i(8.1)p fl(:)j(Class)15 b ff(GraphicalObj\ ect)j fl(and)d(its)g(Sub)q(classes)108 1403 y(The)23 b(designer)g(then)g(real\ ized)h(that)e(an)g ff(ArchitecturalObject)k fl(ma)o(y)21 b(c)o(hange)i(its)f (shap)q(e,)j(based)e(on)37 1459 y(p)q(ersp)q(ectiv)o(e)12 b(or)e(a)g(new)h (arc)o(hitectural)g(insigh)o(t.)19 b(An)10 b ff(ArchitecturalObject)k fl(repr\ esen)o(ts)c(b)q(oth)h(an)f(abstraction)37 1516 y(and)16 b(its)f(implemen)o (tation;)h(its)g(shap)q(e)g(is)f(b)q(etter)g(represen)o(ted)h(as)f(a)g(comp)q (onen)o(t.)108 1610 y(Th)o(us,)g(a)g(more)f(desirable)j(represen)o(tation)e (w)o(ould)h(b)q(e)g(as)f(sho)o(wn)g(in)h(Figure)f(8.2.)237 1669 y 23286743 8025375 8880537 43942215 32167280 51967590 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Courier-Bold %%Pages: 1 %%BoundingBox: 135 668 489 790 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 1 -6 ] concat %I 158 461 158 461 Line End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 40.1205 2.16864 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 388.121 982.036 ] concat %I [ (GraphicalObject:) ( displaySelf\(\);) ( containsPointP\(...\);) ( *) ( *) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 359.169 857.663 ] concat %I [ (Circle) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 448.41 857.988 ] concat %I [ (Square) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 541.988 859.398 ] concat %I [ (Text) () ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 138.795 306.867 ] concat %I 273 564 221 514 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 138.795 306.867 ] concat %I 307 565 307 516 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 138.795 306.867 ] concat %I 339 565 385 518 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-courier-bold-r-*-120-* /Courier-Bold 12 SetF %I t [ 1 0 0 1 130.807 982.795 ] concat %I [ (ArchitecturalObject) ( GraphicalObject* shape;) ( *) ( *) () ] Text End End %I eop End %I eop showpage %%Trailer end endTexFig 265 2305 a fh(Figure)i(8.2)p fl(:)j ff(GraphicalObject)e fl (and)d ff(ArchitecturalObject)p fl(,)j(After)d(Refactoring)108 2411 y(This)h (is)f(an)g(example)h(of)f(the)g(refactoring)g(de\014ned)h(in)g(this)f(section\ .)21 b(Other)15 b(examples)h(are)f(describ)q(ed)37 2468 y(in)i(sections)e(3.4) f(and)i(9.2.)941 2760 y(103)g eop bop 37 42 a fe(8.9.2)56 b(Argumen)n(ts)18 b (&)g(Op)r(erations)37 165 y fl(This)j(refactoring)e(con)o(v)o(erts)g(an)g(ass\ o)q(ciation,)i(mo)q(deled)g(as)f(a)f(sub)q(class/sup)q(erclass)i(relationship\ ,)h(in)o(to)37 221 y(an)e(aggregation.)33 b(All)21 b(b)q(eha)o(vior)f(inherit\ ed)i(b)o(y)e(the)f(sub)q(class/clien)o(t)j(from)d(its)h(sup)q(erclass)h(b)q (efore)f(the)37 278 y(refactoring)15 b(will)i(b)q(e)f(delegated)g(to)f(a)f (new)i(comp)q(onen)o(t,)f(whic)o(h)h(is)g(an)f(instance)h(of)f(the)g(old)h (sup)q(erclass.)108 372 y(After)10 b(this)g(refactoring,)h(the)f(mo)o(v)o(e)s 14 2 v 13 w(class)g(refactoring)g(could)h(b)q(e)g(applied)h(to)d(mo)o(v)o(e)h (the)g(sub)q(class/clien)o(t.)37 515 y(The)16 b(argumen)o(ts)e(to)h(this)g (refactoring)g(are:)106 659 y fj(\017)22 b fl(the)15 b(sup)q(erclass)i(\(Sup) q(er\))106 753 y fj(\017)22 b fl(the)15 b(sub)q(class/clien)o(t)j(\(Clien)o (t\))108 897 y(In)f(the)f(descriptions)h(b)q(elo)o(w:)22 b(the)16 b(set)g(of) f(v)m(ariables)i(inherited)h(b)o(y)e(sub)q(class/clien)o(t)i(is)f(referred)f (to)f(as)37 953 y fi(setOfV)m(ars)p fl(;)f(the)h(set)g(of)g(functions)h(inher\ ited)h(b)o(y)e(sub)q(class/clien)o(t)i(is)f(referred)f(to)g(as)g fi(setOfF)m (uncs)p fl(.)37 1097 y(After)g(c)o(hec)o(king)h(its)g(precondition,)g(this)g (refactoring:)93 1241 y(1.)22 b(generates)15 b(a)g(unique)i(name)e(for)f(the) i(new)f(comp)q(onen)o(t)g(v)m(ariable,)i(and)e(calls)h(the)g(refactoring)151 1297 y(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)g(to)f(add) g(the)h(comp)q(onen)o(t)f(v)m(ariable)i(to)d(sub)q(class)s 14 2 v 15 w(clien) o(t)93 1391 y(2.)22 b(calls)h(the)f(refactoring)g(de\014ned)h(in)g(section)g (8.3)e(to)g(qualify)j(the)e(newly)h(created)f(v)m(ariable)h(as)f(a)151 1448 y (comp)q(onen)o(t)93 1541 y(3.)g(calls)h(the)e(abstract)s 14 2 v 13 w(access)s 14 2 v 13 w(to)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)i(refacto\ ring)e(for)g(all)h(v)m(ar)g fj(2)f fl(setOfV)l(ars)h(whic)o(h)151 1598 y(ha)o (v)o(e)15 b(not)g(already)g(b)q(een)i(abstracted.)93 1692 y(4.)22 b(for)e(eac) o(h)g(inherited)i(mem)o(b)q(er)e(function)h(\(ie)f(setOfF)l(uncs)h fj([)f fl (the)h(functions)f(added)h(in)g(the)f(prior)151 1748 y(step\),)15 b(calls)h (create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(function)g(to)e(cop)o(y)h (it)h(in)o(to)f(the)g(sub)q(class)93 1842 y(5.)22 b fj(8)16 b fl(v)m(ar)g fj (2)h fl(setOfV)l(ars,)e(replace)i(in)g(v)m(ar's)e(accessing)i(and)f(up)q(dati\ ng)h(functions)g(\(in)g(sub)q(class/clien)o(t\))151 1898 y(the)12 b(curren)o (t)h(function)g(b)q(o)q(dy)g(\(a)e(reference)i(or)f(assignmen)o(t)g(to)f(v)m (ar\))h(with)h(a)f(call)h(to)f(the)g(corresp)q(ond-)151 1955 y(ing)k(function) g(in)g(the)f(new)h(comp)q(onen)o(t.)93 2049 y(6.)22 b(for)15 b(eac)o(h)g(rema\ ining)h(function)g(copied)h(in)o(to)e(sub)q(class/clien)o(t)i(in)f(step)f(4,) g(calls)h(the)f(refactoring)151 2105 y(replace)s 14 2 v 15 w(statemen)o(t)s 14 2 v 12 w(list)s 14 2 v 14 w(with)s 14 2 v 14 w(function)s 14 2 v 14 w(call)h (to)f(replace)h(the)g(curren)o(t)f(function)h(b)q(o)q(dy)g(with)f(a)g(call) 151 2162 y(to)g(the)g(corresp)q(onding)h(mem)o(b)q(er)g(function)g(of)e(the)i (new)f(comp)q(onen)o(t.)37 2321 y fe(8.9.3)56 b(Preconditions)37 2444 y fl (Precondition:)941 2760 y(104)g eop bop 93 42 a fl(1.)22 b fj(8)16 b fl(F)e fj (2)i fl(setOfF)l(uncs,)226 98 y fj(8)g fl(refdItem)f fj(2)g fl(\(v)m(ariables\ ReferencedBy)k(\(F\))14 b fj([)301 154 y fl(functionsCalledBy\(F\)\),)376 211 y(refdItem)i fj(62)f fl(\(Clien)o(t.lo)q(callyDe\014nedMem)o(b)q(erF)l(unc)q (tions)j fj([)451 267 y fl(Clien)o(t.lo)q(callyDe\014nedMem)o(b)q(e)q(rV)l (ariable)q(s\).)151 324 y(\(there)k(are)g(no)f(references)i(among)e(the)h(mem) o(b)q(ers)h(inherited)g(b)o(y)f(sub)q(class)s 14 2 v 15 w(clien)o(t)h(to)e (mem)o(b)q(ers)151 380 y(lo)q(cally)c(de\014ned)g(in)f(sub)q(class)s 14 2 v 14 w(clien)o(t.\))93 474 y(2.)22 b fj(8)16 b fl(F)e fj(2)i fl(setOfF)l(uncs,)226 531 y fj(8)g fl(refdItem)f fj(2)g fl(\(v)m(ariablesReferencedBy)k(F\),)301 587 y(Clien)o(t)d fj(\032)g fl(scop)q(eOf\(refdItem\).)151 643 y(\(all)c(v)m(aria\ bles)h(referenced)f(b)o(y)f fi(setOfF)m(uncs)f fl(are)h(visible)i(to)e(sub)q (class/clien)o(t)j(\(ie)d(their)h(access)g(con)o(trol)151 700 y(mo)q(de)k(is) f(not)g(priv)m(ate\).\))93 794 y(3.)22 b fj(8)16 b fl(F)e fj(2)i fl(setOfF)l (uncs,)226 850 y(F.accessCon)o(trolMo)q(de)e(=)i(public.)151 907 y(\(all)g (functions)g(in)g(setOfF)l(uncs)g(are)f(public\).)37 1028 y fe(8.9.4)56 b(Beh\ a)n(vior)18 b(Preserv)m(ation)37 1114 y fl(F)l(or)j(create)s 14 2 v 14 w(mem) o(b)q(er)s 14 2 v 13 w(v)m(ariable)i(\(step)e(1\):)32 b(precondition)24 b(1)d (\(the)g(new)h(v)m(ariable)h(do)q(esn't)e(collide)j(with)37 1171 y(another)18 b(v)m(ariable)g(referenced)h(within)f(its)g(in)o(tended)h(scop)q(e\))f(is)f (satis\014ed)h(b)q(ecause)h(the)e(new)h(v)m(ariable)h(is)37 1227 y(giv)o(en)d (a)f(unique)i(name.)108 1283 y(F)l(or)j(the)h(refactoring)g(de\014ned)h(in)g (section)f(8.3)f(\(step)h(2\):)30 b(the)21 b(precondition)i(is)e(satis\014ed) g(b)q(ecause)37 1340 y(the)f(v)m(ariable)g(quali\014es)h(as)e(a)g(comp)q(onen) o(t.)32 b(The)19 b(v)m(alue)i(\(ob)s(ject\))d(is)h(statically)h(assigned)g (to)f(it,)h(and)f(is)37 1396 y(unreferenced)e(elsewhere.)108 1453 y(F)l(or)j (abstract)s 14 2 v 13 w(access)s 14 2 v 13 w(to)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(v)m(ariable)i(\(step)e(3\):)31 b(precondition)22 b(1)f(is)g(satis\ \014ed)g(b)q(ecause)h(this)37 1509 y(refactoring)15 b(is)h(only)g(applied)h (on)e(v)m(ariables)h(that)f(ha)o(v)o(e)g(not)g(already)g(b)q(een)h(abstracted\ .)108 1566 y(F)l(or)e(create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 14 w(functio\ n)h(\(step)g(4\):)k(precondition)d(1)e(is)h(satis\014ed)g(b)q(ecause)h(the)f (lo)q(cally)h(de\014ned)37 1622 y(function)h(is)f(redundan)o(t;)f(preconditio\ ns)i(2-4)e(\(regarding)g(equiv)m(alen)o(t)i(signatures)f(and)f(function)h(b)q (o)q(dies\))37 1679 y(are)23 b(satis\014ed)g(b)q(ecause)h(the)e(sup)q(erclass) i(function)g(is)f(b)q(eing)h(copied)g(in)o(to)e(the)h(class;)k(precondition)d (5)37 1735 y(\(regarding)15 b(references)h(in)g(the)g(function)g(b)q(o)q(dy\)) f(is)h(satis\014ed)g(b)q(ecause)g(the)f(function)h(references:)106 1829 y fj (\017)22 b fl(v)m(ariables)d(whose)d(scop)q(e)i(includes)h(b)q(oth)f(the)f (sup)q(erclass)h(and)f(sub)q(class/clien)o(t)i(\(b)o(y)e(precondition)151 1885 y(t)o(w)o(o)d(of)h(this)g(refactoring\))106 1979 y fj(\017)22 b fl(functions) c(whic)o(h)g(are)f(either)h(inherited)g(b)o(y)l(,)g(or)e(are)h(iden)o(tically) j(de\014ned)e(in,)g(the)f(sub)q(class/clien)o(t)151 2036 y(\(b)q(ecause)f(the) f(new)h(function)g(is)f(iden)o(tical)j(to)c(the)h(previously)i(inherited)g (function)f(it)f(replaces\))108 2129 y(F)l(or)d(step)h(5:)19 b(for)12 b(all)i (v)m(ars)e(in)i(setOfV)l(ars,)f(the)g(only)g(references)h(to)e(the)h(v)m(aria\ bles)h(are)f(b)o(y)g(the)g(accessing)37 2186 y(and)18 b(up)q(dating)g(functio\ ns.)28 b(Changing)17 b(the)h(function)g(b)q(o)q(dies)h(to)e(b)q(e)h(calls)g (to)f(the)g(corresp)q(onding)i(func-)37 2242 y(tion)f(in)f(the)g(comp)q(onen) o(t)g(consisten)o(tly)h(replaces)g(all)f(refs)g(to)f(v)m(ars)h(in)h(setOfV)l (ars)e(with)h(with)h(refs)e(to)g(the)37 2299 y(corresp)q(onding)h(v)m(ariable\ s)g(in)g(the)f(comp)q(onen)o(t.)22 b(By)16 b(construction,)g(the)g(t)o(yp)q (e)g(of)f(eac)o(h)h(v)m(ar)g(in)h(setOfV)l(ars)37 2355 y(is)g(the)g(same)f (as)g(the)h(t)o(yp)q(e)f(of)g(the)h(v)m(ar)f(that)g(replaces)i(it.)24 b(Th)o (us,)16 b(as)g(for)g(similar)i(refactorings)e(describ)q(ed)37 2412 y(earlier) h(in)f(this)f(c)o(hapter,)g(this)h(step)f(is)g(b)q(eha)o(vior)h(preserving.) 108 2468 y(F)l(or)d(replace)s 14 2 v 15 w(statemen)o(t)s 14 2 v 12 w(list)s 14 2 v 14 w(with)s 14 2 v 14 w(function)s 14 2 v 14 w(call)i(\(step)f(6\):)19 b (precondition)c(1)f(\(the)g(called)h(function)g(is)37 2525 y(visible)j(from)c (the)h(calling)h(function\))g(is)f(satis\014ed)g(b)o(y)g(precondition)h(3)f (of)f(this)i(refactoring;)e(precondition)37 2581 y(2)f(\(seman)o(tic)g(equiv) m(alence\))i(is)f(satis\014ed)g(b)q(ecause)g(it)f(replaces)h(the)f(b)q(o)q (dy)h(of)e(the)h(function)h(with)g(a)e(call)i(to)f(a)941 2760 y(105)g eop bop 37 42 a fl(function)14 b(\(in)f(the)f(comp)q(onen)o(t\))g(that)g(has)g(a)g (seman)o(tically)i(equiv)m(alen)o(t)g(function)f(b)q(o)q(dy)l(.)20 b(By)13 b (construction,)37 98 y(the)i(t)o(w)o(o)f(functions)i(p)q(erform)e(the)h(same) g(op)q(erations)g(and,)f(from)g(the)h(prior)g(step,)g(all)h(v)m(ariable)g(ref\ erences)37 154 y(are)f(seman)o(tically)i(equiv)m(alen)o(t.)108 211 y(Th)o(us,) e(eac)o(h)g(step)g(is)h(b)q(eha)o(vior)g(preserving)g(and,)f(hence,)h(the)f (refactoring)g(is)g(b)q(eha)o(vior)h(preserving.)37 354 y fd(8.10)70 b(Discus\ sion)37 457 y fe(8.10.1)56 b(Related)17 b(W)-5 b(ork)18 b(in)h(OODB)g(Sc)n (hema)e(Ev)n(olution)37 543 y fl(Kim)j([66)o(])f(describ)q(es)i(comp)q(osite) e(ob)s(jects)f(in)i(the)f(ORION)i(ob)s(ject-orien)o(ted)e(database)f(system,) i(whic)o(h)37 599 y(are)f(similar)g(to)f(aggregate)f(ob)s(jects.)29 b(Orion) 20 b(supp)q(orted)f fi(c)n(omp)n(osite)g(r)n(efer)n(enc)n(es,)e fl(whic)o(h)i (are)f(similar)i(to)37 656 y(comp)q(onen)o(ts.)26 b(ORION)19 b(supp)q(orted)e (sev)o(eral)g(t)o(yp)q(es)g(of)g(comp)q(osite)g(references,)h(one)f(imp)q(ort\ an)o(t)g(distinc-)37 712 y(tion)i(b)q(eing)g fi(shar)n(e)n(d)f fl(and)g fi (exclusive)g fl(references.)29 b(An)18 b(ob)s(ject)g(could)h(ha)o(v)o(e)f(at) f(most)h(one)g(exclusiv)o(e)i(\(and)37 769 y(no)g(shared\))f(references,)i (or)d(an)o(y)h(n)o(um)o(b)q(er)h(of)f(shared)g(references.)33 b(In)20 b(refac\ toring,)g(in)g(order)f(to)g(a)o(v)o(oid)37 825 y(information)c(loss)g(the)f (k)o(ey)h(qualit)o(y)g(of)f(a)g(comp)q(onen)o(t)h(is)g(that)e(it)i(b)q(e)g fi (exclusive)f fl(to)g(one)g(aggregate)f(ob)s(ject.)37 882 y(Th)o(us,)i(all)h (comp)q(onen)o(ts)g(in)o(v)o(olv)o(ed)g(in)g(these)f(refactorings)g(are)g(exc\ lusiv)o(e.)37 1003 y fe(8.10.2)56 b(User)18 b(In)n(terface)37 1089 y fl(Secti\ on)g(6.2)d(describ)q(es)j(a)f(m)o(ulti-windo)o(w)g(displa)o(y)h(to)e(assist)g (in)h(de\014ning)h(the)f(proto)q(col)f(for)g(an)h(abstract)37 1146 y(sup)q (erclass.)28 b(A)18 b(similar)h(in)o(terface)e(\(see)h(Figure)g(8.3\))e(could) i(b)q(e)h(used)f(in)g(migrating)g(mem)o(b)q(ers)f(b)q(et)o(w)o(een)37 1202 y (aggregate)j(and)h(comp)q(onen)o(t)g(classes.)76 b(The)21 b(top)g(windo)o(w)g (displa)o(ys)h(the)f(mem)o(b)q(er)g(v)m(ariables)i(of)d(the)37 1259 y(aggrega\ te)15 b(class)h ff(Automobile)p fl(.)k(The)c(middle)i(t)o(w)o(o)c(windo)o(ws) i(displa)o(y)h(the)f(mem)o(b)q(ers)g(for)g(t)o(w)o(o)e(of)h(its)i(com-)37 1315 y(p)q(onen)o(t)c(classes,)g ff(Engine)g fl(and)f ff(Tire)p fl(.)18 b(In)13 b (this)f(example,)i(the)e(user)g(requests)g(to)f(mo)o(v)o(e)h(the)g(mem)o(b)q (er)g(v)m(ariable)37 1372 y fi(warr)n(antyExpir)n(ation)k fl(from)f(the)h(com\ p)q(onen)o(t)g ff(Tire)f fl(class)h(to)f(its)g(aggregate)f(class)i ff(Automob\ ile)p fl(.)j(The)d(user)37 1428 y(en)o(ters)h(the)h(request)f(b)o(y)l(,)g(for) g(example,)h(clic)o(king)h(on)e(the)h(mem)o(b)q(er)f(to)g(b)q(e)h(mo)o(v)o (ed,)e(and)i(either)g(dragging)37 1484 y(it)f(from)e(the)h(comp)q(onen)o(t)h (windo)o(w)f(to)g(the)g(aggregate)e(windo)o(w,)j(or)e(b)o(y)h(selecting)i(the) e(op)q(eration)g(from)g(a)37 1541 y(p)q(op-up)h(displa)o(y)l(.)108 1597 y(The) f(to)q(ol)f(recognizes)i(that)e(class)h ff(Automobile)d fl(has)j(four)f ff (Tire)g fl(comp)q(onen)o(ts,)g(so)h(four)f(v)m(ariables)i(need)37 1654 y(to)e (b)q(e)i(added)f(to)f(the)g(aggregate)f(class.)22 b(In)16 b(the)g(lo)o(w)o (er)f(windo)o(w,)g(it)h(prompts)f(for)g(the)h(names)f(of)g(the)h(four)37 1710 y(new)f(v)m(ariables.)22 b(F)l(urthermore,)13 b(since)j(there)f(is)g(already) h(a)e(v)m(ariable)i(de\014ned)g(in)g(class)f ff(Automobile)e fl(called)37 1767 y fi(warr)n(antyExpir)n(ation)p fl(,)j(the)f(to)q(ol)g(w)o(arns)g(that)f(the) h(new)h(v)m(ariables)g(m)o(ust)f(b)q(e)h(named)f(di\013eren)o(tly)h(from)f (it.)108 1823 y(Suc)o(h)j(an)f(in)o(terface)g(could)h(b)q(e)g(extended)g(to)e (pro)o(vide)h(displa)o(y)i(en)o(tire)e(aggregation)f(hierarc)o(hies)i(\(ag-) 37 1880 y(gregate)13 b(ob)s(jects,)g(their)h(comp)q(onen)o(ts)g(and)f(sub-com\ p)q(onen)o(ts\),)h(graphs)f(of)h(inheritance)h(and)f(aggregation)37 1936 y (hierarc)o(hies,)i(and)f(in)h(in)o(v)o(erted)f(hierarc)o(h)o(y)g(where)g(a)f (comp)q(onen)o(t)h(class)g(could)h(b)q(e)g(displa)o(y)o(ed,)f(follo)o(w)o(ed) h(b)o(y)37 1993 y(all)g(aggregate)d(classes)h(con)o(taining)h(an)g(instance)g (of)f(the)g(comp)q(onen)o(t)h(class.)20 b(Precondition)15 b(c)o(hec)o(king)g (\(eg:)37 2049 y(to)g(a)o(v)o(oid)g(name)g(con\015icts\))h(could)g(b)q(e)g (built)h(in)o(to)e(the)g(in)o(terface,)g(as)g(sho)o(wn)g(in)h(Figure)f(8.3.) 108 2105 y(Recall)j(that)d(in)i(c)o(hapter)f(six)h(heuristics)g(could)h(b)q (e)e(applied)i(to)e(suggest)f(what)h(mem)o(b)q(ers)g(that)f(could)37 2162 y (b)q(e)g(migrated)f(to)g(an)g(abstract)f(sup)q(erclass.)20 b(Similarly)l(,)c (heuristics)g(migh)o(t)e(b)q(e)h(applied)h(here)e(to)f(determine)37 2218 y (whic)o(h)i(mem)o(b)q(ers)e(should)i(b)q(e)f(mo)o(v)o(ed)f(and)g(when)h(an)f (asso)q(ciation)h(mo)q(deled)h(using)f(inheritance)h(should)g(b)q(e)37 2275 y (con)o(v)o(erted)f(to)g(an)g(aggregation.)k(Ho)o(w)o(ev)o(er,)13 b(just)h(as) f(in)i(c)o(hapter)f(six,)g(it)h(is)f(unlik)o(ely)i(that)e(these)g(heuristics) 37 2331 y(will)23 b(b)q(e)f(error-pro)q(of,)g(and)f(\(as)g(describ)q(ed)i(ab) q(o)o(v)o(e\))d(a)h(sophisticated)h(user)g(in)o(terface)f(can)h(mak)o(e)e(the\ se)37 2388 y(refactorings)15 b(prett)o(y)g(easy)l(,)g(so)f(heuristics)j(are)e (not)g(the)g(fo)q(cus)g(of)g(this)h(c)o(hapter.)941 2760 y(106)g eop bop 158 0 a 25786450 22234234 5065195 27957248 30851645 50191482 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Roman Helvetica %%Pages: 1 %%BoundingBox: 77 425 469 763 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.86747 0 0 0.86747 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 89 626 90 626 Rect End Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -2.5 329 ] concat %I 136 163 542 550 Rect End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -45 233 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 210 639 ] concat %I [ (PROTOCOL FOR AGGREGATE CLASS: AUTOMOBILE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -27 189 ] concat %I 239 435 590 435 Line End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 257 846 ] concat %I [ (Engine autoEngine;) (Date warrantyExpiration;) (Tire leftFrontTire;) (Tire rightFrontTire;) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 58 205 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 176.5 327 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 177 313.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 147 752 ] concat %I [ (COMPONENT CLASS: ) ( ENGINE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -91 287 ] concat %I 239 435 380 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 164 708 ] concat %I [ (int milesPerGallon;) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 -46 101 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 176.5 327 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 177 313.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 370.5 710 ] concat %I [ (Date warrantyExpiration;) ] Text End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 11 238 ] concat Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 339.5 191 ] concat %I 162 522 7 5 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 0.5 0 0 0.5 340 177.5 ] concat %I 162 522 7 5 Elli End End %I eop Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 152 615 ] concat %I [ (OPERATION:) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -85 165 ] concat %I 239 435 323 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 153 586 ] concat %I [ () ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -10 394.5 ] concat %I 144 369 547 369 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -4 398.5 ] concat %I 342 363 342 229 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -6.99998 256.5 ] concat %I 144 369 547 369 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 367 751 ] concat %I [ (COMPONENT CLASS: ) ( TIRE) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 130 287 ] concat %I 239 435 380 435 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 246 612 ] concat %I [ (move warrantyExpiration from Tire to Automobile) () ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-helvetica-medium-r-*-120-* /Helvetica 12 SetF %I t [ 1 0 0 1 152 591 ] concat %I [ (new variable names:) ( \(warrantyExpiration of leftFrontTire\): _____________________) ( \(warrantyExpiration of rightFrontTire\):_____________________) ( \(warrantyExpiration of leftRearTire\): ______________________) ( \(warrantyExpiration of rightRearTire\): _____________________) () (Note: new variable names must differ from warrantyExpiration) ( already defined in class Automobile.) ] Text End End %I eop showpage %%Trailer end endTexFig 203 1536 a fh(Figure)17 b(8.3)p fl(:)j(Migrating)15 b(Mem)o (b)q(ers)g(Bet)o(w)o(een)g(Aggregate)f(and)h(Comp)q(onen)o(t)g(Classes)37 1670 y fe(8.10.3)56 b(Summary)37 1830 y fl(T)l(o)15 b(summarize,)h(this)f(c)o(hapt\ er)g(de\014nes)i(sev)o(eral)e(refactorings)g(regarding)g(aggregations:)106 1924 y fj(\017)22 b fl(qualifying)17 b(a)e(mem)o(b)q(er)g(v)m(ariable)i(as)e (a)g(comp)q(onen)o(t)106 2018 y fj(\017)22 b fl(mo)o(ving)15 b(mem)o(b)q(ers) h(from)e(an)h(aggregate)f(class)h(to)g(the)g(class)h(of)f(one)g(of)g(its)g (comp)q(onen)o(ts)106 2112 y fj(\017)22 b fl(mo)o(ving)12 b(mem)o(b)q(ers)h (from)f(a)g(comp)q(onen)o(t)g(class)h(to)f(the)g(aggregate)f(classes)i(that)f (con)o(tain)g(comp)q(onen)o(t)151 2168 y(mem)o(b)q(ers)j(whic)o(h)h(are)f(ins\ tances)h(of)f(the)g(comp)q(onen)o(t)h(class)106 2262 y fj(\017)22 b fl(con)o (v)o(erting)15 b(a)g(relationship,)i(mo)q(deled)f(using)g(inheritance,)h(in)o (to)e(an)g(aggregation.)108 2356 y(This)g(c)o(hapter)f(de\014nes)i(ho)o(w)d (to)h(c)o(hec)o(k)h(if)g(a)f(mem)o(b)q(er)g(v)m(ariable)i(quali\014es)g(as)e (an)g(exclusiv)o(e)i(comp)q(onen)o(t)37 2412 y(for)f(its)g(class,)h(whic)o (h)g(is)f(a)g(precondition)i(used)f(in)g(these)f(refactorings.)941 2760 y(107) g eop bop 37 353 a fc(Chapter)35 b(9)37 560 y fb(Examples)37 783 y fl(This)13 b(c)o(hapter)e(describ)q(es)i(t)o(w)o(o)d(examples)i(of)f(ho)o(w)g(refactorin\ gs)g(can)h(b)q(e)g(in)o(tegrated)f(to)g(impro)o(v)o(e)g(the)h(design)37 839 y (of)j(a)g(program.)k(The)c(purp)q(ose)h(of)f(these)g(examples)h(is)g(to)f(cle\ arly)h(demonstrate)e(ho)o(w)h(refactorings)g(w)o(ork,)37 896 y(and)e(to)f(sho) o(w)g(that)g(refactorings)g(are)g(not)h(used)g(in)g(isolation,)h(but)e(rather) g(that)g fi(se)n(quenc)n(es)f fl(of)h(refactorings)37 952 y(are)j(often)g(nee\ ded.)108 1009 y(Chapter)j(three)g(describ)q(ed)i(sev)o(eral)e fi(r)n(e)n(al)g fl(examples)g(of)g(refactorings)g(man)o(ually)g(applied)i(to)e(ob)s(ject-)37 1065 y(orien)o(ted)d(application)h(framew)o(orks)c(as)i(they)g(ev)o(olv)o(ed.) 20 b(Those)14 b(examples)h(motiv)m(ated)f(the)g(imp)q(ortance)h(of)37 1122 y (refactoring)e(in)h(actual)f(design)h(tasks,)e(but)h(at)f(the)i(exp)q(ense)g (of)e(some)h(extraneous)g(detail)h(and)f(complexit)o(y)l(.)37 1178 y(By)j(con) o(trast,)d(the)j(examples)g(presen)o(ted)f(here)h(are)f(simpler)h(and)g(clear\ er)f(\(alb)q(eit)i(less)e(practical\).)108 1235 y(The)j fi(Menu)h(Planning)d fl(example)j(demonstrates)e(the)h(use)h(of)e(refactorings)h(de\014ned)h(in)g (c)o(hapters)f(six)37 1291 y(and)c(sev)o(en)f(for)g(sp)q(ecializin)q(g)i(a)e (class)h(and)f(then)h(migrating)f(common)g(co)q(de)h(to)f(a)f(sup)q(erclass.) 21 b(The)13 b fi(Matrix)37 1347 y fl(example)h(demonstrates)e(the)g(use)h(of) f(refactorings)g(de\014ned)i(in)f(c)o(hapters)g(six)g(and)f(eigh)o(t)h(for)f (c)o(hanging)h(ho)o(w)37 1404 y(an)18 b(in)o(terclass)h(relationship)g(is)f (mo)q(deled)h(\(from)e(inheritance)j(to)d(an)h(aggregation\);)f(that)g(exampl\ e)h(also)37 1460 y(includes)g(refactorings)d(for)f(creating)i(an)f(abstract)f (sup)q(erclass)i(of)f(related)h(comp)q(onen)o(t)f(classes.)37 1604 y fd(9.1) 70 b(Generalizing)20 b(&)k(Sp)r(ecializ)o(i)o(ng:)29 b(Men)n(u)23 b(Planning) f(Example)37 1705 y fl(This)14 b(example)g(demonstrates)f(the)g(use)h(of)f (refactorings)g(de\014ned)h(in)g(c)o(hapters)f(six)h(and)g(sev)o(en.)19 b(Thi\ s)14 b(meal)37 1761 y(planning)20 b(program)d(assumes)h(v)o(ery)g(predictable) i(eating)e(habits.)29 b(The)18 b(user)g(sp)q(eci\014es)i(the)e(da)o(ys)g(of)f (the)37 1818 y(w)o(eek)i(that)f(they)h(will)h(b)q(e)f(in)g(to)o(wn,)g(and)f (the)h(program)f(prin)o(ts)g(out)h(the)f(dinner)i(men)o(u)f(for)f(that)g(w)o (eek.)37 1874 y(The)e(implemen)o(tation)g(b)q(efore)g(refactoring)f(\(written) g(in)h(C++\))f(is:)157 1981 y fg(enum)23 b(DaysInTheWeek)f({)i(Monday,)f(Tues\ day,)g(Wednesday,)f(Thursday,)658 2037 y(Friday,)h(Saturday,)f(Sunday};)157 2150 y(class)h(Date)228 2206 y({)228 2263 y(protected:)300 2319 y(DaysInTheWe\ ek)f(dayOfWeek;)300 2376 y(int)h(dayOfMonth;)228 2432 y(public:)300 2489 y (Date)g(\(DaysInTheWeek)f(theDayOfWeek,)g(int)i(theDayOfMonth\))372 2545 y ({dayOfWeek)e(=)i(theDayOfWeek;)395 2602 y(dayOfMonth)f(=)h(theDayOfMonth;) 941 2760 y fl(108)g eop bop 419 42 a fg(};)300 98 y(void)23 b(printDinnerMenu) f(\(\))372 154 y({if)h(\(dayOfWeek)g(==)g(Monday\))443 211 y(cout)g(<<)h("Chi\ cken)f(Kiev";)395 267 y(else)h(if)f(\(dayOfWeek)g(==)g(Friday\))443 324 y(cou\ t)g(<<)h("Baked)f(Flounder";)395 380 y(else)443 437 y(cout)g(<<)h("Stir)f(Fri\ ed)g(Vegetables";)372 493 y(})228 550 y(};)157 606 y(main\(\))205 663 y({)205 719 y(Date)g(firstDayInTown\(Monday,1\),)324 775 y(secondDayInTown\(Thursday,) o(4\),)324 832 y(thirdDayInTown\(Friday,5\);)205 888 y(firstDayInTown.printDi\ n)o(nerMenu)o(\(\);)205 945 y(secondDayInTown.printDi)o(nnerMen)o(u\(\);)205 1001 y(thirdDayInTown.printDin)o(nerMenu)o(\(\);)205 1058 y(})37 1164 y fl (In)15 b(class)f ff(Date)p fl(,)g(the)g(mem)o(b)q(er)g(v)m(ariable)i fi(dayOf\ We)n(ek)e fl(is)g(assigned)h(an)f(argumen)o(t)f(of)g(the)h(constructor,)f(and) 37 1220 y(is)h(tested)e(in)i(a)e(conditional)i(statemen)o(t)e(of)g(the)h(mem) o(b)q(er)g(function)g fi(printDinnerMenu)p fl(.)19 b(This)13 b(conditional)37 1277 y(test)19 b(suggests)g(that)f(the)h(design)h(of)f(the)g(program)f(migh)o (t)h(b)q(e)h(re\014ned)g(b)o(y)f(sp)q(ecializin)q(g)i(the)f ff(Date)f fl(clas\ s)37 1333 y(based)d(on)f(the)g(en)o(umerated)h(v)m(alues)g(of)f(the)g(v)m(ari\ able)i fi(dayOfWe)n(ek)p fl(.)108 1390 y(The)c(example)g(b)q(elo)o(w)g(descri\ b)q(es)h(a)e(sp)q(ecial)j(purp)q(ose,)e(ultra-high)h(lev)o(el)f(refactoring)g (\(ala)f(macro\))f(that)37 1446 y(p)q(erforms)i(its)f(sp)q(ecialized)k(task) 11 b(b)o(y)i(com)o(bining)g(the)g(refactorings)f(de\014ned)i(in)f(prior)g(c)o (hapters.)18 b(When)13 b(this)37 1503 y(ultra-high)18 b(lev)o(el)g(refactorin\ g)f(is)g(in)o(v)o(ok)o(ed,)g(the)g(refactoring)f(to)q(ol)h(\(hereafter)f(refe\ rred)h(to)f(as)h(`the)f(to)q(ol'\))37 1559 y(sp)q(ecializes)d(the)e(class)f ff (Date)h fl(based)f(on)g(the)g(range)g(of)g(v)m(alues)h(\(an)f(en)o(umerated)g (t)o(yp)q(e\))g(of)g(a)g(mem)o(b)q(er)g(v)m(ariable)37 1616 y(referenced)j (b)o(y)e(a)g(conditional)i(in)f(the)f(function)h fi(printDinnerMenu)p fl(.)17 b(The)12 b(refactoring)f(is)g(st)o(ylized,)i(in)f(that)37 1672 y(it)i(uses)f (the)g(v)m(alues)h(of)e(the)h(en)o(umerated)g(t)o(yp)q(e)g(to)f(automatically) h(determine)h(and)f(name)g(the)g(sub)q(classes.)1892 1656 y fs(1)37 1729 y fl (It)j(pro)q(ceeds)g(as)f(follo)o(ws:)108 1785 y(Since)25 b(the)f(conditional) h(tests)e(the)g(v)m(alue)i(of)e(a)g(v)m(ariable)i(whose)f(t)o(yp)q(e)f(is)h (the)g(en)o(umerated)f(t)o(yp)q(e)37 1841 y fi(DaysInTheWe)n(ek)p fl(,)13 b (the)i(to)q(ol)f(creates)h(a)f(sub)q(class)h(for)f(eac)o(h)h(v)m(alue)g(in)h (that)d(en)o(umerated)i(t)o(yp)q(e.)20 b(F)l(ollo)o(wing)37 1898 y(the)14 b (steps)g(describ)q(ed)i(in)e(section)h(7.5,)d(the)i(to)q(ol)g(creates)g(sev)o (en)g(sub)q(classes)h(of)e ff(Date)h fl(with)g(the)g(refactoring)37 1954 y fi (cr)n(e)n(ate)s 14 2 v 14 w(empty)s 14 2 v 14 w(class)p fl(,)j(one)g(for)g (eac)o(h)h(da)o(y)f(of)g(the)h(w)o(eek.)27 b(The)17 b(names)h(of)f(the)g(sub) q(classes)i(corresp)q(ond)f(to)37 2011 y(the)d(set)f(of)f(v)m(alues)i(of)f (the)g(en)o(umerated)g(t)o(yp)q(e.)842 1994 y fs(2)882 2011 y fl(The)g(to)q (ol)g(assigns)g(an)g(in)o(v)m(arian)o(t)h(to)e(eac)o(h)i(sub)q(class)g(of)e (the)37 2067 y(form:)157 2161 y fg(dayOfWeek=.)37 2255 y fl(The)c(to)q(ol)f(de\014nes)h(a)e (constructor)g(in)i(eac)o(h)f(sub)q(class)h(with)g(the)f fi(cr)n(e)n(ate)s 14 2 v 13 w(memb)n(er)s 14 2 v 14 w(function)f fl(refactoring.)37 2311 y(The)11 b (constructor)e(consists)i(of)f(an)g(assignmen)o(t)g(that)g(sets)g(the)g(v)m (alue)h(of)f(the)h(mem)o(b)q(er)f(v)m(ariable)i fi(dayOfWe)n(ek)p fl(.)37 2392 y 750 2 v 89 2419 a fu(1)107 2435 y fp(Other)h(suc)o(h)g(high-lev)o(el)j(refa\ ctorings)e(could)h(b)q(e)e(de\014ned,)h(with)g(minor)g(v)n(ariations.)89 2465 y fu(2)107 2481 y fp(If)e(the)i(user)f(w)o(an)o(ted)h(di\013eren)o(t)h(names) f(for)f(the)g(classes,)h(they)g(could)h(b)q(e)e(c)o(hanged)i(later)f(using)h (the)e fm(change)r 12 2 v 10 w(class)r 12 2 v 10 w(name)37 2526 y fp(refactor\ ing.)941 2760 y fl(109)g eop bop 108 42 a fl(The)13 b(to)q(ol)g(then)g(migrat\ es)g(the)g(function)g fi(printDinnerMenu)f fl(do)o(wn)h(to)f(the)h(sub)q(clas\ ses)h(and)f(simpli\014es)37 98 y(it,)22 b(as)d(describ)q(ed)k(in)d(section)h (7.7.)34 b(F)l(or)19 b(example,)j(the)e(refactoring)g(rede\014nes)h(the)f fi (printDinnerMenu)37 154 y fl(function)d(in)f(the)f(sub)q(class)h ff(Monda)o (y)f fl(as:)157 305 y fg(void)23 b(printDinnerMenu)f(\(\))252 361 y({cout)h (<<)h("Chicken)f(Kiev";)252 418 y(})108 568 y fl(The)15 b(to)q(ol)f(then)h (sp)q(ecializes)j(the)c(instances)i(of)e(the)h(sup)q(erclass)g ff(Date)p fl (,)g(using)g(the)g(refactoring)f(de\014ned)37 624 y(in)j(section)e(7.9.)108 681 y(F)l(urther)e(re\014nemen)o(ts)g(are)g(p)q(ossible.)21 b(Since)14 b(the) f(class)h ff(Date)f fl(is)g(truly)h(abstract)e(\(it)h(has)f(no)h(instances\),) 37 737 y(and)i(since)h(the)e(function)h fi(printDinnerMenu)f fl(is)h(unrefere\ nced)h(elsewhere)f(in)g(the)g(class)g(and)f(is)h(rede\014ned)37 794 y(in)f (all)g(of)f(the)g(sub)q(classes,)h(the)f(to)q(ol)g(can)g(delete)h(the)f(funct\ ion)h(from)e(the)h(sup)q(erclass)h(with)g(the)f(refactoring)37 850 y fi(delet\ e)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(functions)p fl(.)108 907 y(Sev)o(eral) 22 b(further)f(refactorings)g(can)h(remo)o(v)o(e)f(unnecessary)h(assignmen)o (ts,)g(an)g(argumen)o(t)e(v)m(ariable,)37 963 y(mem)o(b)q(er)15 b(v)m(ariable) g(and)g(an)f(en)o(umerated)g(t)o(yp)q(e.)19 b(These)c(refactorings)e(could)j (b)q(e)e(in)o(v)o(ok)o(ed)h(individually)j(b)o(y)37 1020 y(the)e(user)f(or,)f (as)h(is)h(assumed)f(here,)h(in)o(v)o(ok)o(ed)f(automatically)l(.)108 1076 y (First,)f(the)h(to)q(ol)g(migrates)f(to)g(the)h(sub)q(classes)h(the)f(b)q(o)q (dy)g(of)g(the)g(constructor)f(de\014ned)i(in)f(class)h ff(Date)p fl(.)37 1132 y(Constructors)k(in)h fi(C++)e fl(are)i(di\013eren)o(t)f(from)g(other)g(funct\ ions,)i(in)f(that)f(a)g(sup)q(erclass)h(constructor)f(is)37 1189 y(not)15 b (o)o(v)o(erridden)h(b)o(y)f(a)g(sub)q(class)h(constructor;)e(rather,)g(when)h (an)g(instance)h(of)f(a)g(sub)q(class)h(is)f(created)g(the)37 1245 y(sup)q (erclass)20 b(constructor)e(is)g(\014rst)g(called)i(follo)o(w)o(ed)f(b)o(y)f (a)h(call)g(to)f(the)g(sub)q(class)i(constructor.)28 b(One)19 b(w)o(a)o(y)37 1302 y(to)d(think)g(of)f(this)h(is)g(that)f(eac)o(h)h(sub)q(class)h(construct\ or)e(b)q(egins)i(with)f(implicit)i(calls)f(to)e(the)g(constructors)37 1358 y (de\014ned)j(in)f(its)f(sup)q(erclasses.)23 b(Beha)o(vior)17 b(can)f(b)q(e)g (preserv)o(ed)h(b)o(y)f(adding)g(the)g(co)q(de)h(from)e(the)h(sup)q(erclass) 37 1415 y(constructor)e(to)f(the)h(fron)o(t)f(of)g(the)h(constructor)f(in)i (eac)o(h)f(direct)g(sub)q(class,)h(while)g(deleting)h(the)e(co)q(de)g(from)37 1471 y(the)i(sup)q(erclass)g(constructor.)569 1455 y fs(3)108 1528 y fl(F)l (or)f(example,)g(the)h(constructor)e(in)i(the)f(class)h ff(Monda)o(y)f fl(w)o (ould)h(no)o(w)e(b)q(e:)157 1690 y fg(Monday)23 b(\(DaysInTheWeek)f(theDayOfW\ eek,)g(int)h(theDayOfMonth\):)205 1747 y(Date\(theDayOfWeek,)e(theDayOfMonth\ \))300 1803 y({dayOfWeek)h(=)i(theDayOfWeek;)324 1860 y(dayOfMonth)e(=)i(theD\ ayOfMonth;)324 1916 y(dayOfWeek)e(=)i(Monday;)300 1973 y(};)108 2135 y fl(The) e(\014rst)f(statemen)o(t)f(is)i(a)f(dead)g(assignmen)o(t,)i(and)e(the)h(to)q (ol)f(remo)o(v)o(es)f(it.)39 b(The)21 b(argumen)o(t)g fi(the-)37 2192 y(DayOf\ We)n(ek)g fl(is)f(no)o(w)g(unreferenced,)i(and)e(the)g(to)q(ol)g(remo)o(v)o (es)f(it)h(with)h(the)f fi(delete)s 14 2 v 13 w(function)s 14 2 v 13 w(ar)n (gument)37 2248 y fl(refactoring.)f(The)14 b(mem)o(b)q(er)f(v)m(ariable)h fi (dayOfWe)n(ek)f fl(is)h(no)f(longer)g(referenced)h(in)g fi(printDinnerMenu)e fl(since)37 2305 y(the)h(conditional)h(test)f(has)f(b)q(een)i(remo)o(v)o(ed;) e(the)h(\014nal)g(assignmen)o(t)g(statemen)o(t)f(in)h(the)g(constructor)f(is) h(th)o(us)37 2361 y(a)j(dead)h(assignmen)o(t)e(and)i(the)f(to)q(ol)g(remo)o (v)o(es)f(it.)22 b(Since)c fi(dayOfWe)n(ek)e fl(is)g(unreferenced,)h(the)f (to)q(ol)g(deletes)37 2418 y(it)e(with)f(the)g(refactoring)g fi(delete)s 14 2 v 13 w(unr)n(efer)n(enc)n(e)n(d)s 14 2 v 12 w(variable)p fl(.)19 b(Then,)13 b (the)g(to)q(ol)g(deletes)h(the)f(en)o(umerated)g(t)o(yp)q(e)37 2474 y fi(Days\ InTheWe)n(ek)h fl(whic)o(h)i(is)g(no)f(longer)h(referenced.)21 b(The)15 b(res\ ulting)h(co)q(de)g(is)g(no)o(w:)37 2555 y 750 2 v 89 2582 a fu(3)107 2598 y fp (Suc)o(h)d(a)g(refactoring)i(w)o(ould)f(b)q(e)f(a)g(sligh)o(t)i(v)n(ariation) g(on)e(the)g fm(inline)r 12 2 v 10 w(function)r 12 2 v 10 w(c)n(al)r(l)e fp (refactoring.)941 2760 y fl(110)g eop bop 157 42 a fg(class)23 b(Date)228 98 y ({)228 154 y(protected:)300 211 y(int)g(dayOfMonth;)228 267 y(public:)300 324 y(Date)g(\(int)h(theDayOfMonth\))e({)h(};)228 380 y(};)157 493 y(class)g(Mond\ ay)g(:)h(public)f(Date)228 550 y({)228 606 y(public:)300 663 y(Monday)g(\(int) g(theDayOfMonth\))f(:)i(Date)f(\(theDayOfMonth\))372 719 y({dayOfMonth)f(=)i (theDayOfMonth;)419 775 y(};)300 832 y(void)f(printDinnerMenu)f(\(\))372 888 y ({cout)h(<<)g("Chicken)g(Kiev";)372 945 y(})228 1001 y(};)157 1114 y(\(the)g (remaining)g(subclasses)f(are)i(similarly)e(defined\))157 1227 y(main\(\))205 1284 y({Monday)g(firstDayInTown\(1\);)228 1340 y(Thursday)h(secondDayInTown\(\ 4\);)228 1396 y(Friday)g(thirdDayInTown\(5\);)228 1453 y(firstDayInTown.print\ DinnerMen)o(u\(\);)228 1509 y(secondDayInTown.printDinnerMe)o(nu\(\);)228 1566 y(thirdDayInTown.printDinnerMen)o(u\(\);)228 1622 y(})37 1715 y fl(A)o(t)13 b (this)g(p)q(oin)o(t,)g(the)f ff(Date)h fl(class)g(has)g(b)q(een)g(sp)q(eciali\ zed)j(and)d(the)f(conditional)j(test)d(remo)o(v)o(ed.)18 b(Refactoring)37 1771 y(could)f(stop)d(at)h(this)h(p)q(oin)o(t.)108 1827 y(Ho)o(w)o(ev)o(er,)e(b)o (y)g(in)o(v)o(oking)i(t)o(w)o(o)d(additional)k(refactorings)d(\(describ)q(ed) i(in)g(c)o(hapter)f(six\),)g(the)f(implemen-)37 1884 y(tation)h(could)h(b)q (e)f(further)f(optimized)i(b)o(y)f(migrating)g(common)f(co)q(de)h(in)h fi(pri\ ntDinnerMenu)d fl(function)j(up)37 1940 y(to)f(the)g(sup)q(erclass:)93 2033 y (1.)22 b(the)e(function)h(signature)f(of)g(the)g fi(printDinnerMenu)f fl(func\ tion)i(could)g(b)q(e)g(added)f(bac)o(k)g(in)o(to)g(the)151 2089 y(sup)q(ercla\ ss)c ff(Date)g fl(with)f(the)h(refactoring)e fi(add)s 14 2 v 15 w(function)s 14 2 v 13 w(signatur)n(e)93 2179 y fl(2.)22 b(common)e(co)q(de)h(in)g(the)f (sub)q(class)h(implemen)o(tations)h(of)d fi(printDinnerMenu)h fl(could)h(b)q (e)g(migrated)151 2235 y(up)f(to)g(the)g(sup)q(erclass,)h(using)g(the)f(refac\ toring)f(describ)q(ed)j(in)f(section)f(6.4.2.)33 b(As)19 b(part)h(of)f(that) 151 2292 y(refactoring;)14 b(the)g(segmen)o(ts)f(of)h(di\013ering)h(co)q(de)g (w)o(ould)f(b)q(e)h(placed)g(in)o(to)f(a)g(newly)h(de\014ned)g(function,)151 2348 y(here)h(called)h fi(mainCourse)p fl(.)108 2441 y(The)11 b fi(printDinne\ rMenu)f fl(function)i(is)g(small,)g(and)f(automatically)g(splitting)i(up)e (suc)o(h)g(a)g(small)h(function)37 2497 y(in)g(this)g(w)o(a)o(y)d(w)o(ould)j (not)e(impro)o(v)o(e)h(the)g(design)h(in)g(all)f(cases.)19 b(Th)o(us,)11 b (these)g(latter)g(t)o(w)o(o)e(optimizations)j(w)o(ould)37 2554 y(probably)k (b)q(e)g(man)o(ually)g(c)o(hosen,)f(although)h(the)f(to)q(ol)g(could)h(sugges\ t)f(these)g(c)o(hanges)g(to)g(the)g(user.)108 2610 y(The)h(refactored)e(co)q (de)i(is)g(no)o(w:)941 2760 y(111)g eop bop 157 98 a fg(class)23 b(Date)228 154 y({)228 211 y(protected:)300 267 y(int)g(dayOfMonth;)228 324 y(public:) 300 380 y(Date)g(\(int)h(theDayOfMonth\))e({)h(};)300 437 y(virtual)g(char)g (*)h(mainCourse\(\))e(=)i(0;)300 493 y(void)f(printDinnerMenu)f(\(\))372 550 y ({cout)h(<<)g(mainCourse\(\);)372 606 y(})228 663 y(};)157 775 y(class)g(Mond\ ay)g(:)h(public)f(Date)228 832 y({)228 888 y(public:)300 945 y(Monday)g(\(int) g(theDayOfMonth\))f(:)i(Date\(theDayOfMonth\))372 1001 y({dayOfMonth)e(=)i (theDayOfMonth;)419 1058 y(};)300 1114 y(char)f(*)h(mainCourse)f(\(\))372 1171 y({return)f("Chicken)h(Kiev";)372 1227 y(})228 1284 y(};)157 1396 y(...)37 1553 y fl(As)16 b(a)f(result)g(of)g(these)g(refactorings:)106 1642 y fj(\017) 22 b fl(the)16 b(design)h(is)f(clearer.)22 b(The)16 b(distinctions)h(b)q(et)o (w)o(een)f(da)o(ys)g(of)f(the)h(w)o(eek)f(are)h(made)f(more)h(explicit.)151 1698 y(Existing)g(instances)g(ha)o(v)o(e)e(b)q(een)i(sp)q(ecialized)q(.)22 b (In)16 b(subsequen)o(t)g(uses)f(of)g(the)g(to)q(ol,)f(instances)i(w)o(ould) 151 1755 y(b)q(e)g(sp)q(eci\014ed)h(according)f(to)f(the)g(da)o(y)g(of)f(the) i(w)o(eek)f(they)g(represen)o(t.)106 1846 y fj(\017)22 b fl(a)17 b(conditiona\ l)h(test,)e(sev)o(eral)h(assignmen)o(ts,)g(v)m(ariables)h(and)f(an)f(en)o(ume\ rated)h(t)o(yp)q(e)g(ha)o(v)o(e)f(b)q(een)i(re-)151 1903 y(mo)o(v)o(ed.)106 1995 y fj(\017)k fl(the)17 b(co)q(de)g(for)f(prin)o(ting)i(the)e(men)o(u)h (has)g(b)q(een)g(encapsulated)h(in)g(one)f(place,)g(a)o(w)o(a)o(y)e(from)h (the)h(co)q(de)151 2051 y(that)d(determines)h(the)g(men)o(u.)k(T)l(o)14 b(sub\ sequen)o(tly)i(alter)e(the)h(means)f(of)g(displa)o(ying)i(the)e(men)o(u,)h (only)151 2108 y(the)g fi(printDinnerMenu)g fl(de\014ned)h(in)g(class)g ff (Date)f fl(needs)h(to)f(b)q(e)h(c)o(hanged.)108 2197 y(In)e(summary)l(,)e(the) i(result)f(of)g(these)g(refactorings)g(is)g(a)g(cleaner)h(design,)g(less)g (co)q(de)f(and)h(p)q(ossibly)g(faster)37 2253 y(execution.)37 2396 y fd(9.2) 70 b(Con)n(v)n(erting)23 b(to)g(an)g(Aggregation:)32 b(Matrix)23 b(Example)37 2497 y fl(This)18 b(example)g(demonstrates)e(the)h(use)h(of)e(refactorings)h (de\014ned)h(in)g(c)o(hapters)f(six)g(and)g(eigh)o(t,)h(fo)q(cusing)37 2554 y (mostly)12 b(on)h(comp)q(onen)o(t)f(related)g(refactorings.)19 b(Sometimes)12 b(the)g(relationship)i(b)q(et)o(w)o(een)f(t)o(w)o(o)d(classes)j(do)q(es)37 2610 y(not)19 b(b)q(ecome)g(clear)g(un)o(til)h(after)e(implemen)o(tation)i (is)f(underw)o(a)o(y)l(.)31 b(Consider)19 b(the)g(case)f(where)h(the)g(class) 941 2760 y(112)g eop bop 37 42 a ff(Tw)o(oDimensionalArra)o(y)9 b fl(is)14 b (de\014ned,)g(then)f(the)g ff(Matrix)f fl(class)h(is)g(de\014ned)i(as)d(a)g (sub)q(class)i(of)f(it.[46)o(])f(A)h(matrix)37 98 y(is)j(a)f(sp)q(ecial)i(use) e(of)g(a)g(t)o(w)o(o)f(dimensional)j(arra)o(y)l(,)d(and)h(can)g(b)q(e)h(thoug\ h)o(t)e(of)h(as)g(a)g(sp)q(ecialization)i(of)e(it.)20 b(F)l(or)37 154 y(this) c(example,)g(matrices)f(ha)o(v)o(e)g(a)g(maxim)o(um)g(of)g(400)f(cells)j(eac) o(h)e(storing)g(in)o(teger)g(v)m(alues.)735 209 y 7564902 3683779 15524495 25589104 23089397 29272883 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Bold %%Pages: 1 %%BoundingBox: 236 389 351 445 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -21.687 42.2891 ] concat %I 472 439 472 439 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 296.59 554.012 ] concat %I [ (TwoDimensionalArray) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 195.614 -65.0724 ] concat %I 155 626 155 626 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 343.614 500.928 ] concat %I [ (Matrix) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 194.614 -73.0724 ] concat %I 167 613 167 575 Line End End %I eop showpage %%Trailer end endTexFig 91 571 a fh(Figure)j(9.1)p fl(:)i(Inheritance)c(Relationship)i (Bet)o(w)o(een)d(Classes)g ff(Tw)o(oDimensionalArra)n(y)e fl(and)i ff(Matrix) 37 673 y fl(The)h(classes)g(are)f(de\014ned)h(as)f(follo)o(ws:)157 767 y fg (class)23 b(TwoDimensionalArray)228 823 y({)228 879 y(protected:)300 936 y (int)g(elements[400];)300 992 y(int)g(columns,)g(rows;)228 1049 y(public:)300 1105 y(TwoDimensionalArray)e(\(int)j(numberOfRows,)e(int)h(numberOfColumns\)) 372 1162 y({)g(...)h(};)300 1218 y(virtual)f(int)g(get\(int)g(rowNumber,)g (int)g(columnNumber\))f({)i(...)f(};)300 1275 y(virtual)g(void)g(put)h(\(int) f(newValue,)g(int)g(rowNumber,)730 1331 y(int)g(columnNumber\))372 1388 y({)g (...)h(};)228 1444 y(};)157 1557 y(class)f(Matrix)g(:)h(public)f(TwoDimension\ alArray)228 1613 y({)228 1670 y(public:)300 1726 y(Matrix)g(\(int)g(numberOfR\ ows,)f(int)i(numberOfColumns\))e(:)348 1783 y(TwoDimensionalArray)f(\(numberO\ fRows,numberOfColu)o(mns\))g({};)300 1839 y(Matrix)i(matrixMultiply)f(\(Matri\ x)h(anotherMatrix\))348 1896 y({)g(...)h(j=get\(x,y\);)e(...)i(put\(k,x,y\);) e(...};)300 1952 y(void)h(rotate\(\))g({)h(...};)300 2009 y(Matrix)f(martixIn\ verse\(\))f({)i(...};)228 2065 y(};)108 2215 y fl(It)17 b(seemed)h(reasonable) g(at)e(\014rst)h(to)g(mo)q(del)h(this)f(relationship)i(using)f(inheritance;)i (the)d(higher)h(lev)o(el)37 2271 y(matrix)h(op)q(erations)h(call)g(the)g(lo)o (w)o(er)f(lev)o(el)h(functions)g(inherited)i(from)c(its)i(sup)q(erclass.)33 b (A)19 b(matrix)g(w)o(as)37 2328 y(though)o(t)f(of)g(as)g(a)g(sp)q(ecial)i(t)o (yp)q(e)e(of)g(t)o(w)o(o)f(dimensional)j(arra)o(y)l(.)28 b(Ho)o(w)o(ev)o(er,) 18 b(a)g(matrix)g(is)g(a)g(mathematical)37 2384 y(abstraction)g(that)g(can)h (b)q(e)g(represen)o(ted)g(in)g(di\013eren)o(t)f(w)o(a)o(ys.)29 b(The)18 b(rep\ resen)o(tation)h(is)g(part)e(of)h(the)h(ma-)37 2441 y(trix)c(abstraction,)f (but)h(the)g(matrix)f(abstraction)g(and)h(its)g(represen)o(tation)g(are)f(rea\ lly)i(distinct)f(concepts.)37 2497 y(Op)q(erations)i(on)g(the)f(abstraction)g (should)h(b)q(e)g(separated)f(from)f(op)q(erations)i(on)f(its)g(represen)o (tation.)23 b(F)l(or)37 2554 y(applications)e(where)d(\(for)g(example\))h(mat\ rices)g(are)f(sparse,)h(represen)o(tations)f(other)g(than)h(t)o(w)o(o)e(dimen\ -)37 2610 y(sional)g(arra)o(ys)c(are)i(more)g(e\016cien)o(t.)941 2760 y(113)g eop bop 108 42 a fl(The)18 b(refactoring)f(de\014ned)i(in)f(section)g(8.7)f (is)h(applied)h(to)e(b)q(etter)h(mo)q(del)g(the)g(relationship)h(b)q(et)o(w)o (een)37 98 y(the)d(classes)f ff(Matrix)g fl(and)g ff(Tw)o(oDimensionalArra)n (y)p fl(.)i(During)f(that)e(refactoring,)h(the)g(to)q(ol:)93 200 y(1.)22 b (adds)17 b(an)g(instance)h(of)e(the)h(class)h ff(Tw)o(oDim)o(ensionalArra)o (y)c fl(as)i(a)h(mem)o(b)q(er)g(v)m(ariable)h(in)g(class)f ff(Matrix)151 256 y fl(as)e(mem)o(b)q(er)g(v)m(ariable)i fi(matrixR)n(epr)p fl(,)f(using)f(the)h (create)s 14 2 v 13 w(mem)o(b)q(er)s 14 2 v 13 w(v)m(ariable)h(refactoring.) 93 349 y(2.)22 b(quali\014es)17 b(the)f(v)m(ariable)g fi(matrixR)n(epr)g fl (as)f(an)h(exclusiv)o(e)h(comp)q(onen)o(t)e(of)g(class)h ff(Matrix)p fl(,)f (as)g(describ)q(ed)151 405 y(in)h(section)g(8.3.)93 498 y(3.)22 b(replaces)e (all)g(calls)g(to)e(the)h(mem)o(b)q(er)g(functions)h fi(get)e fl(and)h fi(put) h fl(in)g(class)f ff(Matrix)f fl(with)h(calls)h(to)e(the)151 554 y(corresp)q (onding)e(functions)g(in)g(the)g(comp)q(onen)o(t.)108 656 y(Then,)f(the)h(to) q(ol)f(c)o(hanges)g(the)g(sup)q(erclass)i(of)d(class)i ff(Matrix)p fl(,)e(usi\ ng)i(refactoring)f(mo)o(v)o(e)s 14 2 v 12 w(class.)37 713 y(The)h(classes)g (are)f(no)o(w)f(de\014ned)j(as)e(follo)o(ws:)157 814 y fg(class)23 b(TwoDimen\ sionalArray)228 871 y({)228 927 y(protected:)300 984 y(int)g(elements[400];) 300 1040 y(int)g(columns,)g(rows;)228 1097 y(public:)300 1153 y(TwoDimensiona\ lArray)e(\(int)j(numberOfRows,)e(int)h(numberOfColumns\))372 1210 y({)g(...)h (};)300 1266 y(virtual)f(int)g(get\(int)g(rowNumber,)g(int)g(columnNumber\))f ({)i(...)f(};)300 1323 y(virtual)g(void)g(put)h(\(int)f(newValue,)g(rowNumber\ ,)f(int)i(columnNumber\))372 1379 y({)f(...)h(};)228 1435 y(};)157 1548 y(cla\ ss)f(Matrix)228 1605 y({)228 1661 y(protected:)300 1718 y(TwoDimensionalArray) e(*)j(matrixRepr;)228 1774 y(public:)300 1831 y(Matrix)f(\(int)g(numberOfRows\ ,)f(int)i(numberOfColumns\))348 1887 y({matrixRepr)e(=)i(new)f(TwoDimensional\ Array\(numberOf)o(Rows,)1255 1944 y(numberOfColumns};)300 2000 y(Matrix)g(mat\ rixMultiply)f(\(Matrix)h(anotherMatrix\))348 2056 y({)g(...)h(j=matrixRepr->g\ et\(x,y\);)395 2113 y(...)g(matrixRepr->put\(k,x,y\);)d(...};)300 2169 y(void) i(rotate\(\))g({)h(...};)300 2226 y(Matrix)f(martixInverse\(\))f({)i(...};) 228 2282 y(};)108 2441 y fl(Note)12 b(that)g(the)g(represen)o(tation)h(sp)q (eci\014c)h(functions)f(for)f(retrieving)h(and)g(up)q(dating)g(an)f(elemen)o (t)h(of)f(the)37 2497 y(matrix)g(are)g(de\014ned)i(in)f(the)f(comp)q(onen)o (t)g(class)h ff(Tw)o(oDim)o(ensionalArra)o(y)p fl(,)c(whereas)j(functions)h (more)f(closely)37 2554 y(related)g(to)f(the)g(matrix)g(abstraction)g(are)g (de\014ned)h(in)g(the)g ff(Matrix)e fl(class.)19 b(Note)11 b(that)g(in)h(the) f fi(matrixMultiply)37 2610 y fl(function)17 b(of)d(class)i ff(Matrix)p fl (,)e(the)h fi(get)g fl(and)h fi(put)g fl(functions)g(are)e(referenced)j(throu\ gh)d(the)i(new)f(comp)q(onen)o(t.)941 2760 y(114)g eop bop 108 42 a fl(This) 15 b(separation)g(not)f(only)i(clari\014es)g(the)e(design)i(b)o(y)f(separatin\ g)f(functions)i(related)f(to)f(the)h(abstrac-)37 98 y(tion)21 b(and)f(one)g (if)h(its)f(p)q(ossible)i(represen)o(tations,)f(but)f(also)g(allo)o(ws)h(the) f(program)f(to)g(b)q(e)i(expanded)g(to)37 154 y(supp)q(ort)16 b(m)o(ultiple)h (represen)o(tations)e(for)g(m)o(ultiple)i(uses.)108 211 y(F)l(or)e(some)g(app\ lications,)i(the)e(matrix)g(is)h(kno)o(wn)g(to)e(b)q(e)i(sparse)g(and)f(repre\ sen)o(tations)h(more)f(e\016cien)o(t)37 267 y(than)d(t)o(w)o(o)f(dimensional) j(arra)o(ys)d(can)h(b)q(e)h(used.)19 b(The)13 b(follo)o(wing)f(steps)g(extend) h(the)f(to)q(ol)g(to)g(supp)q(ort)g(matrix)37 324 y(represen)o(tations)k(othe\ r)e(than)i(t)o(w)o(o)d(dimensional)18 b(arra)o(ys:)93 417 y(1.)k(creating)15 b (the)g(class)g ff(MatrixRep)o(resentation)h fl(as)e(a)h(sup)q(erclass)g(of)g ff(Tw)o(oDim)o(ensionalArra)o(y)p fl(,)c(using)k(the)151 473 y(refactorings)g fi(cr)n(e)n(ate)s 14 2 v 13 w(empty)s 14 2 v 14 w(class)f fl(and)i fi(move)s 14 2 v 14 w(class)93 567 y fl(2.)22 b(creating)h(a)f(new)h(class)g ff(Spa)o (rseMatrixRep)o(resentation)h fl(as)e(a)h(sub)q(class)g(of)f ff(MatrixRep)o (resentation)p fl(,)151 623 y(using)16 b(the)f fi(cr)n(e)n(ate)s 14 2 v 14 w (empty)s 14 2 v 14 w(class)f fl(refactoring)93 717 y(3.)22 b(cop)o(ying)c(mem) o(b)q(ers)f(from)g(the)h(class)f ff(Tw)o(oDimensionalArra)n(y)e fl(in)o(to)i (the)h(new)f(class,)h(and)g(man)o(ually)151 773 y(reimplemen)o(ting)f(those)e (op)q(erations)93 867 y(4.)22 b(migrating)17 b(common)g(b)q(eha)o(vior)g(to)g (the)g(abstract)f(sup)q(erclass,)i(using)g(the)f(refactorings)g(describ)q(ed) 151 923 y(in)f(c)o(hapter)f(six)93 1017 y(5.)22 b(generalizing)14 b(the)d(t)o (yp)q(e)h(of)f(the)g(v)m(ariable)i fi(matrixR)n(epr)f fl(in)h(class)e ff(Matr\ ix)g fl(to)g(b)q(e)h ff(MatrixRep)o(resentation)p fl(.)37 1110 y(The)k(result\ ing)g(inheritance)h(hierarc)o(hies)g(and)e(class)h(de\014nitions)h(are:)158 1168 y 25786450 4604723 6972866 25325977 32759316 29930700 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Bold %%Pages: 1 %%BoundingBox: 106 385 498 455 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.8 0 0 0.8 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 134.337 565.988 ] concat %I [ (Matrix) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 344.626 565.18 ] concat %I [ (MatrixRepresentation) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -79.1569 36.8674 ] concat %I 472 439 472 439 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 256.47 496.542 ] concat %I [ (TwoDimensionalArray) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 138.144 -70.4941 ] concat %I 155 626 155 626 Line End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1.08434 0 0 1.08434 -56.3855 117.108 ] concat %I 394 393 349 356 Line End Begin %I Pict %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 1 0 0 1 0 -2.16867 ] concat Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 441.132 497.952 ] concat %I [ (SparseMatrixRepresentation) ] Text End Begin %I Line %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ -0.180549 1.0692 -1.0692 -0.180549 956.311 195.01 ] concat %I 394 393 349 356 Line End End %I eop End %I eop showpage %%Trailer end endTexFig 157 1707 a fg(class)23 b(Matrix)228 1763 y({)228 1820 y(protec\ ted:)300 1876 y(MatrixRepresentation)e(*)j(matrixRepr;)228 1933 y(public:)300 1989 y(Matrix)f(\(int)g(numberOfRows,)f(int)i(numberOfColumns\))348 2045 y ({matrixRepr)e(=)i(new)f(TwoDimensionalArray\(numberOf)o(Rows,)1255 2102 y (numberOfColumns};)300 2158 y(Matrix)g(matrixMultiply)f(\(Matrix)h(anotherMat\ rix\))348 2215 y({)g(...)h(j=matrixRepr->get\(x,y\);)395 2271 y(...)g(matrixR\ epr->put\(k,x,y\);)d(...};)300 2328 y(void)i(rotate\(\))g({)h(...};)300 2384 y (Matrix)f(martixInverse\(\))f({)i(...};)228 2441 y(};)157 2554 y(class)f(Matr\ ixRepresentation)228 2610 y({)941 2760 y fl(115)g eop bop 228 42 a fg(protect\ ed:)300 98 y(int)23 b(columns,)g(rows;)228 154 y(public:)300 211 y(MatrixRepr\ esentation)e(\(int)i(numberOfRows,)825 267 y(int)g(numberOfColumns\);)300 324 y(virtual)g(int)g(get\(int)g(rowNumber,)g(int)g(columnNumber\))f(=)i(0;)300 380 y(virtual)f(int)g(put)h(\(int)f(newValue,)g(int)g(rowNumber,)706 437 y (int)g(columnNumber\))f(=)i(0;)228 493 y(};)157 606 y(class)f(TwoDimensionalA\ rray)e(:)j(public)f(MatrixRepresentation)228 663 y({)228 719 y(protected:)300 775 y(int)g(elements[400];)228 832 y(public:)300 888 y(TwoDimensionalArray)e (\(int)j(numberOfRows,)e(int)h(numberOfColumns\))372 945 y({)g(...)h(};)300 1001 y(int)f(get\(int)g(rowNumber,)g(int)g(columnNumber\))f({)i(...)g(};)300 1058 y(void)f(put)h(\(int)f(newValue,)g(rowNumber,)f(int)i(columnNumber\))372 1114 y({)f(...)h(};)228 1171 y(};)157 1284 y(class)f(SparseMatrixRepresentati\ on)d(:)k(MatrixRepresentation)228 1340 y({)228 1396 y(protected:)300 1453 y (sparseArrayElement)d(elements[50];)372 1509 y(/*)i(maximum)g(50)h(elements)e (for)i(this)f(sparse)g(representation;)443 1566 y(type)g(sparseArrayElement)f (defined)h(elsewhere)f(*/)300 1622 y(int)h(get\(int)g(rowNumber,)g(int)g(colu\ mnNumber\))f({)i(...)g(};)300 1679 y(void)f(put)h(\(int)f(newValue,)g(rowNumb\ er,)f(int)i(columnNumber\))372 1735 y({)f(...)h(};)228 1792 y(};)37 1953 y fl (As)16 b(a)f(result)g(of)g(these)g(refactorings:)106 2046 y fj(\017)22 b fl (the)15 b(mathematical)h(abstraction)f(is)g(separated)g(from)g(the)g(underlyi\ ng)i(represen)o(tation)106 2140 y fj(\017)22 b fl(the)15 b(program)e(de\014ne\ s)j(m)o(ultiple)g(represen)o(tations)f(for)f(Matrices,)g(making)h(explicit)i (their)e(common)151 2196 y(features.)25 b(This)17 b(structure)g(w)o(ould)g (mak)o(e)g(it)g(easier)g(to)g(extend)g(the)g(to)q(ol)g(with)g(additional)i (matrix)151 2253 y(represen)o(tations)c(in)h(the)g(future.)37 2396 y fd(9.3) 70 b(Summary)37 2497 y fl(This)19 b(c)o(hapter)f(describ)q(es)i(t)o(w)o(o)d (examples)i(of)e(ho)o(w)h(refactorings)g(can)g(b)q(e)h(in)o(tegrated.)28 b (The)18 b(\014rst)g(\()p fi(Menu)37 2554 y(Planning)p fl(\))e(example)i(demon\ strates)f(the)g(use)h(of)f(refactorings)g(de\014ned)i(in)f(c)o(hapters)f(six) h(and)f(sev)o(en)h(for)37 2610 y(sp)q(ecializi)q(ng)23 b(a)c(class)h(and)g (then)g(migrating)g(common)g(co)q(de)g(to)f(a)h(sup)q(erclass.)34 b(The)21 b (second)f(\()p fi(Matrix)p fl(\))941 2760 y(116)g eop bop 37 42 a fl(example) 21 b(demonstrates)e(the)g(use)h(of)g(refactorings)f(de\014ned)i(in)f(c)o(hapt\ ers)f(six)h(and)g(eigh)o(t)g(for)f(c)o(hanging)37 98 y(ho)o(w)13 b(an)f(in)o (terclass)i(relationship)g(is)g(mo)q(deled)g(\(from)e(inheritance)i(to)e(an)h (aggregation\).)18 b(These)13 b(examples)37 154 y(demonstrate)19 b(ho)o(w)g (refactorings)g(m)o(ust)g(b)q(e)h(applied)h(together)e(to)g(impro)o(v)o(e)g (the)g(design)i(of)e(a)g(to)q(ol)g(and)37 211 y(supp)q(ort)d(extensions.)108 267 y(Eac)o(h)e(refactoring)g(c)o(hec)o(ks)g(is)g(o)o(wn)g(preconditions)h (and)f(is)h(guaran)o(teed)f(to)f(preserv)o(e)h(program)f(b)q(eha)o(v-)37 324 y (ior.)26 b(Therefore,)17 b(it)g(is)g(safe)g(to)g(string)f(the)i(refactorings) e(together.)24 b(This)18 b(p)q(ermits)g(trying)f(out)f(di\013eren)o(t)37 380 y (sequences)h(of)e(refactorings,)f(and)h(encourages)g(design)i(exploration.) 108 437 y(It)e(is)g(exp)q(ected)h(that)e(when)h(a)g(designer)h(\014rst)e(uses) h(a)g(refactoring)f(to)q(ol,)g(they)h(will)i(man)o(ually)e(apply)h(a)37 493 y (small)g(sequence)g(of)e(refactorings)g(to)g(p)q(erform)g(limited)j(restructu\ ring)d(tasks.)19 b(As)c(the)f(designer)i(b)q(ecomes)37 550 y(more)g(sophistic\ ated,)g(more)f(complicated)i(sequences)g(of)e(refactorings)g(will)j(b)q(e)e (used;)g(for)f(a)g(small)i(set)e(of)37 606 y(frequen)o(tly)h(needed)h(tasks,) d(the)h(designer)h(will)h(de\014ne)f(higher-lev)o(el)i(refactorings)d(\(ala)g (macros\).)108 663 y(These)g(examples)f(demonstrate)g(ho)o(w)f(the)i(designer) g(and)f(the)g(to)q(ol)g(w)o(ork)f(together)h(in)h(impro)o(ving)f(the)37 719 y (design)g(of)d(a)h(program.)18 b(The)13 b(refactoring)e(to)q(ol)i(pro)o(vides) f(p)q(o)o(w)o(erful)h(supp)q(ort)f(in)h(p)q(erforming)g(precondition)37 775 y (c)o(hec)o(king)k(and)f(implemen)o(ting)i(the)e(c)o(hanges.)22 b(Ho)o(w)o(ev) o(er,)15 b(there)g(is)i(no)f(w)o(a)o(y)e(for)i(a)f(refactoring)h(to)q(ol)g (to)f(b)q(e)37 832 y(able)i(to)d(automatically)i(predict)g(what)f(c)o(hanges) g(the)h(designer)g(will)h(need)f(and)g(automatically)g(do)f(them.)37 888 y (Therefore,)g(the)g(role)h(of)f(the)g(designer)h(remains)g(imp)q(ortan)o(t.) 941 2760 y(117)g eop bop 37 353 a fc(Chapter)35 b(10)37 560 y fb(Related)42 b (Approac)m(hes)37 783 y fl(This)23 b(c)o(hapter)f(fo)q(cuses)h(on)f(sev)o(era\ l)g(areas)g(of)g(closely)h(related)g(w)o(ork.)40 b(In)23 b(prior)f(c)o(hapter\ s,)h(generally)37 839 y(related)17 b(w)o(ork)e(w)o(as)f(describ)q(ed)k(on)e (the)g(topics)g(of)f(soft)o(w)o(are)f(reuse,)i(soft)o(w)o(are)e(restructuring\ ,)i(application)37 896 y(framew)o(orks,)f(detecting)j(co)q(de)f(di\013erences\ ,)h(and)e(data)g(\015o)o(w)g(analysis.)25 b(This)17 b(c)o(hapter)g(discusses) g(sev)o(eral)37 952 y(approac)o(hes)22 b(for)g(supp)q(orting)g(go)q(o)q(d)g (ob)s(ject-orien)o(ted)g(design)h(st)o(yle)f(and)g(for)f(managing)h(ev)o(olut\ ion)h(of)37 1009 y(ob)s(ject-orien)o(ted)17 b(systems.)22 b(Also)16 b(describ) q(ed)i(is)f(some)f(recen)o(t)g(w)o(ork)f(on)h(restructuring)h(applied)h(to)d (areas)37 1065 y(other)g(than)g(ob)s(ject-orien)o(ted)h(systems.)37 1208 y fd (10.1)70 b(CR)n(C)22 b(Approac)n(h)i(to)g(Designing)d(Ob)t(ject-Orien)n(ted)f (Systems)37 1310 y fl(Wirfs-Bro)q(c)o(k,)c(Wilk)o(erson)h(and)f(Wiener)h([126) n(])f(describ)q(e)h(an)f(approac)o(h)g(to)f(Ob)s(ject-Orien)o(ted)i(Design)g (fo-)37 1366 y(cusing)23 b(on)e fi(classes)p fl(,)g(class)h fi(r)n(esp)n(onsi\ bilities)d fl(and)i(the)h fi(c)n(ol)r(lab)n(or)n(ations)e fl(among)g(classes.) 1605 1350 y fs(1)1664 1366 y fl(In)i(an)f(initial)37 1423 y(exploratory)e(pha\ se,)g(classes,)h(resp)q(onsibiliti)q(es)h(and)e(collab)q(orations)h(are)f(de\ \014ned.)32 b(In)19 b(the)g(subsequen)o(t)37 1479 y(analysis)g(phase,)e(syste\ ms)g(are)g(de\014ned,)i(collab)q(orations)f(simpli\014ed,)i(hierarc)o(hies)f (built)f(con)o(taining)g(ab-)37 1536 y(stract)d(and)g(concrete)g(classes,)h (and)f(ob)s(ject)g(proto)q(cols)g(are)g(de\014ned.)108 1592 y(While)20 b(this) e(approac)o(h)g(is)h(mainly)g(targeted)f(for)f(the)i(initial)h(task)d(analysi\ s)i(and)g(system)f(design,)h(it)37 1649 y(has)d(imp)q(ortan)o(t)e(implication\ s)k(on)d(refactoring.)108 1705 y(They)20 b(emphasize)g(the)g(need)g(for)f(ite\ rating)g(the)h(design)g(of)f(a)g(system)g fi(b)n(efor)n(e)h(it)g(is)f(built)p fl(.)33 b(This)20 b(of-)37 1761 y(ten)g(in)o(v)o(olv)o(es)h(some)f(restructur\ ing)g(\(on)f(pap)q(er\).)34 b(By)20 b(con)o(trast,)g(refactoring)f(supp)q(ort\ s)h(iteration)g(and)37 1818 y(restructuring)c fi(after)f fl(\(and)g fi(while) p fl(\))g(the)g(system)g(is)h(built.)108 1874 y(They)e(also)f(note)g(that)g (a)g(reusable)h(design)h(gro)o(ws)d(out)h(of)g(domain)g(analysis,)i(and)e(the) h(design)g(m)o(ust)f(b)q(e)37 1931 y(clear)i(in)g(order)f(to)f(b)q(e)i(reusab\ le.)21 b(Clarit)o(y)14 b(is)g(imp)q(ortan)o(t)g(not)g(only)g(b)q(efore)h(a)f (system)f(is)i(built,)g(but)g(during)37 1987 y(and)f(after)e(it)h(is)h(built.) 20 b(While)15 b(there)e(are)g(some)g(general)g(principles)j(for)c(impro)o(vin\ g)i(clarit)o(y)l(,)g(some)e(asp)q(ects)37 2044 y(of)18 b(clarit)o(y)h(are)f (dep)q(enden)o(t)i(on)e(the)h(application)h(and)e(the)h(designer.)30 b(Change\ s)18 b(o)q(ccur)h(o)o(v)o(er)f(time)g(b)q(oth)37 2100 y(to)g(the)g(designer's) h(understanding)g(of)f(an)g(application)i(and)f(in)g(most)e(cases)h(to)g(the) g(application)i(itself.)37 2157 y(Refactorings)c(can)f(assist)g(in)h(impro)o (ving)g(the)f(clarit)o(y)h(of)f(a)f(design,)i(in)g(ligh)o(t)g(of)f(these)g (c)o(hanges.)108 2213 y(Since)e(clarit)o(y)f(is)g(at)e(least)i(partly)f(sub)s (jectiv)o(e,)h(some)g(in)o(teraction)f(with)h(the)g(designer)g(is)g(needed)h (during)37 2270 y(refactoring.)20 b(The)14 b(clarit)o(y)g(of)f(a)h(design)h (can)e(b)q(e)i(compromised)f(if)h(refactorings)e(are)g(applied)j(\\blindly")g (to)37 2326 y(optimize)h(conformance)f(to)f(other)g(design)i(criteria,)f(suc) o(h)g(as)g(minimizing)i(program)d(size)i(or)e(minimizing)37 2383 y(access)h (to)e(v)m(ariables.)37 2455 y 750 2 v 89 2482 a fu(1)107 2497 y fp(Other)f (approac)o(hes)h(to)f(ob)r(ject-orien)o(ted)i(analysis)g(and)f(design)g(inclu\ de)i([21])c(and)i([36].)941 2760 y fl(118)g eop bop 37 42 a fd(10.2)70 b(Desi\ gning)22 b(Reusable)g(Classes)37 143 y fl(This)16 b(refactoring)e(researc)o (h)g(directly)i(builds)h(on)d(researc)o(h)h(done)g(at)f(the)g(Univ)o(ersit)o (y)i(of)e(Illinois)j(b)o(y)e(John-)37 199 y(son)i(and)f(F)l(o)q(ote)g(to)f (supp)q(ort)i(reusable)g(classes)g([59)o(].)23 b(T)l(o)16 b(impro)o(ving)h (the)f(design)h(of)f(an)g(ob)s(ject)g(orien)o(ted)37 256 y(system,)f(they)g (de\014ne)h(rules)g(of)e(th)o(um)o(bs)h(for)g(\014nding)h(standard)f(proto)q (cols,)f(abstract)g(classes)i(and)f(frame-)37 312 y(w)o(orks.)k(Related)c(to) e(proto)q(cols,)h(they)g(recommend)g(consisten)o(t)g(naming)h(of)e(related)i (functions,)f(replacing)37 369 y(case)21 b(analysis)f(with)h(sub)q(classing,) h(and)e(minimizing)j(the)d(size)h(of)e(metho)q(ds)i(and)f(n)o(um)o(b)q(er)g (of)g(function)37 425 y(argumen)o(ts.)k(Related)18 b(to)e(abstract)f(classes,) j(they)e(recommend)i(deep)f(and)g(narro)o(w)e(inheritance)k(hierar-)37 482 y (c)o(hies,)g(minimizing)h(direct)f(access)e(to)g(v)m(ariables,)i(and)f(using) h(sub)q(classing)g(for)e(sp)q(ecialization.)29 b(Related)37 538 y(to)18 b(fra\ mew)o(orks,)e(they)i(recommend)h(factoring)e(implemen)o(tation)i(di\013erence\ s)h(in)o(to)d(sub)q(comp)q(onen)o(ts,)i(s-)37 595 y(plitting)j(complicated)f (classes)f(and)g(structuring)g(the)g(function)h(call)g(hierarc)o(h)o(y)f(so)f (that)g(subfunctions)37 651 y(are)c(de\014ned)h(in)f(comp)q(onen)o(ts.)20 b (These)14 b(rules)i(of)e(th)o(um)o(b)g(are)g(based)h(mostly)f(on)g(exp)q(erie\ nces)j(in)e(Smalltalk)37 708 y(programming.)108 764 y(Johnson)k(and)f(F)l(o)q (ote)g(fo)q(cused)h(at)e(a)h(high)h(lev)o(el)g(on)g fi(what)f fl(ough)o(t)g (to)g(b)q(e)g(done,)h(while)h(this)f(researc)o(h)37 820 y(fo)q(cused)d(on)e fi (how)h fl(automated)e(supp)q(ort)i(could)g(b)q(e)g(pro)o(vided.)21 b(Their)15 b(w)o(ork)e(describ)q(ed)k(a)d(set)g(of)g(high)h(lev)o(el)37 877 y(guidelines) 21 b(that)c(can)g(b)q(e)i(applied)g(man)o(ually)f(\(or)f(p)q(ossibly)i(automa\ tically\))f(to)f(impro)o(v)o(e)g(design,)i(while)37 933 y(this)i(researc)o (h)f(precisely)j(sp)q(eci\014es)f(b)q(eha)o(vior)f(preserving)g(abstract)e (editing)i(op)q(erations)g(to)f(automate)37 990 y(design)c(re\014nemen)o(t.)k (F)l(or)15 b(example,)g(one)g(of)f(their)i(guidelines)h(is:)j fi(\\Split)c (lar)n(ge)f(classes.")k fl(This)d(guideline)37 1046 y(is)i(v)m(ague.)24 b(Thi\ s)18 b(thesis)f(de\014nes)h(sev)o(eral)e(w)o(a)o(ys)g(to)g(split)i(up)f(large) g(classes:)23 b(b)o(y)16 b(separating)h(abstractions)37 1103 y(in)o(to)d(abst\ ract)f(classes,)h(b)o(y)g(sp)q(ecializin)q(g)i(classes)e(using)h(sub)q(classi\ ng,)g(and)f(b)o(y)g(de\014ning)h(comp)q(onen)o(ts)f(and)37 1159 y(mo)o(ving)i (mem)o(b)q(ers)f(in)o(to)g(the)g(comp)q(onen)o(ts.)108 1216 y(This)20 b(resea\ rc)o(h)f(di\013ers)h(from)e(and)i(extends)g([59)o(])f(in)h(other)f(w)o(a)o (ys.)31 b(Their)20 b(pap)q(er)g(includes)i(a)d(set)g(of)37 1272 y(thirteen)d (heuristics;)g(this)g(researc)o(h)e(de\014nes)i(a)f(la)o(y)o(ered)g(taxonom)o (y)f(of)g(sev)o(eral)h(dozen)h(refactorings.)j(The)37 1329 y(refactoring)14 b (taxonom)o(y)e(made)i(clear)h(that)e(their)h(thirteen)h(rules)f(of)g(th)o(um) o(b)f(w)o(ere)h(not)f(distinct)i(but)f(in)o(ter-)37 1385 y(relate.)20 b(Tw)o (o)14 b(of)g(their)i(rules)f(are:)k fi(\\Sub)n(classes)14 b(should)i(b)n(e)g (sp)n(e)n(cializations.")i fl(and)d fi(\\Split)g(lar)n(ge)h(classes.")37 1441 y fl(\(the)d(latter,)f(also)h(men)o(tioned)h(ab)q(o)o(v)o(e\).)k(Chapter)12 b (sev)o(en)h(describ)q(es)i(an)d(approac)o(h)h(that)f(exploits)h(sub)q(class-) 37 1498 y(ing)i(for)f(sp)q(ecialization)i(in)f(splitting)g(large)g(classes.)k (This)c(researc)o(h)f(also)g(unco)o(v)o(ered)g(design)h(information)37 1554 y (that)g(w)o(as)f(needed)j(to)d(automate)g(refactorings,)h(and)g(considered)i (implemen)o(tation)f(issues.)108 1611 y(Johnson)11 b(and)f(F)l(o)q(ote)g(reco\ gnized)i(the)e(need)h(for)f(this)h(researc)o(h)f(in)h([59)o(])f(and)g(motiv)m (ated)h(its)f(imp)q(ortance.)37 1754 y fd(10.3)70 b(Ac)n(hieving)22 b(Go)r (o)r(d)h(St)n(yle)f(in)g(Smalltalk)f(Programs)37 1855 y fl(Ro)q(c)o(hat)h([98) o(])e(prop)q(oses)i(sev)o(eral)f(guidelines)j(for)c(ac)o(hieving)j(go)q(o)q (d)e(programming)f(st)o(yle)i(in)g(Smalltalk.)37 1912 y(Among)f(the)g(guideli\ nes:)34 b(Carefully)22 b(name)f(classes)g(and)g(class)g(mem)o(b)q(ers.)37 b (Eac)o(h)21 b(class)g(and)g(metho)q(d)37 1968 y(should)e(ha)o(v)o(e)f(a)g(sin\ gle)h(purp)q(ose;)g(m)o(ulti-purp)q(ose)h(classes)e(and)g(metho)q(ds)g(should) h(b)q(e)g(split.)29 b(Sub)q(classes)37 2025 y(should)13 b(b)q(e)f(re\014nemen) o(ts)g(\(in)g(proto)q(col)g(or)f(implemen)o(tation\))h(of)f(their)h(sup)q(erc\ lasses.)20 b(Nested)12 b(conditionals)37 2081 y(should)17 b(b)q(e)f(replaced) g(with)g(m)o(ultiple)h(classes)e(to)g(ac)o(hiev)o(e)h(p)q(olymorphism.)108 2138 y(Ro)q(c)o(hat)22 b(concludes)i([98)o(])e(that)g(organizational)g(to)q (ols)g(are)g(needed)i(to)d(supp)q(ort)i(these)f(guidelines.)37 2194 y(These) 17 b(guidelines)i(are)d(re\015ected)h(b)q(oth)f(in)h(the)f(supp)q(orting)h (refactorings)f(and)g(most)g(clearly)h(in)g(the)g(dis-)37 2251 y(cussion)g (of)d(sub)q(classing)j(in)f(c)o(hapter)f(sev)o(en)h(of)e(this)i(thesis.)37 2394 y fd(10.4)70 b(Demeter)21 b(Pro)t(ject)37 2495 y fl(Lieb)q(erherr)d(and) e(others)g(in)g(the)g(Demeter)g(pro)s(ject)f(at)g(Northeastern)h(Univ)o(ersit) o(y)g(ha)o(v)o(e)g(studied)h(ho)o(w)e(to)37 2552 y(impro)o(v)o(e)e(the)g(pro) q(ductivit)o(y)h(of)e(ob)s(ject-orien)o(ted)h(designers)g(and)g(programmers[7\ 1)n(,)f(69].)18 b(They)13 b(ha)o(v)o(e)g(pro-)37 2608 y(p)q(osed)h(rules)g (for)e(bringing)i(discipline)i(to)d(the)g(ob)s(ject)f(orien)o(ted)h(design)h (pro)q(cess)f(\(the)g(\\La)o(w)f(of)g(Demeter"\))941 2760 y(119)g eop bop 37 42 a fl(and)17 b(ha)o(v)o(e)f(dev)o(elop)q(ed)i(a)e(set)h(of)e(structures)i (and)f(to)q(ols,)g(whic)o(h)i(they)e(pac)o(k)m(age)h(as)f(the)g(Demeter)g(sys\ tem.)37 98 y(Their)i(st)o(yle)g(is)f(claimed)i(to)d(increase)j(information)e (hiding,)i(minimize)g(coupling)g(b)q(et)o(w)o(een)e(classes,)h(and)37 154 y (impro)o(v)o(e)13 b(main)o(tainabilit)o(y)h(and)e(comprehensibili)q(t)o(y)l (.)21 b(They)13 b(ha)o(v)o(e)f(dev)o(elop)q(ed)i(to)q(ols)e(to)g(c)o(hec)o (k)h(if)g(programs)37 211 y(conform)i(to)g(the)g(la)o(w.)108 267 y(There)g (are)g(some)f(shortcomings)g(to)h(the)f(Demeter)h(approac)o(h.)k(The)c(Demete\ r)g(researc)o(hers)f([72)o(])h(note)37 324 y(that)j(restructuring)g(a)f(progr\ am)g(to)g(mak)o(e)g(it)h(conform)f(with)h(their)h(\\la)o(w")e(can)h(require)g (increasing)h(the)37 380 y(n)o(um)o(b)q(er)g(of)e(metho)q(ds)h(and)g(metho)q (d)g(argumen)o(ts,)g(and)g(result)g(in)h(slo)o(w)o(er)e(execution)i(sp)q(eed) g(and)f(p)q(o)q(orer)37 437 y(readabilit)o(y)c(of)e(co)q(de.)19 b(Wirfs-Bro)q (c)o(k)13 b(and)f(Wilk)o(erson)h([125)o(])f(argue)g(that)g(the)g(la)o(w)g(o)o (v)o(erconstrains)g(the)g(con-)37 493 y(nections)17 b(b)q(et)o(w)o(een)f(ob)s (jects,)f(and)h(more)f(imp)q(ortan)o(tly)h(shifts)g(the)g(fo)q(cus)g(a)o(w)o (a)o(y)e(from)h(the)h(resp)q(onsibilit)o(y-)37 550 y(driv)o(en)22 b(asp)q(ect\ s)f(of)f(design)h(\(where)g(it)f(b)q(elongs\))i(to)o(w)o(ard)d(the)h(data-dri\ v)o(en)h(asp)q(ects.)36 b(Sakkinen)22 b([108)o(])37 606 y(discusses)17 b(othe\ r)e(problems)h(in)g(applying)g(the)f(La)o(w)g(of)g(Demeter.)108 663 y(Nonethe\ less,)f(the)f(Demeter)g(w)o(ork)e(is)j(an)f(imp)q(ortan)o(t)f(con)o(tribution) i(to)e(ob)s(ject-orien)o(ted)h(design)h(st)o(yle.)37 719 y(Abstraction)h(is)g (imp)q(ortan)o(t)f(in)h(impro)o(ving)g(the)f(main)o(tainabilit)o(y)j(of)d(ob) s(ject-orien)o(ted)g(systems.)19 b(A)c(refac-)37 775 y(toring)20 b(that)f(dir\ ectly)i(supp)q(orts)e(the)h(hiding)h(of)e(v)m(ariables,)j(in)e(line)h(with)f (the)g(Demeter)f(guidelines,)k(is)37 832 y fi(abstr)n(act)s 14 2 v 14 w(ac)n (c)n(ess)s 14 2 v 12 w(to)s 14 2 v 14 w(memb)n(er)s 14 2 v 14 w(variable)p fl (.)36 b(Another)21 b(w)o(a)o(y)e(to)h(b)q(etter)h(encapsulate)g(v)m(ariable)h (access)f(is)g(to)37 888 y(refactor)15 b(v)m(ariables)h(in)o(to)f(a)g(comp)q (onen)o(t)h(and)f(limit)i(access)e(to)f(the)i(comp)q(onen)o(t.)108 945 y(Anot\ her)f(imp)q(ortan)o(t)f(con)o(tribution)h(of)f(their)h(w)o(ork)f(is)h(in)g (de\014ning)h(structures)f(and)f(to)q(ols)h(for)f(ob)s(ject-)37 1001 y(orien) o(ted)23 b(design.)41 b(A)22 b fi(class)g(dictionary)g fl(de\014nes)h(classes\ ,)h(mem)o(b)q(ers)e(and)g(inheritance)i(relationships.)37 1058 y(Class)18 b (dictionaries)h(can)e(b)q(e)h(represen)o(ted)g(graphically)l(,)h(where)f(clas\ ses)g(and)f(mem)o(b)q(ers)h(are)f(represen)o(ted)37 1114 y(as)c(v)o(ertices,) h(inheritance)h(relationships)f(are)f(represen)o(ted)h(using)g fi(alternation) g(e)n(dges)p fl(,)e(and)h(class/mem)o(b)q(er)37 1171 y(relationships)18 b(are) e(represen)o(ted)g(using)h fi(c)n(onstruction)f(e)n(dges)p fl(.)21 b(There)c (are)e(to)q(ols)h(for)f(con)o(v)o(erting)h(b)q(et)o(w)o(een)37 1227 y(textual) g(and)g(graphical)g(represen)o(tations)g(of)f(class)h(dictionaries,)g(for)f (unco)o(v)o(ering)h(subgraphs)g(of)f(related)37 1284 y(ob)s(jects)g(called)h fi(pr)n(op)n(agation)g(p)n(atterns)p fl(,)e(and)h(for)g(generated)g(C++)g(sou\ rce)g(co)q(de)g(from)f(their)i(represen)o(ta-)37 1340 y(tions.)108 1396 y(Ber\ gstein)d([15)o(])g(de\014ned)h(a)e(set)h(of)f(ob)s(ject)g(preserving)i(class) f(transformations)e(that)h(can)h(b)q(e)g(applied)i(to)37 1453 y(class)i(dicti\ onary)f(graphs.)21 b(He)16 b(sho)o(ws)f(that)g(all)h(ob)s(ject)f(preserving)i (class)f(transformations)e(that)h(can)h(b)q(e)37 1509 y(p)q(erformed)c(on)f (class)g(dictionary)h(graphs)e(can)h(b)q(e)h(decomp)q(osed)g(in)o(to)f(a)f (small)i(set)f(of)f(primitiv)o(e)j(op)q(erations:)37 1566 y(adding)k(or)f(del\ eting)i(a)e(\\useless")g(alternation,)g(abstracting)g(or)g(distributing)h(com\ mon)f(parts)g(and)g(part)37 1622 y(replacemen)o(t.)k(These)11 b(c)o(hanges)g (corresp)q(ond)h(to)e(adding)i(or)e(deleting)j(an)e(unreferenced)i(class)e (as)g(a)f(sub)q(class)37 1679 y(of)16 b(an)h(existing)g(class,)g(migrating)f (mem)o(b)q(ers)h(up)f(or)g(do)o(wn)g(an)h(inheritance)h(hierarc)o(h)o(y)l(,)f (or)f(c)o(hanging)g(the)37 1735 y(t)o(yp)q(e)f(\(class\))f(of)g(a)g(mem)o(b)q (er.)19 b(Eac)o(h)c(of)e(these)i(c)o(hanges,)f(pro)o(vide)h(that)e(their)i (preconditions)h(are)e(met,)g(will)37 1792 y(preserv)o(e)f(existing)h(ob)s (jects;)f(that)f(is,)h(the)g(set)g(of)f(mem)o(b)q(ers)h(for)g(eac)o(h)f(ob)s (ject)h(will)h(b)q(e)g(unc)o(hanged)f(b)o(y)g(these)37 1848 y(transformations\ .)108 1905 y(These)i(op)q(erations)g(corresp)q(ond)f(to)g(some)g(of)g(the)h (supp)q(orting)g(refactorings)f(de\014ned)i(in)f(c)o(hapter)g(\014v)o(e,)37 1961 y(whic)o(h)i(are)e(frequen)o(tly)h(used)g(to)f(implemen)o(t)i(other)e (refactorings.)21 b(Ho)o(w)o(ev)o(er,)14 b(the)i(refactoring)f(approac)o(h)37 2017 y(o)o(v)o(erall)22 b(is)g(more)f(general)h(and)g(p)q(o)o(w)o(erful.)39 b (Refactorings)22 b(op)q(erations)f(that)g(cannot)g(b)q(e)h(expressed)h(in)37 2074 y(terms)17 b(of)f(these)h(transformations)e(include)k(abstracting)d(v)m (ariables,)i(mo)q(difying)g(functions)g(and)f(mo)o(ving)37 2130 y(mem)o(b)q (ers)k(b)q(et)o(w)o(een)f(comp)q(onen)o(t)h(and)f(aggregate)f(classes.)36 b (Abstracting)20 b(v)m(ariables)h(is)g(not)f(needed)i(in)37 2187 y(the)17 b (Demeter)f(system,)g(since)h(v)m(ariable)h(references)f(are)f(abstracted)g (in)h(the)g(co)q(de)g(generated)f(from)g(their)37 2243 y(represen)o(tations.) 26 b(F)l(unction)18 b(mo)q(di\014cations)g(are)f(not)g(supp)q(orted)g(b)q(eca\ use)h(the)f(data)g(dictionary)h(graph)37 2300 y(is)f(limited)g(to)e(supp)q (orting)i(data)e(mo)q(deling.)22 b(P)o(erhaps)16 b(the)g(most)e(imp)q(ortan)o (t)i(di\013erence)h(b)q(et)o(w)o(een)f(refac-)37 2356 y(torings)d(and)h(the)f (ob)s(ject)g(preserving)h(class)g(transformations)e(is)h(that)g(refactoring)g (can)g(c)o(hange)g(the)h(set)f(of)37 2413 y(mem)o(b)q(ers)k(in)g(a)f(class,)h (as)f(long)g(as)g(the)h(o)o(v)o(erall)f(b)q(eha)o(vior)h(of)f(the)g(program)f (is)i(preserv)o(ed.)24 b(This)17 b(p)q(ermits)37 2469 y(c)o(hanges)k(suc)o (h)g(as)f(mo)o(ving)h(mem)o(b)q(ers)g(b)q(et)o(w)o(een)g(comp)q(onen)o(t)g (and)g(aggregate)e(classes,)j(whic)o(h)f(are)g(not)37 2526 y(co)o(v)o(ered)16 b(in)g(Bergstein's)f(approac)o(h.)20 b(Extensions)c(to)f(Bergstein's)g(approa\ c)o(h)g(are)g(b)q(eing)i(in)o(v)o(estigated)f(b)o(y)37 2582 y(the)g(Demeter)f (researc)o(hers)g([70)o(].)941 2760 y(120)g eop bop 37 42 a fd(10.5)70 b(Reor\ ganizing)22 b(Generic)g(Applications:)28 b(Ithaca)37 143 y fl(As)20 b(part)e (of)h(the)g(ITHA)o(CA)g(\(Esprit)g(I)q(I\))h(pro)s(ject,)f(researc)o(h)g(b)o (y)g(Casais)g(at)f(the)i(Univ)o(ersit)o(y)f(of)g(Genev)m(a)37 199 y(in)o(v)o (estigated)14 b(approac)o(hes)f(to)f(supp)q(ort)h(the)g(ev)o(olution)h(of)f (a)g(generic)h(application,)g(whic)o(h)g(is)g(similar)g(to)f(an)37 256 y(appl\ ication)k(framew)o(ork.)i(As)c(with)g(Bergstein's)g(approac)o(h)g(describ)q (ed)i(ab)q(o)o(v)o(e,)e(Casais')f(fo)q(cus)h(w)o(as)g(up)q(on)37 312 y(inheri\ tance)i(related)f(c)o(hanges.)108 369 y(He)g(de\014nes)g(four)f(means)g(for)f (supp)q(orting)i(ev)o(olution)g([31)o(]:)106 463 y fj(\017)22 b fi(tailoring) p fl(,)17 b(where)h(the)g(existing)g(class)g(de\014nitions)h(are)e(not)g(dire\ ctly)i(mo)q(di\014ed,)g(but)f(adaptations)151 519 y(are)i(applied)j(to)c(inhe\ rited)k(prop)q(erties)e(when)g(deriving)h(new)e(sub)q(classes.)37 b(F)l(or)20 b(example,)i(when)151 576 y(in)o(tro)q(ducing)e(a)e(new)g(sub)q(class)h(a)f (function)h(inherited)i(from)c(its)i(sup)q(erclass)g(ma)o(y)e(b)q(e)i(o)o(v)o (erridden.)151 632 y(Or,)f(some)f(ob)s(ject-orien)o(ted)g(languages)g(allo)o (w)h(a)f(v)m(ariable)i(inherited)g(from)d(the)i(sup)q(erclass)g(to)f(b)q(e) 151 688 y(renamed)f(in)g(a)f(sub)q(class)h(b)q(e)g(retain)f(other)g(prop)q (erties.)106 782 y fj(\017)22 b fi(sur)n(gery)p fl(,)16 b(whic)o(h)h(are)g (structural)f(c)o(hanges)g(made)g(to)g(a)g(particular)h(class.)24 b(These)17 b (c)o(hanges)f(include)151 839 y(adding,)g(remo)o(ving)f(or)g(renaming)g(a)g (v)m(ariable)i(or)d(function,)i(or)f(c)o(hanging)g(the)h(t)o(yp)q(e)f(of)g (a)f(v)m(ariable.)106 933 y fj(\017)22 b fi(versioning)p fl(,)14 b(to)g(supp) q(ort)h(con\014guration)h(managemen)o(t)e(of)h(m)o(ulti-p)q(erson)i(pro)s(jec\ ts)106 1026 y fj(\017)22 b fi(r)n(e)n(or)n(ganization)p fl(,)17 b(whic)o(h)h (are)g(more)f(signi\014can)o(t)i(structural)e(c)o(hanges)h(whic)o(h)g(ma)o (y)f(in)o(v)o(olv)o(e)i(the)e(in-)151 1083 y(tro)q(duction)f(or)e(suppression) j(of)e(classes.)108 1177 y(Adding)20 b(a)f(new,)h(unreferenced)g(class)f(is)h (an)f(example)h(of)e(tailoring.)32 b(Man)o(y)18 b(refactorings,)i(suc)o(h)f (as)37 1233 y(adding)e(a)e(v)m(ariable)h(to)f(a)g(class,)g(are)g(examples)h (of)f(class)h(surgery)l(.)k(The)15 b(refactorings)g(that)g(mo)o(v)o(e)f(class\ es,)37 1290 y(and)i(the)f(three)g(higher)h(lev)o(el)h(refactorings,)d(are)h (examples)h(of)f(class)h(reorganization.)108 1346 y(Casais')h(researc)o(h)g (fo)q(cuses)h(on)g(the)f(\014nal)h(area)f(\(reorganization\).)27 b(His)18 b (approac)o(h)f(fo)q(cuses)h(on)f(reuse)37 1402 y(b)o(y)k(inheritance.)36 b (A)20 b(class)g(sp)q(eci\014cation)i(is)f(de\014ned)g(as)f(a)g(set)g(of)f(pro\ p)q(erties.)36 b(These)20 b(prop)q(erties)h(are)37 1459 y(either)16 b(inherit\ ed)g(or)e(lo)q(cally)i(in)o(tro)q(duced.)k(If)15 b(classes)g(or)f(class)g(\\p\ rop)q(erties")h(\(mem)o(b)q(ers\))f(are)g(arbitrarily)37 1515 y(added)19 b (to)e(a)g(class)h(hierarc)o(h)o(y)l(,)g(classes)g(migh)o(t)f(inherit)i(prop)q (erties)f(that)f(violate)h(their)g(sp)q(eci\014cation,)i(or)37 1572 y(prop)q (erties)f(ma)o(y)e(b)q(e)i(rein)o(tro)q(duced)g(that)e(could)i(ha)o(v)o(e)f (b)q(een)h(inherited)g(from)e(an)h(existing)h(class.)29 b(Lo)q(cal)37 1628 y (and)16 b(global)g(reorganization)g(strategies)f(are)g(in)o(tro)q(duced.)22 b (When)16 b(a)f(new)h(class)g(is)g(in)o(tro)q(duced,)g(lo)q(calized)37 1685 y (reorganizations)k(to)f(the)h(class)g(hierarc)o(h)o(y)g(can)g(b)q(e)h(applied) g(so)f(that)f(the)h(new)f(class)i(do)q(es)f(not)f(inherit)37 1741 y(prop)q (erties)d(that)e(are)h(rejected)g(in)g(b)o(y)g(sp)q(eci\014cation.)22 b(A)o (t)14 b(a)h(more)f(global)h(lev)o(el,)h(the)f(same)g(prop)q(ert)o(y)f(ma)o (y)37 1798 y(app)q(ear)f(in)g(t)o(w)o(o)e(otherwise)i(unrelated)g(classes.)20 b(T)l(o)12 b(a)o(v)o(oid)g(this)h(duplication,)i(the)d(inheritance)i(hierarc) o(hies)37 1854 y(are)k(globally)h(reorganized)f(in)g(a)g(w)o(a)o(y)f(that)f (the)i(shared)g(prop)q(ert)o(y)f(is)i(mo)o(v)o(ed)e(to)g(a)g(third)h(class)g (and)g(the)37 1911 y(t)o(w)o(o)c(classes)i(inherit)h(from)d(it.)108 1967 y (Eliminating)e(duplicated)h(prop)q(erties,)e(and)g(ensuring)g(that)f(the)h (inherited)h(b)q(eha)o(vior)f(of)f(a)g(class)h(do)q(esn't)37 2023 y(violate) 17 b(its)f(proto)q(col,)f(are)h(useful)g(design)h(goals.)k(Ho)o(w)o(ev)o(er,) 15 b(these)h(goals)f(do)h(not)f(alw)o(a)o(ys)g(con)o(tribute)h(to,)37 2080 y (and)11 b(can)g(sometimes)g(w)o(ork)f(coun)o(ter)g(to,)h(the)g(more)f(imp)q (ortan)o(t)g(\(alb)q(eit)i(less)f(rigorous\))f(goal)h(of)f(refactoring,)37 2136 y(whic)o(h)17 b(is)e(to)g fi(impr)n(ove)h(design)g(clarity)p fl(.)108 2193 y(Casais')f(strategies)h(sometimes,)g fi(but)h(not)g(always)p fl(,)f(wil\ l)h(pro)q(duce)g(what)f(the)g(programmer)e(in)o(tended.)37 2249 y(A)k(cen)o (tral)g(concept)h(of)e(application)j(framew)o(orks)c(is)i(that)f(eac)o(h)h (class)h(should)f(corresp)q(ond)h(to)e(a)g(mean-)37 2306 y(ingful)f(abstracti\ on.)j(Ho)o(w)o(ev)o(er,)13 b(the)i(reorganizations)f(noted)g(ab)q(o)o(v)o(e)g (can)g(in)o(tro)q(duce)h(classes)g(that)f(do)g(not)37 2362 y(necessarily)19 b (corresp)q(ond)e(to)f(meaningful)i(abstractions,)e(but)h(rather)g(are)f(neede\ d)i(to)e(mak)o(e)g(the)h(mec)o(ha-)37 2419 y(nism)h(w)o(ork.)23 b(Also,)17 b (there)f(is)h(hea)o(vy)g(use)g(made)f(of)g(m)o(ultiple)j(inheritance,)f(whic) o(h)f(can)g(mak)o(e)f(it)h(di\016cult)37 2475 y(to)e(understand)h(ho)o(w)f (inheritance)h(hierarc)o(hies)h(map)e(in)o(to)g(t)o(yp)q(e)g(sp)q(ecializatio\ n)j(hierarc)o(hies.)108 2532 y(Casais')g(researc)o(h)h(mak)o(es)f(imp)q(ortan) o(t)h(con)o(tributions)g(including)j(the)d(c)o(haracterization)g(of)f(c)o(han\ ges)37 2588 y(in)o(to)j(the)h(four)e(categories)h(listed)h(ab)q(o)o(v)o(e,)g (his)g(lo)q(cal)g(and)f(global)h(reorganization)f(strategies,)g(and)h(his)941 2760 y(121)g eop bop 37 42 a fl(ob)s(ject)15 b(mo)q(del.)20 b(Ho)o(w)o(ev)o (er,)14 b(as)g(he)i(notes)e(in)i([31)o(],)e(his)i(reorganization)f(algorithms) f(deal)i(exclusiv)o(ely)h(with)37 98 y(inheritance.)34 b(There)19 b(is)h(no)f (facilit)o(y)h(for)e(splitting)j(metho)q(ds,)e(restructuring)h(their)f(co)q (de,)h(or)f(c)o(hanging)37 154 y(the)i(clien)o(t/serv)o(er)h(relationship)g (b)q(et)o(w)o(een)f(classes.)37 b(These)22 b(areas)e(are)g(addressed)h(in)h (the)f(refactoring)37 211 y(researc)o(h,)g(as)f(Casais)g(cites)g(in)h([31)o (].)34 b(Splitting)22 b(and)e(restructuring)h(functions)f(is)h(co)o(v)o(ered) f(in)h(c)o(hapter)37 267 y(six.)k(In)17 b(c)o(hapter)g(eigh)o(t,)f(an)h(appro\ ac)o(h)f(is)h(describ)q(ed)i(for)d(replacing)h(inherited)i(b)q(eha)o(vior)e (with)g(b)q(eha)o(vior)37 324 y(delegated)g(to)d(\(pro)o(vided)i(b)o(y\))f (a)f(comp)q(onen)o(t.)37 466 y fd(10.6)70 b(Managing)25 b(Sc)n(hema)d(Ev)n (olution)g(in)h(an)g(OODB)37 567 y fl(W)l(ork)16 b(in)g(ob)s(ject-orien)o(ted) g(databases)f(\(OODBs\))h(has)f(b)q(een)i(motiv)m(ated)f(b)o(y)f(sev)o(eral)h (w)o(ell-kno)o(wn)h(short-)37 624 y(comings)h(of)f(more)g(con)o(v)o(en)o(tion\ al)g(database)g(tec)o(hnology)l(,)h(one)f(b)q(eing)h(that)f(the)g(structural) g(information)37 680 y(stored)e(in)i(a)e(database)f(sc)o(hema)i(cannot)f(natu\ rally)h(mo)q(del)g(frequen)o(tly)g(useful)g(seman)o(tic)g(concepts,)f(suc)o (h)37 736 y(as)e(generalization)h(and)f(aggregation)e(relationships.)21 b(Sc) o(hemas)12 b(ev)o(olv)o(e)h(o)o(v)o(er)f(time;)h(man)o(y)g(of)f(the)g(c)o(han\ ges)37 793 y(made)k(to)e(sc)o(hemas)h(in)h(OODBs)g(are)f(similar)h(to)f(refac\ torings.)108 849 y(Sc)o(hema)c(ev)o(olution)g(has)g(b)q(een)g(studied)h(for)e (sev)o(eral)h(OODB)g(systems,)g(most)f(notably)g(ORION)j([9)o(,)d(66].)1894 833 y fs(2)37 906 y fl(Just)16 b(as)f(with)g(refactoring,)g(the)g(metho)q(dol\ ogy)g(for)g(handling)i(sc)o(hema)e(c)o(hanges)g(has)g(included:)106 992 y fj (\017)22 b fl(dev)o(eloping)17 b(a)e(taxonom)o(y)f(of)g(c)o(hanges)106 1083 y fj(\017)22 b fl(de\014ning)17 b(a)e(set)g(of)f(prop)q(erties)i(that)f(m)o(ust) f(remain)i(in)o(v)m(arian)o(t)g(across)e(sc)o(hema)h(c)o(hanges)106 1174 y fj (\017)22 b fl(de\014ning)17 b(the)e(c)o(hanges)g(in)h(the)g(taxonom)o(y)d(in) k(a)d(w)o(a)o(y)h(that)f(preserv)o(es)h(these)h(prop)q(erties.)37 1261 y(.) 108 1317 y(In)d(the)g(ORION)h(system,)e(a)g(distinction)i(is)f(made)g(b)q(et) o(w)o(een)g fi(soft)f fl(c)o(hanges)g(\(those)g(that)g(do)h(not)f(require)37 1374 y(existing)g(instances)f(to)f(c)o(hange)g(their)h(classes\))f(and)h fi (har)n(d)g fl(c)o(hanges.)18 b(Examples)11 b(of)f(soft)f(c)o(hanges)i(are)f (adding)37 1430 y(or)h(renaming)g(an)g(en)o(tit)o(y)l(,)g(similar)h(to)e(some) h(supp)q(orting)g(refactorings.)18 b(An)11 b(in)o(teresting)g(hard)g(c)o(hang\ e)g(is)g(the)37 1487 y(partitioning)h(of)f(a)g(class)g(in)o(to)g(sev)o(eral)g (sub)q(classes.)20 b(One)12 b(t)o(yp)q(e)f(of)f(partitioning)i(is)g(horizon)o (tal)f(partitioning,)37 1543 y(a)i(database)g(selection)h(op)q(eration)f(whic) o(h)h(is)g(analogous)f(to)f(sp)q(ecializin)q(g)j(a)e(class)g(in)o(to)g(a)g (set)g(of)g(sub)q(classes.)37 1599 y(An)k(existing)g(instance)g(is)f(assigned) h(to)e(a)h(sub)q(class)h(if)f(it)h(satis\014es)f(a)f(\\partitioning)i(conditi\ on")g(whic)o(h)g(is)37 1656 y(a)i(kind)i(of)d(class)i(in)o(v)m(arian)o(t.)33 b (Another)19 b(t)o(yp)q(e)g(of)g(partitioning)h(is)g(a)f(v)o(ertical)g(partiti\ oning,)i(a)e(database)37 1712 y(pro)s(jection)f(op)q(eration)h(whic)o(h)g(is) f(analogous)g(to)g(simplifying)i(a)e(complex)h(aggregate)d(class)j(b)o(y)f (de\014ning)37 1769 y(comp)q(onen)o(ts)e(and)h(migrating)f(mem)o(b)q(ers)g (to)f(those)h(comp)q(onen)o(ts.)22 b(One)16 b(asp)q(ect)h(of)e(v)o(ertical)i (partitioning)37 1825 y(that)12 b(mak)o(es)g(it)g(di\013eren)o(t)h(from)e(mig\ rating)i(mem)o(b)q(ers)f(to)g(comp)q(onen)o(ts)g(is)h(that,)f(after)f(the)i (attributes)f(ha)o(v)o(e)37 1882 y(b)q(een)17 b(mo)o(v)o(ed)e(to)f(the)h(new) h(classes,)f(and)g(the)h(original)g(class)g(is)f(deleted.)108 1938 y(ORION)23 b(represen)o(ts)f(aggregations)e(as)h fi(c)n(omplex)h(obje)n(cts)p fl(.)38 b (A)21 b fi(c)n(omp)n(osite)h(link)e fl(represen)o(ts)i(a)f(rela-)37 1995 y (tionship)g(b)q(et)o(w)o(een)e(a)g(comp)q(osite)g(ob)s(ject)f(and)i(its)f(com\ p)q(onen)o(t.)31 b(A)19 b fi(c)n(omp)n(osite)g(link)f fl(can)h(carry)g(sp)q (ecial)37 2051 y(seman)o(tics,)14 b(suc)o(h)f(as)f(the)h(comp)q(onen)o(t)g (is)h(exclusiv)o(e)g(to)f(one)g(comp)q(osite)g(ob)s(ject.)19 b(This)13 b(noti\ on)g(of)g(exclusiv)o(e)37 2108 y(comp)q(onen)o(ts)j(w)o(as)e(applied)j(in)f (the)g(refactorings)e(describ)q(ed)j(in)f(c)o(hapter)f(sev)o(en.)108 2164 y (Not)20 b(surprisingly)l(,)k(the)d(fo)q(cus)g(of)g(researc)o(h)f(in)o(to)h (OODBs)h(has)e(b)q(een)i(on)f(altering)g(and)g(migrating)37 2221 y fi(data)14 b fl(\(mem)o(b)q(er)f(v)m(ariables\))i(with)e(less)h(emphasis)g(placed)g(up)q (on)g(mem)o(b)q(er)f(functions.)20 b(Ho)o(w)o(ev)o(er,)13 b(there)g(are)37 2277 y(facilities)i(in)f(ORION)h(to)d(detect)h(when)g(functions)h(\(metho)q (ds\))e(ha)o(v)o(e)g(b)q(een)i(in)o(v)m(alidated)h(b)q(ecause)f(the)f(data)37 2333 y(they)j(reference)g(has)f(b)q(een)h(altered)g(due)g(to)e(a)h(sc)o(hema) g(c)o(hange.)108 2390 y(Some)h(researc)o(h)f(in)o(to)g(OODBs)i(has)e(consider\ ed)i(v)o(ersioning)f(issues)h(and)e(m)o(ultiple)j(inheritance,)f(out-)37 2446 y(side)22 b(the)e(scop)q(e)h(of)g(this)f(refactoring)h(researc)o(h.)35 b(Con) o(v)o(ersely)l(,)22 b(OODB)f(researc)o(h)f(has)g(not)g(fo)q(cused)i(on)37 2522 y 750 2 v 89 2548 a fu(2)107 2564 y fp(Other)10 b(systems)i(include)h(Gemston\ e)e([92],)f fo(O)773 2568 y fu(2)801 2564 y fp(and)i(OTGen.)k(Casais)11 b([31\ ])g(compares)g(features)g(of)g(these)g(ob)r(ject-orien)o(ted)37 2610 y(databa\ se)k(systems)e(with)h(regard)f(to)g(sc)o(hema)h(ev)o(olution.)941 2760 y fl (122)g eop bop 37 42 a fl(sev)o(eral)14 b(topics)f(imp)q(ortan)o(t)g(in)h(ref\ actoring,)e(suc)o(h)i(as)e(simplifying)k(conditional)e(expressions)g(using)g (in)o(v)m(ari-)37 98 y(an)o(ts,)h(and)g(con)o(v)o(erting)g(an)g(asso)q(ciatio\ n)h(mo)q(deled)g(using)g(inheritance)h(in)o(to)e(an)h(aggregation.)37 241 y fd (10.7)70 b(Program)24 b(T)-6 b(ransformations)37 342 y fl(Refactorings)18 b (supp)q(ort)g(c)o(hange)f(b)o(y)g(p)q(erforming)h(a)f(t)o(yp)q(e)g(of)g(progr\ am)g(transformation.)25 b(Researc)o(h)17 b(in)o(to)37 399 y(more)h(am)o(bitio\ us)g(forms)f(of)g(program)g(transformations)f(and)i(automatic)f(programming)g (has)h(b)q(een)h(un-)37 455 y(derw)o(a)o(y)f(for)f(o)o(v)o(er)g(15)g(y)o(ears\ .)28 b(Early)18 b(w)o(ork)f(in)h(this)h(area)e(w)o(as)g(done)h(b)o(y)g(Bursta\ ll)h(and)f(Darlington)g([27)o(];)37 512 y(extensiv)o(e)f(w)o(ork)d(has)h(b)q (een)i(done)e(b)o(y)g(Balzer)i(and)e(others)g(at)g(USC/ISI)h([8)o(],)f(includ\ ing)j(recen)o(t)d(w)o(ork)f(in)o(to)37 568 y(building)k(an)d(ev)o(olution)h (transformation)e(library[61].)108 624 y(This)k(w)o(ork)e(has)h(fo)q(cused)g (on)g(the)h(pro)q(cess)f(of)f(con)o(v)o(erting)h(a)g(formal)g(sp)q(eci\014cat\ ion)i(in)o(to)e(an)g(e\016cien)o(t)37 681 y(implemen)o(tation.)22 b(Examples) 15 b(of)g(b)q(eha)o(vior)h(preserving)g(transformations)e(are:)106 772 y fj (\017)22 b fi(folding)d(and)h(unfolding)p fl(.)31 b(F)l(olding)20 b(replaces) g(a)f(co)q(de)g(segmen)o(t)g(with)h(a)e(function)i(call;)i(unfolding)151 829 y (inline)c(expands)e(a)f(function)h(call.)21 b(There)15 b(are)g(refactorings)g (for)f(eac)o(h)h(of)g(these)h(op)q(erations.)106 922 y fj(\017)22 b fi(abstr) n(action)p fl(.)28 b(Abstraction)18 b(substitutes)g(a)g(v)m(ariable)h(for)f (ev)o(ery)g(instance)h(of)e(an)h(expression,)h(and)151 978 y(de\014nes)c(that) e(v)m(ariable)i(to)e(b)q(e)h(the)g(v)m(alue)h(of)e(that)g(expression.)20 b (This)14 b(transformation)e(did)j(not)e(arise)151 1034 y(in)i(the)f(refactori\ ng)f(researc)o(h,)h(although)g(there)g(are)f(analogous)h(refactorings)f(to)g (create)h(a)g(function)151 1091 y(whose)h(b)q(o)q(dy)h(is)g(an)f(expression,) h(and)f(con)o(v)o(ert)g(an)g(expression)h(to)e(a)h(function)h(call.)106 1184 y fj(\017)22 b fi(splitting)15 b(typ)n(e)p fl(.)20 b(This)c(is)f(a)g(transforma\ tion)f(that)g(splits)i(a)f(t)o(yp)q(e)g(in)o(to)g(subt)o(yp)q(es,)g(analogous) g(to)f(the)151 1240 y(refactoring)h(that)f(sp)q(ecializes)k(a)d(class)h(b)o (y)f(de\014ning)i(sub)q(classes.)106 1333 y fj(\017)22 b fi(bubble)15 b(up)p fl(.)k(This)c(transformation)d(mo)o(v)o(es)h(a)g(function)h(out)g(of)f(an)g (enclosing)i(mo)q(dule)g(and)f(expands)151 1390 y(its)i(scop)q(e.)23 b(Refact\ oring)17 b(can)f(expand)h(the)f(scop)q(e)g(of)g(a)g(function)h(b)o(y)f(c)o (hanging)g(its)h(access)f(con)o(trol)151 1446 y(mo)q(de)g(or)e(b)o(y)h(mo)o (ving)h(it)f(to)g(a)f(sup)q(erclass)j(or)d(to)h(a)g(comp)q(onen)o(t)g(class.) 108 1537 y(Since)h(program)d(transformation)h(systems)g(b)q(egin)h(with)g(a)g (formal)f(sp)q(eci\014cation)i(rather)e(than)g(source)37 1594 y(co)q(de,)g (they)f(can)h(b)o(y)f(construction)g(a)o(v)o(oid)g(some)g(of)f(the)i(co)q(de) f(lev)o(el)i(complexities)g(and)e(dep)q(endencies)j(that)37 1650 y(can)g(mak) o(e)e(refactoring)h(source)g(co)q(de)h(di\016cult.)21 b(On)16 b(the)f(other)g (hand,)g(it)g(is)h(di\016cult)h(to)d(correctly)h(de\014ne)37 1707 y(the)f(inp\ ut)h(to)e(these)h(systems.)19 b(As)14 b(Balzer)h(notes)e(in)i([8)o(],)e(one)h (of)g(the)g(c)o(hief)g(failures)h(in)g(program)e(transfor-)37 1763 y(mation)h (systems)g(has)g(b)q(een)h(the)f(unreadabilit)o(y)i(of)e(their)g(sp)q(eci\014\ cation)i(languages.)k(It)14 b(has)g(tak)o(en)g(a)g(high)37 1820 y(lev)o(el)k (of)d(user)h(sophistication,)h(b)q(oth)f(in)h(the)f(application)i(domain)e (and)g(in)h(the)f(domain)g(of)g(sp)q(eci\014cation)37 1876 y(languages)g(and) f(transformations,)f(to)g(apply)i(man)o(y)f(automatic)g(programming)f(approac) o(hes.)108 1933 y(Refactorings)i(are)g(a)f(t)o(yp)q(e)h(of)g(program)f(transf\ ormation,)f(but)i(with)h(an)f(imp)q(ortan)o(t)f(di\013erence)i(from)37 1989 y (man)o(y)11 b(past)f(transformational)g(approac)o(hes.)18 b(Those)11 b(approa\ c)o(hes)g(usually)h(assumed)f(a)f(top)h(do)o(wn)g(pro)q(cess,)37 2045 y(going) 16 b(from)f(a)g(formal,)f(abstract)h(sp)q(eci\014cation)i(to)e(an)g(implemen) o(tation.)22 b(In)16 b(con)o(trast,)e(refactorings)h(are)37 2102 y(lo)o(w)o (er)i(lev)o(el,)g(systematic,)f(and)h(are)f(less)h(dep)q(enden)o(t)h(on)f(the) f(seman)o(tics)h(of)f(a)g(program.)22 b(The)17 b(idea)g(is)g(to)37 2158 y(rai\ se)f(program)e(editing)j(to)d(a)h(higher)h(lev)o(el,)g(not)f(to)g(build)i(a)e (design)h(language.)108 2215 y(Refactorings)i(do)f(not)h(force)f(up)q(on)h (a)f(designer)i(a)e(rigid,)i(top)e(do)o(wn)g(design)i(st)o(yle.)27 b(Exp)q (erience)20 b(has)37 2271 y(sho)o(wn)13 b(that)g(the)g(dev)o(elopmen)o(t)h (of)e(a)h(large)g(soft)o(w)o(are)f(program)g(do)q(es)h(not)g(pro)q(ceed)h(in) g(a)f(purely)h(top)f(do)o(wn)37 2328 y(manner)f([38)o(,)g(89)o(].)18 b(Soft)o (w)o(are)10 b(design)j(is)f(in)h(man)o(y)e(w)o(a)o(ys)f(an)i(informal)g(pro)q (cess)g([63)o(].)19 b(Refactorings)11 b(supp)q(ort)37 2384 y(iterativ)o(e)21 b (conceptual)g(shifts.)34 b(F)l(or)20 b(example,)h(the)g(refactoring)e(that)g (de\014nes)i(an)f(abstract)f(sup)q(erclass)37 2441 y(generates)c(a)g(common)f (design)i(abstraction)f(from)f(lo)o(w-lev)o(el)j(implemen)o(tation;)f(this)f (design)h(abstraction)37 2497 y(can)i(then)g(b)q(e)g(used)g(for)f(further)g (lo)o(w)g(lev)o(el)i(implemen)o(tation.)28 b(Refactorings)17 b(shield)i(the)f (designer)g(from)37 2554 y(man)o(y)12 b(of)g(the)h(lo)o(w)o(est)f(lev)o(el)h (implemen)o(tation)h(details)f(regarding)g(program)e(restructuring,)i(and)f (can)h(mak)o(e)37 2610 y(it)23 b(easier)f(to)f(shift)h(b)q(et)o(w)o(een)g(hig\ h)h(lev)o(el)g(design)g(and)f(implemen)o(tation.)40 b(F)l(urthermore,)23 b (refactorings)941 2760 y(123)g eop bop 37 42 a fl(supp)q(ort)23 b(design)f (without)g(requiring)h(the)g(designer)f(to)g(b)q(e)g(pro\014cien)o(t)h(in)g (writing)f(abstract,)g(st)o(ylized)37 98 y(formal)15 b(sp)q(eci\014cations.) 108 154 y(One)22 b(imp)q(ortan)o(t)f(insigh)o(t)h(gained)h(from)d(researc)o (h)i(in)o(to)f(program)f(transformations)g(is)i(that)f(while)37 211 y(man)o (y)g(systems)g(started)g(out)g(with)h(the)f(goal)g(of)g(fully)i(automating)e (the)g(transformation)f(pro)q(cess,)j(it)37 267 y(b)q(ecame)17 b(ob)o(vious)g (that)e(in)i(handling)h(non-trivial)f(programs)e(a)h(transformation)f(system) h(required)h(some)37 324 y(in)o(teraction)f(with)g(the)f(user.)20 b(A)15 b (similar)i(insigh)o(t)f(has)f(b)q(een)h(gained)g(from)e(the)i(refactoring)e (researc)o(h.)37 446 y fe(10.7.1)56 b(T)-5 b(ransforming)18 b(Blo)r(c)n(k)f (Structured)h(Languages)37 531 y fl(Grisw)o(old)c([52)o(])f(in)o(v)o(estigate\ d)h(meaning)g(preserving)h(transformations)d(to)h(restructure)g(programs)f (written)37 588 y(in)17 b(a)f(blo)q(c)o(k-structured)h(programming)e(language\ ,)h(to)g(mak)o(e)f(main)o(taining)i(suc)o(h)g(programs)d(easier.)23 b(The)37 644 y(language)18 b(analyzed)g(in)f(this)h(researc)o(h)f(w)o(as)f(Sc)o(heme.) 26 b(F)l(rom)16 b(the)h(program)f(source,)h(a)g(program)f(dep)q(en-)37 701 y (dency)e(graph)e(is)h(created.)19 b(A)12 b(set)g(of)g(meaning)h(preserving)g (graph)g(transformation)e(rules,)i(similar)h(to)d(lo)q(cal)37 757 y(compiler) 20 b(optimizations,)g(are)e(de\014ned)i(for)e(manipulating)i(statemen)o(ts)d (within)j(a)e(blo)q(c)o(k.)31 b(These)19 b(rules)37 814 y(include,)f(for)c (example:)106 907 y fj(\017)22 b fl(renaming)16 b(a)f(lo)q(cal)h(v)m(ariable) 106 1001 y fj(\017)22 b fl(adding)16 b(a)f(new)g(v)m(ariable)i(to)e(store)f (an)h(in)o(termediate)h(result)106 1095 y fj(\017)22 b fl(replacing)17 b(an)f (expression)h(with)g(an)f(equiv)m(alen)o(t)h(expression)g(\(suc)o(h)f(as)g (a)f(v)m(ariable,)j(if)e(the)g(v)m(ariable)151 1151 y(has)d(previously)h(b)q (een)g(assigned)g(the)f(v)m(alue)h(of)f(the)g(expression,)h(or)e(a)h(function) h(call,)g(if)g(the)f(function)151 1208 y(b)q(o)q(dy)j(is)g(equiv)m(alen)o(t)h (to)d(the)h(expression)i(it)e(replaces\))106 1302 y fj(\017)22 b fl(con)o(v)o (erting)15 b(a)g(scaler)h(in)o(to)f(some)g(nested)g(structure)g(\(suc)o(h)h (as)e(an)i(arra)o(y)e(or)g(record\),)106 1396 y fj(\017)22 b fl(mo)o(ving)15 b (an)g(assignmen)o(t)g(in)o(to)h(and)f(out)g(of)g(a)f(conditional)j(blo)q(c)o (k.)108 1489 y(Lik)o(e)11 b(the)f(refactoring)g(researc)o(h,)h(his)g(researc) o(h)f(in)o(v)o(estigated)g(source)g(to)g(source)g(program)f(restructuring)37 1546 y(to)20 b(aid)h(soft)o(w)o(are)d(main)o(tenance.)35 b(Ho)o(w)o(ev)o(er,) 20 b(his)h(w)o(ork)e([52)o(])h(fo)q(cused)h(on)f(transforming)f(the)h(syn)o (tactic)37 1602 y(constructs)e(of)f(a)g(blo)q(c)o(k-structured)i(language;)g (his)f(fo)q(cus)g(w)o(as)f(not)h(on)f(transformations)g(in)o(v)o(olving)h(in-) 37 1659 y(heritance)h(or)f(a)g(t)o(yp)q(e)g(hierarc)o(h)o(y)l(.)28 b(In)19 b ([52)o(])f(he)g(cites)h(our)e(refactoring)h(researc)o(h)g(and)g(discusses)h (ho)o(w)f(his)37 1715 y(approac)o(h)j(migh)o(t)h(b)q(e)f(applied)j(for)c(ob)s (ject-orien)o(ted)i(systems.)37 b(He)22 b(notes)f(sev)o(eral)g(complexities)i (that)37 1772 y(inheritance)d(causes)e(in)h(program)e(analysis)h(and)g(transf\ ormation;)g(these)g(complexities)h(are)f(dealt)g(with)37 1828 y(more)d(fully) i(in)f(the)f(prior)g(c)o(hapters)g(of)g(this)h(\(refactoring\))e(thesis.)108 1885 y(His)i(use)f(of)g(program)f(dep)q(endency)k(graphs)c(and)i(\015o)o(w)e (la)o(ws)h(for)g(describing)i(source)e(to)g(source)g(trans-)37 1941 y(formati\ ons)h(is)i(an)e(imp)q(ortan)o(t)g(con)o(tribution.)25 b(One)18 b(reason)e(wh) o(y)h(he)g(c)o(ho)q(ose)f(Sc)o(heme)i(as)e(a)g(language)h(to)37 1997 y(analyz\ e)e(w)o(as)d(b)q(ecause)j(a)e(to)q(ol)h(w)o(as)e(a)o(v)m(ailable)j(for)e(gene\ rating)h(and)g(manipulating)h(program)d(dep)q(endency)37 2054 y(graphs.)24 b (A)17 b(area)f(for)g(future)h(researc)o(h)f(w)o(ould)h(b)q(e)g(to)f(dev)o(elo\ p)i(and)f(in)o(v)o(estigate)f(the)h(use)g(of)f(suc)o(h)h(a)f(to)q(ol)37 2110 y (for)f(refactoring)g(ob)s(ject)f(orien)o(ted)i(programs.)37 2254 y fd(10.8)70 b(Summary)37 2355 y fl(This)21 b(c)o(hapter)e(fo)q(cuses)h(on)f(sev)o(eral)h (areas)f(of)g(researc)o(h)g(closely)i(related)f(to)f(refactoring.)32 b(These) 20 b(areas)37 2412 y(ha)o(v)o(e)c(included)i(supp)q(orting)e(go)q(o)q(d)g(ob) s(ject-orien)o(ted)g(design)g(st)o(yle,)g(managing)f(the)h(ev)o(olution)h(of) e(ob)s(ject-)37 2468 y(orien)o(ted)h(systems,)e(and)i(restructuring)f(applied) i(to)e(areas)f(other)h(than)g(ob)s(ject-orien)o(ted)h(systems.)941 2760 y(124) g eop bop 37 353 a fc(Chapter)35 b(11)37 560 y fb(Conclusions)37 801 y fd(11.\ 1)70 b(Summary)23 b(of)h(Con)n(tributions)37 903 y fl(This)12 b(thesis)f(de\ \014nes)h(a)f(set)g(of)f(program)g(restructuring)h(op)q(erations)g(\(refactor\ ings\))f(sp)q(eci\014c)i(to)f(supp)q(orting)37 959 y(the)21 b(design,)g(ev)o (olution)g(and)f(reuse)h(of)e(ob)s(ject-orien)o(ted)h(application)i(framew)o (orks.)33 b(It)20 b(mak)o(es)f(sev)o(eral)37 1016 y(imp)q(ortan)o(t)c(con)o (tributions:)93 1104 y(1.)22 b(It)d(iden)o(ti\014es)i(a)e(set)f(of)h(program) f(restructurings)h(\(refactorings\))f(that)g(p)q(eople)j(apply)e(to)g(ob)s (ject-)151 1160 y(orien)o(ted)d(application)h(framew)o(orks.)93 1252 y(2.)22 b (It)16 b(sho)o(ws)f(ho)o(w)g(to)f(automatically)i(supp)q(ort)g(refactorings)f (in)h(a)g(w)o(a)o(y)e(that)h(preserv)o(es)g(the)h(b)q(eha)o(vior)151 1308 y (of)e(a)f(program.)19 b(Most)13 b(of)g(the)h(refactorings)g(are)g(simple)h (to)e(implemen)o(t)j(and)e(it)g(is)h(almost)e(trivial)i(to)151 1365 y(sho)o (w)g(that)g(they)h(are)f(b)q(eha)o(vior)h(preserving.)21 b(A)16 b(small)g(set) g(of)f(refactorings)g(are)g(m)o(uc)o(h)g(more)h(com-)151 1421 y(plicated.)21 b (A)13 b(la)o(y)o(ered)h(hierarc)o(h)o(y)g(of)f(refactorings)g(w)o(as)g(de\014\ ned)h(to)f(help)i(deal)f(with)g(the)g(complexit)o(y)151 1478 y(of)h(the)g(ref\ actoring)g(pro)q(cess.)93 1570 y(3.)22 b(It)c(de\014nes)h(in)g(detail)g(three) f(of)f(the)h(most)f(complex)i(refactorings:)25 b(generalizing)20 b(the)e(inhe\ ritance)151 1626 y(hierarc)o(h)o(y)l(,)25 b(sp)q(ecializing)h(the)c(inheritan\ ce)j(hierarc)o(h)o(y)e(and)g(using)g(aggregations)f(to)g(mo)q(del)h(the)151 1682 y(relationships)d(among)e(classes.)30 b(It)18 b(decomp)q(oses)h(these)g (op)q(erations)f(in)o(to)h(more)f(primitiv)o(e)h(parts,)151 1739 y(and)d(disc\ usses)h(the)f(p)q(o)o(w)o(er)f(of)h(these)g(op)q(erations)g(from)f(the)h(p)q (ersp)q(ectiv)o(es)h(of)f(automatabilit)o(y)f(and)151 1795 y(usefulness)i(in) f(supp)q(orting)g(design.)93 1887 y(4.)22 b(It)15 b(de\014nes)h(design)f(cons\ train)o(ts)g(needed)h(in)f(refactoring,)f(sp)q(eci\014cally)k(class)d(in)o (v)m(arian)o(ts)g(and)g(exclu-)151 1943 y(siv)o(e)c(comp)q(onen)o(ts.)19 b (These)11 b(constrain)o(ts)f(are)h(needed)h(to)e(ensure)h(b)q(eha)o(vior)g (is)h(preserv)o(ed)f(across)f(some)151 2000 y(refactorings.)29 b(The)18 b(the\ sis)h(discusses)h(ho)o(w)d(to)h(analyze)h(a)f(program)f(to)h(determine)h(if)g (it)f(satis\014es)151 2056 y(these)e(constrain)o(ts,)e(and)h(ho)o(w)g(to)g (use)g(this)h(design)g(information)f(to)g(refactor)f(a)h(program.)37 2199 y fd (11.2)70 b(Limitations)21 b(of)i(Approac)n(h)37 2300 y fl(There)16 b(are)f (sev)o(eral)g(limitations)i(of)d(this)i(approac)o(h:)93 2388 y(1.)22 b(It)13 b (requires)g(b)q(eha)o(vior)g(preserv)m(ation)g(at)f(ev)o(ery)h(step.)19 b(The\ re)13 b(are)f(cases)h(where)f(states)g(of)g(temp)q(orary)151 2445 y(inconsist\ ency)h(migh)o(t)d(b)q(e)h(desirable,)i(for)d(example)i(when)f(replacing)h(one) f(algorithm)g(with)g(another.)1894 2428 y fs(1)37 2522 y 750 2 v 89 2548 a fu (1)107 2564 y fp(Refactorings)j(can,)g(ho)o(w)o(ev)o(er,)f(b)q(e)h(applied)h (to)e(lo)q(calize)j(b)q(eha)o(vior)f(within)g(a)e(class)h(or)f(small)i(set)e (of)g(classes)i(and)f(thereb)o(y)37 2610 y(b)q(etter)g(encapsulate)h(suc)o (h)f(c)o(hanges.)941 2760 y fl(125)g eop bop 93 42 a fl(2.)22 b(The)c(descrip\ tion)h(of)e(refactoring)g(in)h(this)g(thesis)g(is)g(limited)i(b)o(y)d(the)h (features)f(in)h(the)g(underlying)151 98 y(programming)12 b(language)h(b)q (eing)h(refactored.)k(The)13 b(strict)f(inheritance)j(relationship)f(among)e (t)o(yp)q(es,)151 154 y(a)j(feature)f(of)h fi(C++,)f fl(limits)i(t)o(yp)q(e)f (substitution,)g(generalizing)i(and)e(sp)q(ecializing.)23 b(Multiple)16 b(inh\ er-)151 211 y(itance)j(is)g(not)f(incorp)q(orated)h(in)o(to)g(the)f(refactori\ ng)g(approac)o(h)h(de\014ned)g(here,)h(nor)e(are)g(language)151 267 y(feature\ s)d(suc)o(h)g(as)g(automatic)g(t)o(yp)q(e)g(con)o(v)o(ersion)h(\(casts)e(in)i fi(C++)p fl(\).)93 361 y(3.)22 b(The)15 b(p)q(o)o(w)o(er)f(of)g(this)h(approa\ c)o(h)f(is)h(also)g(limited)h(b)o(y)f(the)f(program)g(analysis)h(tec)o(hnique\ s)h(used.)k(The)151 418 y(undecidabili)q(t)o(y)k(of)d(the)h(basic)g(problem)g fi(r)n(e)n(quir)n(es)f fl(that)g(an)o(y)g(`solution')g(b)q(e)i(conserv)m(ativ) o(e.)39 b(The)151 474 y(algorithms)21 b(presen)o(ted)g(in)h(this)f(thesis)g (can)g(almost)f(certainly)i(b)q(e)g(impro)o(v)o(ed)f(up)q(on.)37 b(Ho)o(w)o (ev)o(er,)151 531 y(an)21 b(impro)o(v)o(ed)f(solution)i(will)g(still)g(b)q (e)f(conserv)m(ativ)o(e;)i(there)e(will)h(still)g(b)q(e)g(cases)e(in)h(whic)o (h)h(v)m(alid)151 587 y(refactorings)15 b(will)i(b)q(e)f(disallo)o(w)o(ed.)93 681 y(4.)22 b(The)11 b(practical)h(utilit)o(y)h(of)d(this)i(approac)o(h)e(is) i(not)f(kno)o(wn.)18 b(A)11 b(v)m(aluable)i(con)o(tribution)f(could)g(b)q(e)f (made)151 737 y(b)o(y)k(soft)o(w)o(are)f(engineering)j(studies)g(of)e(refacto\ ring)g(large)g(programs)f(written)i(in)g(sev)o(eral)g(practical)151 794 y(\(a\ lb)q(eit)22 b(complicated\))h(languages)e(with)h(sev)o(eral)f(di\013eren)o (t)g(programming)g(st)o(yles.)38 b(Automated)151 850 y(refactoring)14 b(shoul\ d)h(probably)g(b)q(e)f(most)g(v)m(aluable)i(when)e(applied)i(to)e(large)g(pro\ grams,)f(but)h(global)151 907 y(program)g(analysis)i(ma)o(y)f(b)q(e)h(exp)q (ensiv)o(e)g(when)g(applied)h(to)e(these)g(programs.)37 1050 y fd(11.3)70 b (Implemen)n(tation)20 b(Considerations)37 1151 y fl(Exp)q(erimen)o(tal)14 b (researc)o(h)e(is)h(needed,)h(studying)f(the)g(role)g(of)f(refactoring)g(in)h (large,)f(m)o(ulti-p)q(erson)i(soft)o(w)o(are)37 1208 y(dev)o(elopmen)o(ts.) 20 b(Soft)o(w)o(are)12 b(pro)q(cess)i(studies)g(are)f(needed,)h(to)f(b)q(ette\ r)g(understand)h(the)f(role)h(of)f(refactoring)37 1264 y(in)k(concept)e(proto\ t)o(yping,)f(design)j(re\014nemen)o(t,)e(implemen)o(tation)h(and)g(main)o(ten\ ance)g(tasks.)108 1321 y(This)e(section)g(discusses)h(some)f(of)f(the)h(issue\ s)g(that)f(w)o(ould)h(arise)g(in)g(implemen)o(ting)i(a)d(practical)i(refac-) 37 1377 y(toring)i(system.)22 b(This)17 b(discussion)h(is)f(based)f(on)g(less\ ons)h(learned)g(from)f(the)g(protot)o(yp)q(e)g(built)h(as)f(part)g(of)37 1434 y(this)g(researc)o(h.)108 1490 y(A)h(practical)g(refactoring)f(system)g(w)o (ould)h(ha)o(v)o(e)f(sev)o(eral)g(requiremen)o(ts.)25 b(Since)18 b(refactorin\ gs)e(are)g fi(b)n(e-)37 1546 y(havior)e(pr)n(eserving)d fl(program)f(restruct\ uring)i(op)q(erations,)g(a)g(practical)g(refactoring)g(system)f(m)o(ust)g(pro) o(vide)37 1603 y(a)h(program)e(represen)o(tation)i(that)f(is)h(ric)o(h)g(enou\ gh)g(to)f(supp)q(ort)h(precondition)h(c)o(hec)o(king)g(and)f(p)q(erform)f(con\ -)37 1659 y(sisten)o(t)18 b(up)q(dates.)28 b(This)19 b(c)o(hapter)e(discusses) i(tec)o(hniques)h(for)d(parsing)h(a)f(program,)g(and)h(for)f(generating)37 1716 y(and)j(main)o(taining)h(cross)e(reference)h(information.)33 b(T)l(o)19 b (supp)q(ort)h(design)g(exploration,)h(a)e(system)g(m)o(ust)37 1772 y(also)c (b)q(e)g(\015exible)i(and)e(fast.)k(Finally)l(,)d(for)e(a)g(refactoring)h(to) q(ol)f(to)g(b)q(e)i(useful,)f(it)g(m)o(ust)f(in)o(tegrate)g(w)o(ell)i(with)37 1829 y(the)g(organization)f(targeted)f(to)h(use)h(it.)37 1950 y fe(11.3.1)56 b (Explicitly)15 b(Represen)n(ting)j(the)g(Structure)g(of)h(a)g(Program)37 2036 y fl(A)13 b(textual)g(represen)o(tation)g(of)f(program)g(source)h(is)g(not)f (ric)o(h)i(enough)f(to)f(supp)q(ort)h(refactoring.)18 b(Consider,)37 2093 y (for)f(example,)h(the)g(refactoring)e(that)h(c)o(hanges)g(the)g(name)h(of)e (a)h(mem)o(b)q(er)h(function,)g(de\014ned)h(in)f(c)o(hapter)37 2149 y(\014v)o (e.)i(This)14 b(refactoring)f(c)o(hanges)h(not)f(only)h(the)g(function)g(de\ \014nition)i(but)d(also)h(c)o(hanges)f(all)i(places)f(where)37 2206 y(the)f (function)h(is)f(called.)21 b(Dep)q(ending)14 b(on)f(the)f(access)h(con)o(tro\ l)f(mo)q(de)h(of)g(the)f(mem)o(b)q(er)h(function,)h(it)f(ma)o(y)f(b)q(e)37 2262 y(referenced)g(in)g(its)f(con)o(taining)g(class,)h(its)f(sub)q(classes)h (and)e(other)h(places)g(that)f(reference)i(an)e(instance)i(of)e(one)37 2319 y (of)15 b(those)h(classes.)21 b(This)16 b(refactoring)f(m)o(ust)g(c)o(hange)g (the)g(function)i(name)e(in)h(all)h(these)e(places.)22 b(Ho)o(w)o(ev)o(er,)37 2375 y(there)17 b(are)f(cases)g(where)h(a)f(name)h(substitution)g(should)g (not)f(b)q(e)h(made.)24 b(The)17 b(same)f(name)g(ma)o(y)g(b)q(e)h(used)37 2431 y(elsewhere)g(in)e(the)g(program)f(to)h(refer)f(to)h(a)f(v)m(ariable)j(or)d (p)q(ossibly)i(ev)o(en)g(to)e(a)h(class;)g(distinguishing)i(these)37 2488 y (cases)f(requires)g(an)f(analysis)h(of)f(the)h(program)e(syn)o(tax.)19 b(Or,) d(a)f(di\013eren)o(t)g(function)h(with)g(the)f(same)g(name)37 2544 y(ma)o(y)h (b)q(e)h(de\014ned)g(in)g(another,)f(unrelated)h(class;)f(distinguishing)j (this)e(case)f(requires)h(t)o(yp)q(e)f(information.)37 2601 y(A)g(simple)g (textual)g(scan)f(and)g(replacemen)o(t)h(approac)o(h)f(cannot)g(mak)o(e)g(the\ se)g(distinctions.)941 2760 y(126)g eop bop 108 42 a fl(Rather,)11 b(a)g(prog\ ram)e(represen)o(tation)i(is)g(needed)h(for)e(refactoring)g(that)g(mak)o(es)g (structural)g(information)37 98 y(explicit,)21 b(and)d(that)g(supp)q(orts)g (automated)f(analysis,)i(b)q(etter)f(than)g(program)f(source.)29 b(This)19 b (structural)37 154 y(information)13 b(is)g(needed)h(not)e(only)h(to)e(execute) i(a)f(refactoring,)h(but)f(also)g(to)g(c)o(hec)o(k)h(the)f(preconditions)i (that)37 211 y(determine)g(if)e(the)g(refactoring)g(is)h(v)m(alid.)20 b(F)l (or)12 b(example,)h(precondition)h(c)o(hec)o(king)f(for)e(the)h(refactoring)g (that)37 267 y(c)o(hanges)h(the)g(name)f(of)g(a)g(mem)o(b)q(er)h(function)g (in)o(v)o(olv)o(es)g(collecting)h(the)f(sets)f(of)g(mem)o(b)q(er)h(functions) g(de\014ned)37 324 y(on)j(a)f(class)g(and)g(its)h(sup)q(erclasses.)21 b(This) 16 b(requires)g(syn)o(tax)e(analysis)i(and)f(t)o(yp)q(e)h(information.)108 380 y(An)e(abstract)e(syn)o(tax)h(tree,)g(annotated)g(with)h(t)o(yp)q(e)f(and)h (reference)g(information,)f(is)h(a)f(represen)o(tation)37 437 y(can)j(b)q(e)g (used)f(to)g(refactor)f(programs.)37 558 y fe(11.3.2)56 b(Soft)n(w)n(are)20 b (Refactoring)d(Pro)r(cess)37 644 y fl(Curren)o(t)g(programming)f(practice)h (usually)h(in)o(v)o(olv)o(es)g(main)o(taining)g(and)e(up)q(dating)i(programs) e(in)h(source)37 701 y(co)q(de)f(form.)j(In)c(order)g(to)f(in)o(tegrate)g(ref\ actoring)h(in)o(to)f(suc)o(h)h(en)o(vironmen)o(ts,)g(program)f(source)h(m)o (ust)f(\014rst)37 757 y(b)q(e)22 b(con)o(v)o(erted)f(to)f(an)h(abstract)f(syn) o(tax)g(tree)h(represen)o(tation)g(b)q(efore)g(refactoring,)g(and)h(the)f(up) q(dated)37 814 y(program)15 b(source)g(m)o(ust)f(b)q(e)i(regenerated)f(from)g (the)g(represen)o(tation)g(after)g(refactoring.)k(Figure)c(11.1)f(\(at)37 870 y(end)21 b(of)e(c)o(hapter\))g(sho)o(ws)f(the)i(stages)f(in)h(the)f(refactori\ ng)g(pro)q(cess.)33 b(Within)21 b(a)e(refactoring)g(system,)h(a)37 927 y(pars\ er)d(creates)f(a)g(syn)o(tax)f(tree)i(represen)o(tation)f(of)g(the)g(program) g(source.)23 b(The)17 b(parse)f(trees)g(are)g(passed)37 983 y(to)f(the)g(refa\ ctorer,)f(whic)o(h)i(\014rst)e(analyzes)i(the)f(trees)g(and)g(adds)h(t)o(yp)q (e)f(and)g(cross-reference)h(information.)37 1039 y(Then)d(the)e(refactorer)g (manipulates)i(the)e(represen)o(tation)h(based)g(on)g(commands)f(from)g(the)h (user)f(\(a)g(h)o(uman)37 1096 y(doing)16 b(design)f(or)f(p)q(ossibly)i(a)e (higher)i(lev)o(el)g(program\).)i(Finally)l(,)e(a)e(prett)o(y)g(prin)o(ter)h (is)g(called)h(to)e(prin)o(t)g(the)37 1152 y(refactored)h(co)q(de.)108 1209 y (The)h(approac)o(h)e(that)h(w)o(e)g(used)h(to)e(build)k(the)d(protot)o(yp)q (e)f(w)o(as)h(to)g(write)g(a)g(simple)i(parser)d(from)h(C++)37 1265 y(in)o (to)k(Lisp)h(forms)d(using)i(a)f(Y)l(A)o(CC-compatible)i(sp)q(eci\014cation)g (of)e(C++)h(dev)o(elop)q(ed)h(b)o(y)f(Roskind)g([100)o(].)37 1322 y(A)k(Commo\ n)f(Lisp)i([62)o(])e(program,)i(making)e(extensiv)o(e)i(use)f(of)f(the)h(Comm\ on)f(Lisp)i(Ob)s(ject)f(System)37 1378 y(\(CLOS\))g(facilities,)i(used)d(the) h(output)e(of)h(the)g(parser)f(to)h(build)i(a)d(complex)i(structure)f(represe\ n)o(ting)37 1435 y(the)h(program.)39 b(Eac)o(h)22 b(program)f(part)h(w)o(as)f (represen)o(ted)h(as)g(an)g(aggregation,)g(where)h(the)f(aggregate)37 1491 y (ob)s(ject)c(corresp)q(onded)h(to)e(the)i(ro)q(ot)e(no)q(de)i(of)e(the)h(pars\ e)g(tree)g(and)h(the)f(c)o(hild)h(no)q(des)g(w)o(ere)f(represen)o(ted)37 1548 y(as)d(comp)q(onen)o(ts.)k(Man)o(y)14 b(comp)q(onen)o(ts)h(w)o(ere)f(themselv) o(es)h(the)f(ro)q(ot)g(of)g(a)g(sub-tree,)h(whose)f(c)o(hildren)j(w)o(ere)37 1604 y(represen)o(ted)h(\(recursiv)o(ely\))f(as)f(comp)q(onen)o(ts.)25 b(Eac) o(h)16 b(no)q(de)h(in)h(the)f(tree)f(w)o(as)g(an)h(instance)g(of)f(one)h(of)f (the)37 1660 y(\(CLOS\))f(classes)g(de\014ned)h(in)f(the)g(refactorer)e(corre\ sp)q(onding)j(to)e(the)g(signi\014can)o(t)i(non-terminals)f(de\014ned)37 1717 y(in)h(the)e(grammar.)k(The)d(refactorings)f(w)o(ere)g(implemen)o(ted)i(as)f (Common)e(Lisp)j(functions.)k(A)15 b(crude)g(co)q(de)37 1773 y(regenerator,)g (used)h(mostly)g(for)f(debugging,)h(w)o(as)f(implemen)o(ted)i(as)e(a)h(CLOS)g (generic)h(output)e(function,)37 1830 y(distributed)i(among)e(the)g(classes.) 108 1886 y(Using)h(an)f(ob)s(ject-orien)o(ted)g(approac)o(h)f(to)g(represen)o (t)h(the)g(parse)g(tree)g(as)g(an)g(aggregate)e(ob)s(ject)h(made)37 1943 y (the)i(factoring)g(of)f(some)g(functions)i(easy)l(.)22 b(Man)o(y)15 b(of)g (the)h(op)q(erations)g(on)f(for)g(example)i(a)f(class)g(de\014nition)37 1999 y (in)o(v)o(olv)o(e)g(tra)o(v)o(ersing)f(the)g(en)o(tire)h(tree)f(represen)o (ting)h(the)f(class,)g(but)g(only)h(a)f(few)g(no)q(des)h(w)o(ere)f(mo)q(di\ \014ed)i(in)37 2056 y(the)h(pro)q(cess.)28 b(These)18 b(op)q(erations)g(w)o (ere)f(de\014ned)i(as)f(CLOS)g(generic)h(functions,)g(de\014ned)g(on)e(all)i (classes)37 2112 y(represen)o(ting)f(no)q(des)g(in)g(the)f(tree.)25 b(F)l(or) 16 b(most)g(classes,)i(these)f(functions)h(just)f(consisted)g(of)g(calls)h (to)e(the)37 2169 y(corresp)q(onding)22 b(functions)f(in)h(the)e(comp)q(onen) o(ts;)j(the)e(in)o(teresting)g(mo)q(di\014cations)h(w)o(ere)e(encapsulated)37 2225 y(within)d(the)e(classes)h(of)f(the)g(no)q(des)h(b)q(eing)g(c)o(hanged.) 37 2347 y fe(11.3.3)56 b(Generating)17 b(and)j(Main)n(taining)e(Cross)i(Refer\ ences)37 2432 y fl(Refactoring)14 b(one)f(part)f(of)g(a)h(program)e(often)i (requires)h(c)o(hanging)f(other)f(parts)g(of)h(the)g(program)e(that)i(refer) 37 2489 y(to)e(it.)19 b(It)12 b(is)g(sometimes)f(necessary)h(\(esp)q(ecially) i(during)e(precondition)h(c)o(hec)o(king\))f(to)f(\014nd)h(all)h(references)f (to)37 2545 y(a)j(v)m(ariable,)h(function)f(or)f(class)h(b)q(eing)h(c)o(hange\ d.)k(A)15 b(refactoring)f(system)g(m)o(ust)g(detect)h(these)g(\\bac)o(kw)o (ard)37 2602 y(references")j(\(that)e(is,)h(references)h fi(to)f fl(the)g(v)m (ariable,)i(function)f(or)e(class\),)h(and)h(consisten)o(tly)f(c)o(hange)g (the)941 2760 y(127)g eop bop 37 42 a fl(program.)35 b(If,)21 b(for)f(example\ ,)i(the)f(refactoring)f(that)f(mo)o(v)o(es)h(a)g(v)m(ariable)i(from)d(an)i (aggregate)d(class)j(to)37 98 y(the)h(class)g(of)f(one)h(of)f(its)h(comp)q (onen)o(ts.)39 b(The)22 b(refactoring)g(in)o(v)o(olv)o(es)g(adding)g(a)f(new) h(v)m(ariable)h(to)e(the)37 154 y(comp)q(onen)o(t)c(class,)g(deleting)i(it)d (from)g(the)h(aggregate)e(class)i(and)g(c)o(hanging)g(references)h(to)e(the)g (v)m(ariable.)37 211 y(When)e(refactoring)f(is)h(\014nished,)h(it)e(is)h(esse\ n)o(tial)g(that)f(no)g(references)h(to)f(the)g(old,)h(deleted)g(v)m(ariable)h (b)q(e)f(left)37 267 y(dangling)j(in)f(the)f(system.)108 324 y(References)23 b (made)e fi(by)g fl(a)g(v)m(ariable,)i(function)g(or)d(class)i(are)f(most)f (naturally)i(resolv)o(ed)f(when)h(that)37 380 y(ob)s(ject)14 b(is)g(loaded;)h (ho)o(w)o(ev)o(er,)e(there)h(are)g(sev)o(eral)g(approac)o(hes)g(for)g(handlin\ g)h(references)g fi(to)f fl(these)h(parts)e(of)37 437 y(a)i(program.)108 493 y (A)o(t)23 b(one)h(extreme,)i(this)e(cross)f(reference)h(information)g(can)g (b)q(e)h(precomputed)f(and)g(stored)f(in)i(a)37 550 y(database,)c(whic)o(h)g (is)g(up)q(dated)g(as)e(the)i(program)e(structure)h(c)o(hanges.)34 b(A)o(t)20 b(the)g(other)g(extreme,)h(cross)37 606 y(reference)16 b(information)g(can)f (b)q(e)h(generated)f(as)g(needed)h(b)o(y)g(tra)o(v)o(ersing)e(the)h(program)f (structure.)108 663 y(Precomputing)j(the)f(cross)f(reference)i(information)g (has)e(the)i(adv)m(an)o(tage)e(of)h(making)g(cross)g(reference)37 719 y(lo)q (okup)22 b(\(queries\))f(easy)l(,)h(but)e(making)h(up)q(dates)g(to)f(this)h (cross)g(reference)g(information)g(can)g(b)q(e)g(hard.)37 775 y(Sev)o(eral)c (to)q(ols)f(ha)o(v)o(e)f(b)q(een)i(dev)o(elop)q(ed)h(to)d(create)h(these)g (tables)g(from)f(C++)i(source)f(co)q(de)g([50)o(,)g(81)o(];)g(to)q(ols)37 832 y(ha)o(v)o(e)k(also)f(b)q(een)i(dev)o(elop)q(ed)g(for)e(other)g(ob)s(ject)g (orien)o(ted)g(languages.)33 b(Ho)o(w)o(ev)o(er,)19 b(refactorings)g(c)o(hang\ e)37 888 y(program)g(structure,)i(and)f(almost)f(ev)o(ery)h(refactoring)f(req\ uires)i(the)f(cross)g(reference)g(database)g(to)f(b)q(e)37 945 y(up)q(dated.) i(These)16 b(database)e(c)o(hanges)i(can)f(b)q(e)h(costly)f(and)g(complex.) 108 1001 y(A)o(t)c(the)g(other)f(extreme,)i(generating)f(the)g(cross)f(refere\ nce)i(information)f(as)g(needed)h(from)e(the)i(program)37 1058 y(structure)i (has)g(the)g(adv)m(an)o(tage)f(that)h(the)g(resulting)h(cross)e(reference)i (information)f(is)g(alw)o(a)o(ys)f(up)i(to)e(date.)37 1114 y(When)h(a)f(progr\ am)f(is)h(refactored,)g(there)g(is)h(no)f(need)h(to)e(also)h(up)q(date)h(a)f (separate)f(structure)h(that)g(records)37 1171 y(cross-reference)g(informatio\ n.)19 b(Ho)o(w)o(ev)o(er,)11 b(tree)h(tra)o(v)o(ersals)e(can)i(b)q(e)h(costly) f(for)f(large)h(programs,)f(and)h(since)37 1227 y(cross)i(reference)g(informa\ tion)g(is)g(needed)h(at)e(sev)o(eral)g(p)q(oin)o(ts)h(in)h(most)e(refactoring\ s,)g(for)g(a)g(large)h(program)37 1284 y(this)i(approac)o(h)f(is)h(probably)f (unacceptably)i(slo)o(w.)108 1340 y(Approac)o(hes)22 b(corresp)q(onding)h(to) f(these)g(t)o(w)o(o)f(extremes)h(w)o(ere)g(tried)g(in)h(this)g(researc)o(h.) 40 b(The)23 b(\014rst)37 1396 y(approac)o(h)c(made)h(extensiv)o(e)g(use)f(of) g(a)g(cross)g(reference)h(database.)31 b(When)20 b(the)f(program)f(w)o(as)g (read)i(in)37 1453 y(to)f(the)g(refactorer,)g(sev)o(eral)h(tables)f(of)g(sema\ n)o(tic)h(information)f(w)o(ere)g(generated)g(and)h(stored)e(within)j(a)37 1509 y(sp)q(ecial)f(ob)s(ject)d(called)i(the)f fi(glob)n(al)g(information)g (manager)p fl(.)27 b(During)18 b(refactoring,)g(when)g(the)g(structure)37 1566 y(of)f(the)h(program)e(w)o(as)h(constan)o(tly)g(c)o(hanging,)h(it)f(w)o(as)g (di\016cult)i(to)e(main)o(tain)g(consistency)i(b)q(et)o(w)o(een)e(the)37 1622 y(tables)f(and)f(the)h(implemen)o(tation.)108 1679 y(Then,)e(a)e(second)i(app\ roac)o(h)e(w)o(as)h(tried,)g(where)g(this)h(information)f(w)o(as)f(generated) h(dynamically)l(.)21 b(The)37 1735 y(only)16 b(reference)f(information)g(stor\ ed)f(within)i(the)f(global)h(information)e(manager)g(w)o(as)g(the)h(list)h (of)e(classes)37 1792 y(and)g(global)h(declarations)f(\(functions)h(and)f(en) o(umerated)f(t)o(yp)q(es\).)19 b(Later,)14 b(when)g(a)g(refactoring)f(needed) i(to)37 1848 y(kno)o(w)c(for)g(example)h(all)h(references)f(to)e(a)h(mem)o (b)q(er)h(v)m(ariable,)h(the)e(global)h(information)g(manager)e(generated)37 1905 y(the)15 b(set)e(b)o(y)h(tra)o(v)o(ersing)g(the)g(relev)m(an)o(t)g(parse) g(trees.)20 b(Compared)13 b(to)h(the)g(earlier)h(approac)o(h,)e(this)i(approa\ c)o(h)37 1961 y(to)20 b(handling)i(cross)e(reference)h(information)f(w)o(as)f (simpler)j(to)d(implemen)o(t)j(and)e(debug;)j(w)o(orking)d(with)37 2017 y(sma\ ll)c(examples)g(there)g(w)o(ere)f(no)g(noticeable)h(p)q(erformance)g(p)q(enal\ ties.)108 2074 y(A)c(practical)g(refactoring)f(system)g(w)o(ould)h(need)h(a)e (metho)q(d)h(for)f(handling)i(cross)e(reference)h(information)37 2130 y(that) 18 b(falls)g(somewhere)g(b)q(et)o(w)o(een)g(these)g(t)o(w)o(o)f(extremes.)27 b (The)18 b(cost)f(of)h(rep)q(eated)g(tree)g(tra)o(v)o(ersals)e(could)37 2187 y (b)q(e)f(prohibitiv)o(e)h(if)e(the)g(program)f(b)q(eing)j(refactored)d(is)i (large)f(\(eg:)k(a)c(million)i(lines)g(of)e(co)q(de\).)19 b(One)c(w)o(a)o(y)e (to)37 2243 y(reduce)i(the)e(n)o(um)o(b)q(er)h(of)f(tree)h(tra)o(v)o(ersals)e (needed)j(w)o(ould)f(b)q(e)g(to)f(\\cac)o(he")g(within)i(a)e(referenced)h(ob) s(ject)f(the)37 2300 y(set)j(of)f(ob)s(jects)g(\(represen)o(ting)h(parts)f (of)g(the)h(program\))e(that)h(migh)o(t)h(refer)f(to)g(it,)h(as)f(this)h(info\ rmation)g(is)37 2356 y(often)g(needed)i(during)f(refactoring.)23 b(The)16 b (cac)o(he)h(of)f(bac)o(kw)o(ard)f(references)i(to,)f(for)f(example,)i(a)f(v)m (ariable)37 2413 y(could)i(b)q(e)g(implemen)o(ted)h(as)d(\(p)q(oin)o(ters)h (to\))f(the)h(set)g(of)f(functions)i(that)e fi(might)h fl(reference)h(the)f (v)m(ariable.)1892 2396 y fs(2)37 2496 y 750 2 v 89 2523 a fu(2)107 2539 y fp (The)e(cac)o(he)i(could,)h(alternativ)o(ely)m(,)h(b)q(e)d(engineered)i(to)e (con)o(tain)h(p)q(oin)o(ters)g(to)f(the)g(classes)h(or)f(expressions)i(that)e (migh)o(t)37 2585 y(reference)e(the)f(v)n(ariable.)941 2760 y fl(128)g eop bop 37 42 a fl(The)13 b(cac)o(he)f(w)o(ould)h(con)o(tain)f(a)g fi(sup)n(erset)g fl (of)g(all)h(true)f(bac)o(kp)q(oin)o(ters;)h(in)g(other)f(w)o(ords,)f(it)i(w)o (ould)f(p)q(oin)o(t)h(to)f(all)37 98 y(the)j(functions)h(that)e(reference)i (the)f(v)m(ariable,)g(plus)h(p)q(ossibly)h(some)d(functions)i(that)e(no)h(lon\ ger)g(reference)37 154 y(the)20 b(v)m(ariable.)33 b(Since)20 b(the)f(set)g (of)g(bac)o(kp)q(oin)o(ters)g(is)h(a)f(sup)q(erset)g(of)g(the)g(set)g(of)f (true)h(bac)o(kp)q(oin)o(ters,)h(the)37 211 y(cac)o(he)c(only)g(needs)g(to)e (b)q(e)i(up)q(dated)g(when)g(references)f(to)g(the)g(v)m(ariable)i(are)e fi (adde)n(d)g fl(to)g(the)g(program)f(\(not)37 267 y(when)k(they)g(are)f(delete\ d\).)28 b(The)17 b(cac)o(he)h(could)h(b)q(e)f(cleaned)h(up)e(when)h(an)g(atte\ mpt)e(is)i(made)g(to)e(\014nd)j(all)37 324 y(references)e(to)e(the)g(v)m(aria\ ble;)i(p)q(oin)o(ters)f(to)f(functions)i(that)d(no)i(longer)g(reference)g(the) g(v)m(ariable)h(w)o(ould)f(b)q(e)37 380 y(remo)o(v)o(ed)f(from)g(the)g(cac)o (he.)108 437 y(Clearly)l(,)j(for)d(large)i(programs)e(the)i(represen)o(tation\ \(s\))f(used)h(will)h(in\015uence)h(ho)o(w)d(exp)q(ensiv)o(e)i(it)f(is)g(to) 37 493 y(refactor)d(the)g(program.)k(One)d(w)o(a)o(y)e(to)g(ac)o(hiev)o(e)i (some)f(e\016ciencies)i(in)f(main)o(taining)g(consistency)g(b)q(et)o(w)o(een) 37 550 y(m)o(ultiple)21 b(program)c(represen)o(tations)h(is)h(describ)q(ed)i (b)o(y)d(Grisw)o(old)h([52)o(].)29 b(His)19 b(restructuring)g(of)f(Sc)o(heme) 37 606 y(programs)12 b(used)i(an)e(abstract)g(syn)o(tax)g(tree)h(\(AST\))f (represen)o(tation,)h(and)g(a)g(program)f(dep)q(endency)j(graph)37 663 y(\(PD\ G\))e(whic)o(h)i(recorded)g(data)e(\015o)o(w)h(and)g(con)o(trol)g(\015o)o(w)g (dep)q(endencies.)22 b(PDG)14 b(up)q(dates)g(w)o(ere)g(exp)q(ensiv)o(e.)37 719 y(The)i(AST)g(announced)h(three)f(ev)o(en)o(ts)f(as)g(the)h(program)f(w)o(as) f(restructured:)21 b(insert,)16 b(delete)h(and)f(c)o(hange.)37 775 y(The)22 b (`AST-PDG)e(consistency')i(comp)q(onen)o(t)f(receiv)o(ed)h(these)f(ev)o(en)o (ts,)h(and)f(determined)i(the)e(up)q(dates)37 832 y(needed)15 b(to)e(the)h (PDG.)e(A)i(`lazy)f(consistency')h(strategy)f(w)o(as)f(applied,)k(where)d(up) q(dates)h(to)f(the)h(PDG)f(w)o(ere)37 888 y(cac)o(hed)j(and)f(not)g(actually) h(applied)h(to)d(the)h(PDG)f(un)o(til)j(after)d(a)h(transformation)e(w)o(as)i (completed)h(and)f(a)37 945 y(new)h(transformation)d(w)o(as)h(ab)q(out)g(to)h (b)q(egin.)21 b(Suc)o(h)15 b(tec)o(hniques)h(ma)o(y)e(apply)i(for)e(a)g(pract\ ical)i(refactoring)37 1001 y(system.)37 1123 y fe(11.3.4)56 b(Supp)r(orting) 18 b(Design)g(Exploration)37 1209 y fl(As)g(noted)g(at)f(the)g(start)g(of)g (this)h(thesis,)g(design)h(is)f(hard.)27 b(Designing)19 b(reusable)f(soft)o (w)o(are)e(in)o(v)o(olv)o(es)i(cre-)37 1265 y(ativit)o(y)d(and)g(exploring)h (design)f(alternativ)o(es.)20 b(Sp)q(eed)c(and)e(clarit)o(y)h(of)f(the)h(user) g(in)o(terface)g(are)f(imp)q(ortan)o(t)37 1322 y(in)k(a)e(refactoring)f(to)q (ol)i(that)e(supp)q(orts)i(design)g(exploration.)23 b(A)17 b(refactoring)f (to)q(ol)g(that)f(is)i(to)q(o)f(slo)o(w)g(will)37 1378 y(\\get)i(in)h(the)g (w)o(a)o(y")e(and)h(discourage)h(trying)f(out)g(alternativ)o(e)h(designs.)30 b (Ideally)l(,)21 b(a)d(refactoring)f(should)37 1435 y(execute)i(instan)o(taneo\ usly)l(.)28 b(Also,)18 b(since)h(a)f(ma)s(jor)e(purp)q(ose)i(of)f(refactoring) h(is)g(to)f(mak)o(e)g(the)h(design)h(on)37 1491 y(the)14 b(system)f(clearer,) h(and)g(since)h(clarit)o(y)e(is)h(in)h(part)e(sub)s(jectiv)o(e,)h(it)f(is)h (imp)q(ortan)o(t)f(that)g(a)g(refactoring)g(to)q(ol)37 1548 y(mak)o(e)19 b (clear)g(to)f(the)g(user)h(the)g(e\013ects)f(of)h(an)f(op)q(eration.)31 b(Sin\ ce)20 b(alternativ)o(es)e(are)h(sometime)f(explored)37 1604 y(and)f(then)g (discarded,)g(it)f(is)h(also)f(useful)i(to)d(pro)o(vide)i(a)f(mec)o(hanism)h (that)f(is)g(\015exible)j(and)d(can)h(undo)f(the)37 1660 y(e\013ects)f(of)g (a)g(refactoring.)108 1717 y(Refactoring)k(a)e(large)i(program)e(could)i(b)q (e)g(v)o(ery)f(slo)o(w)g(if)g(it)h(required)g(rep)q(eatedly)h(generating)e (cross)37 1773 y(reference)f(information)e(that)g(in)o(v)o(olv)o(ed)h(exhaust\ iv)o(e)g(tree)f(tra)o(v)o(ersals.)20 b(As)15 b(noted)g(ab)q(o)o(v)o(e,)g(ther\ e)g(are)h(w)o(a)o(ys)37 1830 y(that)k(a)g(system)g(could)h(b)q(e)g(engineered) h(to)e(reduce)h(the)f(cost)g(of)g(these)g(queries.)36 b(F)l(ortunately)l(,)21 b(due)g(to)37 1886 y(tec)o(hnology)13 b(adv)m(ances,)h(issues)g(of)e(pro)q (cessing)i(sp)q(eed)f(and)g(memory)g(size)g(are)g(b)q(ecoming)h(less)f(of)f (a)h(concern)37 1943 y(than)h(in)h(the)f(past.)19 b(P)o(erformance)13 b(issue\ s)i(will)h(b)q(e)f(b)q(etter)f(understo)q(o)q(d)g(as)g(practical)g(refactorin\ g)g(systems)37 1999 y(are)h(implemen)o(ted)i(and)f(used.)108 2056 y(Clarit)o (y)k(in)g(the)g(user)f(in)o(terface)h(is)g(imp)q(ortan)o(t)f(b)q(ecause,)i (as)f(discussed)h(earlier,)g(man)o(y)e(refactoring)37 2112 y(tasks)13 b(\(esp) q(ecially)j(the)e(more)f(complex)h(refactorings\))f(require)h(some)f(user)h (in)o(teraction)g(for)f(the)g(results)h(to)37 2169 y(b)q(e)g(useful.)20 b(Rak) 13 b([93])f(describ)q(es)j(an)e(in)o(terface)g(for)f(refactoring)h(Smalltalk) h(metho)q(ds)f(and)g(migrating)g(co)q(de)37 2225 y(to)i(a)g(common)g(sup)q (erclass;)h(his)g(approac)o(h)e(is)i(describ)q(ed)h(and)e(extended)i(in)f(c)o (hapter)f(six.)20 b(User)15 b(in)o(terface)37 2281 y(issues)i(regarding)e(ref\ actoring)g(pro)q(cess)g(is)h(an)f(area)f(for)h(future)g(researc)o(h.)108 2338 y(Sev)o(eral)k(approac)o(hes)f(can)h(b)q(e)g(applied)h(to)e(\\undo")g(the)g (e\013ects)g(of)g(a)h(refactoring.)29 b(Chec)o(kp)q(oin)o(ting,)37 2394 y(log\ ging)17 b(and)g(traditional)h(c)o(hange)e(managemen)o(t)g(tec)o(hniques)i(can) f(b)q(e)g(applied)h(to)e(roll)i(bac)o(k)e(the)h(e\013ects)37 2451 y(of)h(c)o (hanges.)28 b(In)19 b(some)e(cases)h(a)g(refactoring)f(\(or)g(short)h(sequenc\ e)h(of)e(refactorings\))h(can)g(b)q(e)g(applied)i(to)37 2507 y(undo)c(the)f (e\013ects)g(of)g(an)g(immediately)i(prior)e(refactoring.)941 2760 y(129)g eop bop 108 42 a fl(In)20 b(summary)l(,)f(a)g(practical)g(refactoring)g(system)g (that)f(supp)q(orts)h(design)h(exploration)g(needs)f(to)g(b)q(e)37 98 y(fast,) c(clear)g(and)h(\015exible.)37 220 y fe(11.3.5)56 b(Other)18 b(considerations) 37 305 y fl(The)i(v)m(alue)g(of)e(a)h(refactoring)f(to)q(ol)h(to)f(an)h(organ\ ization)g(will)h(b)q(e)g(measured)f(b)o(y)g(ho)o(w)f(w)o(ell)i(it)f(can)g(hel\ p)37 362 y(that)c(organization)f(dev)o(elop)i(soft)o(w)o(are)d(in)j(the)f(rel\ ev)m(an)o(t)g(application)i(domains.)j(While)c(the)f(refactorings)37 418 y (describ)q(ed)f(in)e(this)g(thesis)g(are)f(domain)h(indep)q(enden)o(t,)i(the) e(c)o(hoice)g(of)f(refactorings)g(to)g(apply)i(to)d(a)i(program)37 475 y(will) 22 b(b)q(e)e(motiv)m(ated)g(b)o(y)g(the)g(user's)f(understanding)i(of)e(the)h (domain)g(and)g(the)g(state)f(of)g(the)h(program.)37 531 y(There)j(are)e(sev) o(eral)h(implications)i(that)d(an)h(application)h(domain)f(can)g(ha)o(v)o(e)f (on)h(refactoring.)39 b(If)22 b(the)37 588 y(application)15 b(has)d(a)g(w)o (ell)i(de\014ned)f(v)o(o)q(cabulary)g(of)f(synon)o(yms,)h(this)f(can)h(mak)o (e)f(similarit)o(y)i(detection)f(easier)37 644 y(when)k(creating)e(a)h(common) f(sup)q(erclass.)22 b(On)16 b(the)g(other)f(hand,)h(naming)f(con)o(v)o(en)o (tions)h(ma)o(y)f(restrict)g(the)37 701 y(allo)o(w)o(able)c(renamings.)19 b (Higher)11 b(lev)o(el)g(refactorings)f(ma)o(y)f(b)q(e)i(de\014nable)h(that)e (incorp)q(orate)g(domain)h(sp)q(eci\014c)37 757 y(concepts.)21 b(This)16 b (implies)h(that)d(a)h(refactoring)g(system)g(should)h(b)q(e)g(extensible.)108 814 y(As)11 b(with)h(an)o(y)f(soft)o(w)o(are)f(dev)o(elopmen)o(t)i(to)q(ol,)f (it)h(m)o(ust)f(in)o(tegrate)g(w)o(ell)h(with)g(the)f(soft)o(w)o(are)f(dev)o (elopmen)o(t)37 870 y(pro)q(cess)18 b(of)e(the)i(organization)f(that)f(is)i (targeted)e(to)g(use)i(it.)26 b(The)17 b(set)g(of)f(refactorings)h(ma)o(y)f (need)i(to)f(b)q(e)37 927 y(extended)i(to)e(handle)i(programming)e(st)o(yles) h(that,)g(while)h(un)o(usual)g(or)e(non-standard,)h(are)f(nonetheless)37 983 y (used)g(in)g(the)f(organization.)22 b(A)16 b(refactoring)g(to)q(ol)g(m)o(ust) f(in)o(tegrate)g(w)o(ell)i(with)g(other)e(to)q(ols)h(that)f(supp)q(ort)37 1039 y(c)o(hange)h(managemen)o(t)e(and)i(other)e(soft)o(w)o(are)g(dev)o(elopmen)o (t)i(tasks)e(in)i(an)f(organization)g([31,)f(85].)108 1096 y(Large)j(soft)o (w)o(are)f(organizations)h(are)g(often)g(resistan)o(t)f(to)h(c)o(hange;)h(c)o (hanging)g(the)f(names,)g(b)q(eha)o(vior,)37 1152 y(in)o(terrelationships)g (and)e(resp)q(onsibiliti)q(es)j(of)c(ob)s(jects)g(can)h(ha)o(v)o(e)g(p)q(olit\ ical)i(as)e(w)o(ell)h(as)e(tec)o(hnical)i(implica-)37 1209 y(tions.)21 b(Refa\ ctorings)15 b(need)h(to)f(b)q(e)g(pruden)o(tly)i(applied)g(in)f(these)f(cases\ .)37 1330 y fe(11.3.6)56 b(Some)17 b(Promising)g(Approac)n(hes)37 1416 y fl (There)e(has)f(b)q(een)h(researc)o(h)g(on)f(automating)f(the)i(pro)q(duction) g(of)f(program)f(dev)o(elopmen)o(t)i(en)o(vironmen)o(ts,)37 1473 y(and)c(the) g(systems)f(that)f(are)i(pro)q(duced)g(include)i(the)e(same)f(parts)g(\(ie)h (parsers,)f(program)g(transformers,)f(and)37 1529 y(prett)o(y)16 b(prin)o(ter\ s\))g(as)g(a)g(refactory)l(.)22 b(The)17 b(most)e(w)o(ell-kno)o(wn)i(of)f(the\ se)h(systems)f(for)f(generating)i(program)37 1586 y(dev)o(elopmen)o(t)i(en)o (vironmen)o(ts)f(are)f(the)h(\(Cornell\))g(Syn)o(thesizer)h(Generator)d([95)o (],)i(GAND)o(ALF)f([84)o(])g(and)37 1642 y(CENT)l(A)o(UR)f([22)o(].)j(Ideally) l(,)e(these)e(systems)f(could)i(b)q(e)g(used)f(to)f(generate)h(the)g(soft)o (w)o(are)e(refactory)l(.)19 b(They)37 1699 y(ha)o(v)o(e)i(built)i(in)f(facili\ ties)h(for)d(generating)i(parsers)e(that)h(con)o(v)o(ert)f(source)h(in)o(to)g (abstract)f(syn)o(tax)h(trees)37 1755 y(and)d(prett)o(y)e(prin)o(ters)h(that) g(con)o(v)o(ert)f(abstract)g(syn)o(tax)h(trees)f(in)o(to)h(source,)h(and)f (pro)o(vide)h(other)e(supp)q(ort)37 1811 y(suc)o(h)k(as)e(language)h(directed) h(editing)g(and)f(v)o(ersion)g(managemen)o(t.)29 b(The)19 b(refactorings)f (themselv)o(es)i(are)37 1868 y(transformations)10 b(of)g(the)h(parse)g(tree)g (that)f(are)h(m)o(uc)o(h)g(more)f(complex)i(than)f(the)g(simple)h(tree)f(mani\ pulation)37 1924 y(primitiv)o(es)24 b(supp)q(orted)e(b)o(y)g(these)g(systems,) g(but)g(eac)o(h)g(system)g(has)f(facilities)j(\(e.g.,)e(action)g(routines)37 1981 y(in)g(GAND)o(ALF)f(and)g(LeLisp)i(functions)f(in)f(CENT)l(A)o(UR\))g (for)g(building)i(up)q(on)f(the)f(system)g(pro)o(vided)37 2037 y(primitiv)o (es.)108 2094 y(Early)d(in)i(our)e(researc)o(h)g(w)o(e)g(analyzed)h(CENT)l (A)o(UR,)g(whic)o(h)g(is)g(one)f(of)g(the)h(most)e(adv)m(anced)i(of)f(the)37 2150 y(program)13 b(dev)o(elopmen)o(t)h(en)o(vironmen)o(ts.)20 b(The)14 b(lan\ guage)g(for)f(writing)h(complex)h(tree)e(manipulations)i(w)o(as)37 2207 y(a)d (form)f(of)g(Lisp,)i(so)f(is)g(su\016cien)o(tly)h(p)q(o)o(w)o(erful)f(to)f (write)h(an)o(y)f(kind)i(of)e(program)f(transformation.)18 b(Ho)o(w)o(ev)o (er,)37 2263 y(the)c(o)o(v)o(erhead)e(of)h(learning)h(to)e(use)i(CENT)l(A)o (UR,)e(and)i(of)e(con)o(v)o(erting)h(our)g(grammar)e(in)o(to)i(a)g(form)f(it) h(could)37 2320 y(handle,)k(did)f(not)f(seem)g(to)g(b)q(e)g(w)o(orth)g(the)g (b)q(ene\014ts)h(it)g(migh)o(t)f(pro)o(vide)g(for)g(our)g(researc)o(h.)108 2376 y(It)h(seems)g(lik)o(ely)i(that)d(these)h(or)g(other)g(program)e(dev)o (elopmen)o(t)j(en)o(vironmen)o(t)f(generators)f(w)o(ould)i(b)q(e)37 2432 y (suitable)f(for)d(building)k(a)d(pro)q(duction)h(v)o(ersion)f(of)g(the)g(refa\ ctory)l(.)19 b(The)14 b(time)g(to)g(learn)g(to)g(use)g(suc)o(h)h(a)e(to)q(ol) 37 2489 y(w)o(ould)18 b(b)q(e)f(amortized)g(o)o(v)o(er)f(a)g(m)o(uc)o(h)h(lon\ ger)g(pro)s(ject)f(life-time,)j(so)e(if)g(it)g(made)g(the)g(rest)f(of)g(the)h (pro)s(ject)37 2545 y(easier)f(then)g(it)f(w)o(ould)h(pa)o(y)f(o\013)f(to)h (use)g(it.)941 2760 y(130)g eop bop 37 42 a fd(11.4)70 b(Other)23 b(Areas)g (for)h(F)-6 b(uture)23 b(Researc)n(h)37 143 y fl(There)16 b(are)f(sev)o(eral) g(other)g(researc)o(h)g(areas)g(that)f(need)i(further)f(in)o(v)o(estigation:) 93 237 y(1.)22 b(A)17 b(more)g(rigorous)f(/)h(complete)h(mo)q(del)g(of)e(ob)s (jects)h(and)g(their)h(relationships,)g(with)g(more)e(precise)151 293 y(descr\ iptions)21 b(of)d(the)h(t)o(yp)q(e)g(sp)q(eci\014cations)i(of)d(classes)i(and) f(a)g(more)f(rigorous)h(pro)q(of)f(of)h(b)q(eha)o(vior)151 350 y(preserv)m (ation,)d(w)o(ould)f(b)q(e)h(a)f(v)m(aluable)i(con)o(tribution.)93 444 y(2.) 22 b(Program)14 b(analysis)h(tec)o(hniques)i(more)d(p)q(o)o(w)o(erful)i(than) e(data)h(\015o)o(w)f(could)i(b)q(e)g(studied)g(for)f(c)o(hec)o(king)151 500 y (program)i(prop)q(erties)h(suc)o(h)h(as)e(class)h(in)o(v)m(arian)o(ts)h(and)f (exclusiv)o(e)h(comp)q(onen)o(ts.)28 b(Class)18 b(in)o(v)m(arian)o(ts)151 556 y(with)f(more)f(complicated)i(prop)q(erties)f(could)h(b)q(e)f(studied)h(\(for) d(example,)i fi(length\(x\))p fl(,)e(where)i fi(x)g fl(is)g(a)151 613 y(mem)o (b)q(er)f(v)m(ariable)g(represen)o(ting)g(a)f(list\).)93 707 y(3.)22 b(The)d (set)g(of)f(refactorings)g(could)i(b)q(e)g(extended)f(to)g(handle)h(additiona\ l)g(features)e(of)h(some)f(ob)s(ject)151 763 y(orien)o(ted)e(languages,)e(suc) o(h)i(as)e(m)o(ultiple)j(inheritance)g(and)e(parameterized)h(t)o(yp)q(es.)k (The)15 b(approac)o(h)151 820 y(could)i(also)e(b)q(e)h(extended)g(to)f(handle) i(additional)f(features)f(more)g(sp)q(eci\014c)i(to)e(C++,)h(suc)o(h)f(as)g (t)o(yp)q(e)151 876 y(casts,)d(o)o(v)o(erloaded)g(function)h(names)f(within)h (a)f(class,)g(and)g(a)g(more)g(p)q(o)o(w)o(erful)g(handling)i(of)d(p)q(oin)o (ters.)93 970 y(4.)22 b(User)g(in)o(terface)g(approac)o(hes)g(could)h(b)q(e)g (studied)g(for)f(assisting)g(a)g(user)g(in)h(making)f(refactoring)151 1026 y (related)16 b(design)g(decisions,)g(and)g(re\015ecting)g(the)f(e\013ects)g (of)g(a)g(refactoring)g(op)q(eration.)93 1120 y(5.)22 b(Refactoring)16 b(and) g(v)o(ersion)f(managemen)o(t)g(are)h(t)o(w)o(o)e(mec)o(hanisms)i(of)f(supp)q (orting)h(c)o(hange)g(that)f(are)151 1177 y(probably)i(closely)g(related.)22 b (Refactorings)16 b(migh)o(t)g(serv)o(e)f(as)h(atomic)g(elemen)o(ts)g(for)f (logging,)h(undo,)151 1233 y(and)i(reco)o(v)o(ery)l(.)26 b(Also,)18 b(refacto\ ring)f(is)h(made)g(more)f(complicated)i(if)f(op)q(erations)g(m)o(ust)e(b)q (e)j(consis-)151 1290 y(ten)o(tly)c(applied)j(to)c(m)o(ultiple)j(v)o(ersions) e(of)g(a)g(system.)93 1383 y(6.)22 b(Researc)o(h)16 b(is)g(needed)g(in)o(to)f (dynamic)h(program)e(analysis)i(\(re\015ection\))g(and)f(refactoring.)151 1458 y(Some)21 b(program)f(prop)q(erties)i(cannot)f(alw)o(a)o(ys)f(b)q(e)i(pro)o (v)o(en)f(in)o(v)m(arian)o(t)g(using)h(con)o(v)o(en)o(tional)g(static)151 1515 y(analysis)15 b(tec)o(hniques,)h(but)f(can)f(more)h(easily)g(b)q(e)h(preserv) o(ed)e(dynamically)l(.)22 b(F)l(or)14 b(example,)h(con)o(v)o(en-)151 1571 y (tional)f(static)f(analysis)g(tec)o(hniques)i(ma)o(y)d(not)h(correctly)g(dete\ rmine)h(that)e(a)h(v)m(ariable)h(can)f(safely)h(b)q(e)151 1628 y(designated)k (as)e(an)h(exclusiv)o(e)h(comp)q(onen)o(t;)f(this)g(limits)h(the)f(use)g(of)g (some)f(refactorings)g(requiring)151 1684 y(this)g(as)f(a)h(precondition.)23 b (Dynamically)l(,)17 b(ho)o(w)o(ev)o(er,)d(there)i(is)g(a)f(w)o(a)o(y)g(to)g (ensure)h(that)f(all)i(instances)151 1741 y(assigned)c(to)e(a)h(particular)g (v)m(ariable)h(are)f(not)g(already)g(assigned)g(to)g(another)f(comp)q(onen)o (t:)18 b(asso)q(ciate)151 1797 y(with)h(eac)o(h)g(instance)h(a)f(tag)f(listin\ g)i(its)f(aggregate\(s\),)e(and)i(c)o(hec)o(k)g(this)h(tag)e(when)h(assigning) h(an)151 1854 y(instance)f(as)g(a)f(comp)q(onen)o(t.)30 b(If)19 b(the)f(insta\ nce)h(cannot)g(b)q(e)g(assigned)g(as)f(a)g(comp)q(onen)o(t,)h(create)g(a)151 1910 y(replacemen)o(t)h(or)f(request)h(it)f(from)g(a)g(clien)o(t/serv)o(er.) 33 b(Other)20 b(program)f(prop)q(erties)h(ma)o(y)e(also)i(b)q(e)151 1967 y (easier)e(to)f(preserv)o(e)h(dynamically)h(than)e(to)g(pro)o(v)o(e)g(statical\ ly)l(.)28 b(Refactoring)18 b(an)g(already)f(running)151 2023 y(system)i(adds) h(complications)h(ho)o(w)o(ev)o(er;)g(for)e(example,)i(what)e(should)h(b)q (e)h(done)f(to)f(instances)h(of)151 2079 y(classes)c(that)e(w)o(ere)h(created) g(b)q(efore)h(the)f(classes)h(w)o(ere)f(refactored?)37 2223 y fd(11.5)70 b (Summary)37 2324 y fl(This)18 b(thesis)f(has)f(describ)q(ed)j(one)d(t)o(yp)q (e)h(of)f(step)h(in)g(the)g(ev)o(olution)g(of)f(a)g(program:)22 b(refactoring) 16 b(to)g(mak)o(e)37 2381 y(the)e(program)f(easier)h(to)f(understand,)h(c)o (hange)g(and)f(reuse.)20 b(It)14 b(has)f(describ)q(ed)j(a)d(set)h(of)f(refact\ orings,)g(ho)o(w)37 2437 y(to)k(c)o(hec)o(k)h(that)e(refactorings)h(are)g(leg\ al,)i(and)e(ho)o(w)g(to)g(decomp)q(ose)h(complex)g(refactorings)f(in)o(to)g (simpler)37 2494 y(refactorings.)40 b(It)21 b(could)i(serv)o(e)f(as)f(the)h (basis)g(for)f(a)h fi(softwar)n(e)g(r)n(efactory)p fl(,)h(whic)o(h)g(is)f(a)g (program)e(that)37 2550 y(can)i(refactor)e(another)g(program.)37 b(While)22 b (this)g(thesis)f(has)g(fo)q(cused)h(on)f(refactoring)f(ob)s(ject-orien)o(ted) 941 2760 y(131)g eop bop 37 42 a fl(application)22 b(framew)o(orks,)c(it)i (is)g(lik)o(ely)h(that)e(the)g(refactorings)g(it)h(has)f(describ)q(ed)i(are)e (more)g(generally)37 98 y(applicable.)108 154 y(Program)9 b(ev)o(olution)i (and)f(soft)o(w)o(are)f(reuse)h(are)g(imp)q(ortan)o(t)g(topics)h(that)e(deser\ v)o(e)i(m)o(uc)o(h)f(more)g(atten)o(tion)37 211 y(than)15 b(they)f(ha)o(v)o (e)g(receiv)o(ed)i(th)o(us)e(far.)19 b(While)c(there)g(are)f(still)h(man)o (y)f(problems)h(to)f(solv)o(e)g(b)q(efore)h(to)q(ols)f(lik)o(e)37 267 y(a)g (soft)o(w)o(are)f(refactory)g(b)q(ecome)i(a)e(realit)o(y)l(,)i(they)f(need)h (to)f(b)q(e)g(solv)o(ed)h(to)e(mak)o(e)h(soft)o(w)o(are)e(easier)j(to)e(c)o (hange)37 324 y(and)j(reuse.)k(This)c(thesis)g(is)f(a)g(step)g(in)h(their)g (solution.)941 2760 y(132)g eop bop 17 301 a 30259609 29536011 4933632 11840716 35193241 41376727 startTexFig %!PS-Adobe-2.0 EPSF-1.2 %%DocumentFonts: Times-Roman Times-Bold %%Pages: 1 %%BoundingBox: 75 180 535 629 %%EndComments 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def /numGraphicParameters 17 def /stringLimit 65535 def /Begin { save numGraphicParameters dict begin } def /End { end restore } def /SetB { dup type /nulltype eq { pop false /brushRightArrow idef false /brushLeftArrow idef true /brushNone idef } { /brushDashOffset idef /brushDashArray idef 0 ne /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false /brushNone idef } ifelse } def /SetCFg { /fgblue idef /fggreen idef /fgred idef } def /SetCBg { /bgblue idef /bggreen idef /bgred idef } def /SetF { /printSize idef /printFont idef } def /SetP { dup type /nulltype eq { pop true /patternNone idef } { dup -1 eq { /patternGrayLevel idef /patternString idef } { /patternGrayLevel idef } ifelse false /patternNone idef } ifelse } def /BSpl { 0 begin storexyn newpath n 1 gt { 0 0 0 0 0 0 1 1 true subspline n 2 gt { 0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline } if n 2 sub dup n 1 sub dup 2 copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Circ { newpath 0 360 arc patternNone not { ifill } if brushNone not { istroke } if } def /CBSpl { 0 begin dup 2 gt { storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub { /i exch def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline } for n 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1 false subspline patternNone not { ifill } if brushNone not { istroke } if } { Poly } ifelse end } dup 0 4 dict put def /Elli { 0 begin newpath 4 2 roll translate scale 0 0 1 0 360 arc patternNone not { ifill } if brushNone not { istroke } if end } dup 0 1 dict put def /Line { 0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y 1 get lineto brushNone not { istroke } if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end } dup 0 4 dict put def /MLine { 0 begin storexyn newpath n 1 gt { x 0 get y 0 get moveto 1 1 n 1 sub { /i exch def x i get y i get lineto } for patternNone not brushLeftArrow not brushRightArrow not and and { ifill } if brushNone not { istroke } if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow } if end } dup 0 4 dict put def /Poly { 3 1 roll newpath moveto -1 add { lineto } repeat closepath patternNone not { ifill } if brushNone not { istroke } if } def /Rect { 0 begin /t exch def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t lineto r b lineto closepath patternNone not { ifill } if brushNone not { istroke } if end } dup 0 4 dict put def /Text { ishow } def /idef { dup where { pop pop pop } { exch def } ifelse } def /ifill { 0 begin gsave patternGrayLevel -1 ne { fgred bgred fgred sub patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill } { eoclip originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and { l b translate w h scale w h true [w 0 0 h neg 0 h] { patternproc } imagemask } if } ifelse grestore end } dup 0 8 dict put def /istroke { gsave brushDashOffset -1 eq { [] 0 setdash 1 setgray } { brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor } ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore } def /ishow { 0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont findfont printSize scalefont dup setfont def /descender fontDict begin 0 [FontBBox] 1 get FontMatrix end transform exch pop def /vertoffset 0 descender sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and { 1 add } if def { 0 vertoffset moveto show /vertoffset vertoffset printSize sub def } forall grestore end } dup 0 3 dict put def /patternproc { 0 begin /patternByteLength patternString length def /patternHeight patternByteLength 8 mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub { /y exch def /patternRow y patternByteWidth mul patternByteLength mod def /patternRowString patternString patternRow patternByteWidth getinterval def /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub { /x exch def imageString imageRow x add patternRowString putinterval } for } for imageString end } dup 0 12 dict put def /min { dup 3 2 roll dup 4 3 roll lt { exch } if pop } def /max { dup 3 2 roll dup 4 3 roll gt { exch } if pop } def /arrowhead { 0 begin transform originalCTM itransform /taily exch def /tailx exch def transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath patternNone not { originalCTM setmatrix /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div dup scale arrowheadpath ifill } if brushNone not { originalCTM setmatrix tipx tipy translate angle rotate arrowheadpath istroke } if grestore end } dup 0 9 dict put def /arrowheadpath { newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg arrowWidth 2 div neg lineto closepath } def /leftarrow { 0 begin y exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def x exch get /tipx exch def brushLeftArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /rightarrow { 0 begin y exch get /tipy exch def x exch get /tipx exch def y exch get /taily exch def x exch get /tailx exch def brushRightArrow { tipx tipy tailx taily arrowhead } if end } dup 0 4 dict put def /midpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1 add 2 div y0 y1 add 2 div end } dup 0 4 dict put def /thirdpoint { 0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul y1 add 3 div end } dup 0 4 dict put def /subspline { 0 begin /movetoNeeded exch def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0 thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded { p0x p0y moveto } if p1x p1y p2x p2y p3x p3y curveto end } dup 0 17 dict put def /storexyn { /n exch def /y n array def /x n array def n 1 sub -1 0 { /i exch def y i 3 2 roll put x i 3 2 roll put } for } def %%EndProlog %I Idraw 7 Grid 8 %%Page: 1 1 Begin %I b u %I cfg u %I cbg u %I f u %I p u %I t [ 0.86747 0 0 0.86747 0 0 ] concat /originalCTM matrix currentmatrix def Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 0 116 ] concat %I 90 251 192 384 Rect End Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -4 -348 ] concat %I 458 560 589 609 Rect End Begin %I Rect %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -11 29 ] concat %I 433 280 625 586 Rect End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 513 243 49 27 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 517 349 75 40 Elli End Begin %I Elli %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 513 448 42 25 Elli End Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 458 560 589 609 Rect End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 469 710 ] concat %I [ (PROGRAM TO BE) (REFACTORED) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 473 247 ] concat %I [ (REFACTORED) (PROGRAM) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 484 566 ] concat %I [ (PARSER) ] Text End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -11 29 ] concat %I 524 503 524 481 Line End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 0 SetP %I t [ 1 0 0 1 -12 -85.9999 ] concat %I 524 503 524 481 Line End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -17 67 ] concat %I 538 589 538 559 Line End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 -23 -287 ] concat %I 538 589 538 559 Line End Begin %I Rect %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 93 4.0001 ] concat %I 85 496 86 496 Rect End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-bold-r-*-140-* /Times-Bold 14 SetF %I t [ 1 0 0 1 124 438 ] concat %I [ (USER) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 213 496 ] concat %I [ (REFACTORING COMMANDS) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 239 432 ] concat %I [ (UPDATES DISPLAYED) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 213 390 ] concat %I [ (PRINT COMMANDS) ] Text End Begin %I Line %I b 65535 1 0 1 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 32 -29 ] concat %I 183 404 379 404 Line End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 470 467 ] concat %I [ (REFACTORER) ] Text End Begin %I Text %I cfg Black 0 0 0 SetCFg %I f *-times-medium-r-*-140-* /Times-Roman 14 SetF %I t [ 1 0 0 1 485 368 ] concat %I [ (PRETTY) (PRINTER) ] Text End Begin %I Rect %I b 65535 1 0 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 126 192 128 192 Rect End Begin %I BSpl %I b 65535 1 1 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1 113 ] concat %I 4 404 355 303 367 211 357 211 357 4 BSpl End Begin %I BSpl %I b 65535 1 1 0 [] 0 SetB %I cfg Black 0 0 0 SetCFg %I cbg White 1 1 1 SetCBg %I p 1 SetP %I t [ 1 0 0 1 1.99998 108 ] concat %I 3 211 338 312 328 405 338 3 BSpl End End %I eop showpage %%Trailer end endTexFig 540 2300 a fh(Figure)17 b(11.1)p fl(:)j(Soft)o(w)o(are)14 b (Refactoring)h(Pro)q(cess)941 2760 y(133)g eop bop 37 374 a fb(Bibli)q(og)q (raph)m(y)83 596 y fl([1])22 b(Alfred)d(V.)e(Aho,)i(Ra)o(vi)g(Sethi,)g(and)f (Je\013rey)g(D.)g(Ullman.)30 b fi(Compilers:)25 b(Principles,)19 b(T)m(e)n (chniques,)154 653 y(and)d(T)m(o)n(ols)p fl(.)i(Addison-W)l(esley)l(,)f(1986.) 83 746 y([2])22 b(E.)e(Allman)j(and)e(M.)g(Stonebrak)o(er.)37 b(Observ)m(atio\ ns)22 b(on)g(the)f(ev)o(olution)h(of)f(a)g(soft)o(w)o(are)e(system.)154 803 y fi(Computer)p fl(,)c(15\(6\):27{32,)d(June)k(1982.)83 897 y([3])22 b(Rob)q (ert)h(S.)g(Arnold.)45 b(An)24 b(in)o(tro)q(duction)g(to)f(soft)o(w)o(are)e (restructuring.)45 b fi(T)m(utorial)23 b(on)g(Softwar)n(e)154 953 y(R)n(estru\ cturing)16 b(\(R)n(ob)n(ert)g(S.)f(A)o(rnold,)h(e)n(d.\))p fl(,)e(1986.)83 1047 y([4])22 b(E.)15 b(Ashcroft)f(and)i(Z.)f(Manna.)20 b(The)15 b(translatio\ n)h(of)e(\\goto")g(programs)g(in)i(\\while")h(programs.)i(In)154 1103 y fi (Pr)n(o)n(c)n(e)n(e)n(dings)13 b(of)k(the)f(1971)i(IFIP)c(Congr)n(ess)p fl (,)f(pages)i(250{260.)e(North-Holland,)j(1971.)83 1197 y([5])22 b(A)l(T&T.)e fi(UNIX)15 b(System)h(V)g(User)f(R)n(efer)n(enc)n(e)g(Manual)p fl(.)20 b(A)l (T&T,)15 b(1984.)83 1291 y([6])22 b(Maurice)15 b(J.)g(Bac)o(h.)20 b fi(The)c (Design)g(of)g(the)h(UNIX)e(Op)n(er)n(ating)g(System)p fl(.)k(Pren)o(tice)d (Hall,)g(1986.)83 1385 y([7])22 b(B.)15 b(S.)h(Bak)o(er.)22 b(An)17 b(algorit\ hm)f(for)f(structured)h(programs.)21 b fi(Journal)c(of)h(the)f(A)o(CM)p fl (,)d(24\(1\):98{120,)154 1441 y(1977.)83 1535 y([8])22 b(Rob)q(ert)j(Balzer.) 48 b(A)25 b(\014fteen-y)o(ear)f(p)q(ersp)q(ectiv)o(e)j(on)d(automatic)g(progr\ amming.)47 b(In)25 b fi(Softwar)n(e)154 1592 y(R)n(eusability)15 b(-)i(V)m (olume)f(II:)f(Applic)n(ations)g(and)i(Exp)n(erienc)n(e)p fl(,)c(pages)i(289{\ 311,)e(1989.)83 1685 y([9])22 b(Ja)o(y)11 b(Banerjee)g(and)h(W)l(on)f(Kim.)j (Seman)o(tics)e(and)f(implemen)o(tation)i(of)e(sc)o(hema)g(ev)o(olution)h(in) g(ob)s(ject-)154 1742 y(orien)o(ted)j(databases.)k(In)d fi(Pr)n(o)n(c)n(e)n (e)n(dings)e(of)j(the)f(A)o(CM)f(SIGMOD)h(Confer)n(enc)n(e)p fl(,)c(1987.)60 1836 y([10])22 b(D.)13 b(R.)h(Barsto)o(w,)e(H.)i(E.)f(Shrob)q(e,)i(and)f(E.)f (Sandew)o(all.)19 b fi(Inter)n(active)14 b(Pr)n(o)n(gr)n(amming)h(Envir)n(onm\ ents)p fl(.)154 1892 y(McGra)o(w-Hill,)g(1984.)60 1986 y([11])22 b(V.)c(Basil\ i.)32 b fi(T)m(utorial)19 b(on)g(Mo)n(dels)f(and)i(Metrics)f(for)g(Softwar)n (e)h(Management)f(and)g(Engine)n(ering)p fl(.)154 2042 y(IEEE)c(Computer)g (So)q(ciet)o(y)h(Press,)e(1980.)60 2136 y([12])22 b(Carol)13 b(Sue)h(Bec)o (kman-Da)o(vies.)k fi(Finding)13 b(Pr)n(o)n(gr)n(am)i(Di\013er)n(enc)n(es)e (Base)n(d)h(on)h(Syntactic)f(T)m(r)n(e)n(e)f(Struc-)154 2193 y(tur)n(e)p fl (.)20 b(PhD)15 b(thesis,)g(Univ)o(ersit)o(y)h(of)f(Illinois)j(at)c(Urbana-Cha\ mpaign,)h(1989.)60 2286 y([13])22 b(Boris)15 b(Beizer.)21 b fi(Softwar)n(e)16 b(T)m(esting)f(T)m(e)n(chniques)p fl(.)j(V)l(an)d(Nostrand)g(Reinhold,)i(1983\ .)60 2380 y([14])22 b(G.)10 b(D.)g(Bergland.)k(A)e(guided)g(tour)e(of)h(progr\ am)f(design)i(metho)q(dologies.)i fi(Computer)p fl(,)e(14\(10\):18{37,)154 2437 y(Octob)q(er)j(1981.)60 2531 y([15])22 b(P)o(aul)16 b(L.)h(Bergstein.)24 b(Ob)s(ject-preserving)17 b(class)g(transformations.)22 b(In)17 b fi(Pr)n(o)n (c)n(e)n(e)n(dings)e(of)i(OOPSLA)154 2587 y(`91)p fl(,)e(1991.)941 2760 y(134) g eop bop 60 42 a fl([16])22 b(T)l(ed)15 b(Biggersta\013)g(and)g(Charles)h (Ric)o(h)o(ter.)k(Reusabilit)o(y)e(framew)o(ork,)13 b(assessmen)o(t,)h(and)i (directions.)154 98 y fi(T)m(utorial:)k(Softwar)n(e)d(R)n(euse)e(-)i(Emer)n (ging)e(T)m(e)n(chnolo)n(gy)g(\(Wil)r(l)g(T)m(r)n(acz,)g(e)n(d.\))p fl(,)f (1988.)60 189 y([17])22 b(T)l(ed)17 b(J.)g(Biggersta\013.)25 b(Design)18 b (reco)o(v)o(ery)e(for)h(main)o(tenance)g(and)h(reuse.)26 b fi(IEEE)17 b(Compu\ ter)p fl(,)h(pages)154 246 y(36{49,)13 b(July)j(1989.)60 337 y([18])22 b(T)l (ed)c(J.)g(Biggersta\013)g(and)g(Alan)h(J.)f(P)o(erlis)h(\(eds\).)29 b fi(Sof\ twar)n(e)19 b(R)n(eusability)f(-)i(V)m(olume)e(I:)h(Conc)n(epts)154 393 y(and) d(Mo)n(dels)p fl(.)j(Addison-W)l(esley)e(Publishing)h(Compan)o(y)l(,)c(Inc.,) h(1989.)60 485 y([19])22 b(T)l(ed)10 b(J.)h(Biggersta\013)e(and)h(Charles)h (Ric)o(h)o(ter.)h(Reusabilit)o(y)h(framew)o(ork,)c(assessmen)o(t,)h(and)h(dir\ ections.)154 541 y(In)k fi(Softwar)n(e)i(R)n(eusability)f(-)g(V)m(olume)g(I:) g(Conc)n(epts)f(and)h(Mo)n(dels)p fl(,)e(pages)h(1{19,)e(1989.)60 633 y([20]) 22 b(C.)13 b(Bohm)h(and)g(G.)f(Jacopini.)19 b(Flo)o(w)13 b(diagrams,)h(turing) g(mac)o(hines,)g(and)g(languages)g(with)g(only)h(t)o(w)o(o)154 689 y(formatio\ n)f(rules.)21 b fi(Communic)n(ations)15 b(of)i(the)f(A)o(CM)p fl(,)e(9\(5\):3\ 66{371)o(,)e(Ma)o(y)i(1966.)60 780 y([21])22 b(Grady)14 b(Bo)q(o)q(c)o(h.)20 b fi(Obje)n(ct-Oriente)n(d)c(Design)p fl(.)j(Benjamin/Cummings,)c(1990.)60 872 y ([22])22 b(P)l(.)g(Borras)f(and)h(D.)g(Clemen)o(t.)41 b(Cen)o(taur:)33 b(the) 22 b(system.)41 b(In)22 b fi(Pr)n(o)n(c)n(e)n(e)n(dings)f(of)h(the)h(A)o(CM)f (SIG-)154 928 y(SOFT/SIGPLAN)16 b(Softwar)n(e)j(Engine)n(ering)e(Symp)n(osium) i(on)g(Pr)n(actic)n(al)f(Softwar)n(e)i(Development)154 985 y(Envir)n(onments) p fl(,)13 b(pages)i(14{24,)e(1988.)60 1076 y([23])22 b(James)17 b(M.)g(Bo)o (yle.)27 b(Abstract)17 b(programming)g(and)g(program)g(transformation)f(-)i (an)f(approac)o(h)g(to)154 1132 y(reusing)f(programs.)k(In)c fi(Softwar)n(e)h (R)n(eusability)f(-)h(V)m(olume)f(I:)g(Conc)n(epts)f(and)i(Mo)n(dels)p fl(,)d (pages)i(361{)154 1189 y(414,)e(1989.)60 1280 y([24])22 b(F)l(rederic)o(k)f (P)l(.)f(Bro)q(oks.)36 b(No)20 b(silv)o(er)i(bullet)g(-)e(essence)i(and)f(acc\ iden)o(ts)g(of)f(soft)o(w)o(are)f(engineering.)154 1337 y fi(IEEE)c(Computer) p fl(,)g(pages)g(10{19,)f(April)i(1987.)60 1428 y([25])22 b(P)l(.)14 b(J.)h (Bro)o(wn.)k(Wh)o(y)c(do)q(es)g(soft)o(w)o(are)e(die?)26 b fi(Infote)n(ch)15 b (State)h(of)h(the)f(A)o(rt)g(R)n(ep)n(ort)p fl(,)e(8\(7\):32{45,)e(1980.)60 1519 y([26])22 b(K.)10 b(Burns.)j(Using)e(automated)f(tec)o(hniques)i(to)e (impro)o(v)o(e)h(the)f(main)o(tainabilit)o(y)j(of)d(existing)i(soft)o(w)o(are\ .)154 1576 y(In)j fi(DSSD)h(User's)g(Confer)n(enc)n(e/6)e(-)j(Maintenanc)n (e)p fl(,)c(pages)i(33{39,)e(1981.)60 1667 y([27])22 b(R.)g(M.)f(Burstall)i (and)f(J.)g(Darlington.)40 b(A)22 b(transformation)f(system)h(for)f(dev)o(elo\ ping)j(recursiv)o(e)154 1723 y(programs.)18 b fi(Journal)f(of)f(the)h(A)o(CM) p fl(,)c(24\(1\):44{67,)f(1977.)60 1815 y([28])22 b(M.)15 b(H.)h(Burstein.)23 b(Concept)16 b(formation)g(b)o(y)g(incremen)o(tal)h(analogical)g(reasoning)g (and)f(debugging.)154 1871 y fi(Machine)g(L)n(e)n(arning:)21 b(A)o(n)16 b(A)o (rti\014cial)g(Intel)r(ligenc)n(e)f(Appr)n(o)n(ach)i(\(R.S.)f(Michalski,)h (J.)g(G.)g(Carb)n(onel)r(l)154 1928 y(and)f(T.)g(M.)g(Mitchel)r(l,)f(e)n(ds\)) p fl(,)f(2:351{370,)e(1986.)60 2019 y([29])22 b(R.)15 b(Canning.)20 b(Rejuv)o (enate)c(y)o(our)f(old)h(systems.)j fi(EDP)d(A)o(nalyzer)p fl(,)e(22\(3\):1{1\ 6,)d(Marc)o(h)k(1984.)60 2110 y([30])22 b(Eduardo)f(Casais.)36 b fi(R)n(e)n (or)n(ganizing)20 b(an)h(Obje)n(ct)g(System)p fl(,)h(pages)f(161{189.)35 b (Cen)o(tre)20 b(Univ)o(ersitair)154 2167 y(d'Informatique,)15 b(Univ)o(ersite) h(de)g(Genev)o(e,)f(1989.)60 2258 y([31])22 b(Eduardo)15 b(Casais.)k fi(Manag\ ing)c(Evolution)h(in)g(Obje)n(ct)g(Oriente)n(d)f(Envir)n(onments:)k(A)o(n)d (A)o(lgorithmic)154 2314 y(Appr)n(o)n(ach)p fl(.)k(PhD)15 b(thesis,)g(Univ)o (ersit)o(y)h(of)f(Genev)m(a,)g(1991.)60 2406 y([32])22 b(Mic)o(hael)h(J.)g (Ca)o(v)m(aliere.)44 b(Reusable)24 b(co)q(de)f(at)g(the)f(Hartford)g(Insuranc\ e)i(Group.)42 b(In)23 b fi(Softwar)n(e)154 2462 y(R)n(eusability)15 b(-)i(V)m (olume)f(II:)f(Applic)n(ations)g(and)i(Exp)n(erienc)n(e)p fl(,)c(pages)i(131{\ 142,)e(1989.)60 2554 y([33])22 b(Thomas)j(E.)g(Cheatham.)50 b(Reusabilit)o (y)28 b(through)d(program)g(transformations.)49 b(In)26 b fi(Softwar)n(e)154 2610 y(R)n(eusability)15 b(-)i(V)m(olume)f(I:)g(Conc)n(epts)f(and)h(Mo)n(dels) p fl(,)e(pages)h(321{336,)e(1989.)941 2760 y(135)g eop bop 60 42 a fl([34])22 b(Elliot)11 b(J.)g(Chik)o(ofsky)l(.)h(Rev)o(erse)f(engineering)h(and)e(design) i(reco)o(v)o(ery:)17 b(A)10 b(taxonom)o(y)l(.)h fi(IEEE)g(Softwar)n(e)p fl (,)154 98 y(pages)k(13{17,)e(Jan)o(uary)i(1990.)60 192 y([35])22 b(Song)12 b (C.)g(Choi)h(and)g(W)l(alt)g(Scacc)o(hi.)k(Extracting)12 b(and)h(restructurin\ g)g(the)g(design)g(of)g(large)f(systems.)154 248 y fi(IEEE)j(Softwar)n(e)p fl (,)g(pages)g(66{71,)e(Jan)o(uary)i(1990.)60 342 y([36])22 b(P)o(eter)14 b(Coa\ d)h(and)g(Ed)h(Y)l(ourdon.)k fi(OO)o(A)15 b(-)i(Obje)n(ct-Oriente)n(d)e(A)o (nalysis)p fl(.)j(Pren)o(tice-Hall,)f(1990.)60 436 y([37])22 b(Departmen)o (t)13 b(of)g(Electrical)j(Engineering)f(Computer)f(Science)i(Division)f(and)f (Computer)g(Science.)154 492 y fi(UNIX)j(Pr)n(o)n(gr)n(ammer's)g(Manual,)h (4.2)h(Berkeley)e(Softwar)n(e)h(Distribution,)h(Virtual)f(V)-5 b(AX-11)19 b (V)m(er-)154 549 y(sion)p fl(.)g(Univ)o(ersit)o(y)d(of)e(California)i(at)f (Berk)o(eley)l(,)h(August)f(1983.)60 643 y([38])22 b(Curtis,)13 b(Krasner,)h (and)f(Isco)q(e.)18 b(A)c(\014eld)h(study)e(of)g(the)h(soft)o(w)o(are)e(desig\ n)i(pro)q(cess)g(for)f(large)g(systems.)154 699 y(Comm)o(unications)i(of)g (the)g(A)o(CM)g(31:11,)e(pages)i(1268{1287,)d(1988.)60 793 y([39])22 b(N.)17 b (Dersho)o(witz.)25 b(Programming)16 b(b)o(y)h(analogy)l(.)26 b fi(Machine)18 b (L)n(e)n(arning:)23 b(A)o(n)17 b(A)o(rti\014cial)g(Intel)r(ligenc)n(e)154 849 y(Appr)n(o)n(ach)f(\(R.S.)g(Michalski,)f(J.)h(G.)g(Carb)n(onel)r(l)g(and)g (T.)g(M.)f(Mitchel)r(l,)h(e)n(ds\))p fl(,)e(2:395{424,)e(1986.)60 943 y([40]) 22 b(L.)15 b(P)o(eter)g(Deutsc)o(h.)21 b(Design)16 b(reuse)f(and)h(framew)o (orks)e(in)i(the)g(Smalltalk-80)g(system.)k(In)c fi(Softwar)n(e)154 1000 y (R)n(eusability)f(-)i(V)m(olume)f(II:)f(Applic)n(ations)g(and)i(Exp)n(erienc) n(e)p fl(,)c(pages)i(57{72,)f(1989.)60 1093 y([41])22 b(Margaret)h(A.)i(Ellis) i(and)f(Bjarne)f(Stroustrup.)50 b fi(The)25 b(A)o(nnotate)n(d)g(C++)g(R)n(efe\ r)n(enc)n(e)f(Manual)p fl(.)154 1150 y(Addison-W)l(esley)17 b(Publishing)h (Co.,)c(Reading,)i(MA,)e(1990.)60 1244 y([42])22 b(M.)17 b(F)l(agan.)27 b(Des\ ign)18 b(and)g(co)q(de)h(insp)q(ection)h(to)d(reduce)i(errors)e(in)i(program) e(dev)o(elopmen)o(t.)28 b fi(IBM)154 1300 y(Systems)15 b(Journal)p fl(,)g(15\ \(3\):182{21)o(2,)d(1976.)60 1394 y([43])22 b(Martin)f(S.)g(F)l(eather.)38 b (Reuse)23 b(in)f(the)g(con)o(text)e(of)h(a)h(transformation-based)e(metho)q (dology)l(.)39 b(In)154 1450 y fi(Softwar)n(e)16 b(R)n(eusability)g(-)g(V)m (olume)g(I:)g(Conc)n(epts)f(and)h(Mo)n(dels)p fl(,)e(pages)h(337{360,)e(1989.) 60 1544 y([44])22 b(Charles)10 b(N.)h(Fisc)o(her)f(and)h(Jr.)f(Ric)o(hard)i (J.)e(LeBlanc.)k fi(Cr)n(afting)d(a)h(Compiler)p fl(.)g(Benjamin)f(Cummings,) 154 1601 y(1988.)60 1694 y([45])22 b(Gerhard)13 b(Fisc)o(her.)18 b(Cognitiv)o (e)c(view)g(of)f(reuse)h(and)g(redesign.)k fi(IEEE)c(Softwar)n(e)p fl(,)f(4\(\ 4\):60{72,)e(1987.)60 1788 y([46])22 b(Brian)h(F)l(o)q(ote.)42 b fi(A)o(n)22 b (Obje)n(ct-Oriente)n(d)g(F)m(r)n(amework)h(for)h(R)n(e\015e)n(ctive)e(Meta-L) n(evel)g(A)o(r)n(chite)n(ctur)n(es)p fl(.)154 1845 y(Ph.D.)14 b(thesis)i(in)g (preparation,)f(Univ)o(ersit)o(y)g(of)g(Illinois)j(at)d(Urbana-Champaign.)60 1939 y([47])22 b(D.)c(F)l(reedman)i(and)g(G.)e(W)l(ein)o(b)q(erg.)34 b fi(Han\ db)n(o)n(ok)20 b(of)g(Walkthr)n(oughs,)i(Insp)n(e)n(ctions)c(and)i(T)m(e)n (chnic)n(al)154 1995 y(R)n(eviews)15 b(\(3r)n(d)h(Edition\))p fl(.)k(Little)c (Bro)o(wn,)e(1982.)60 2089 y([48])22 b(Adele)g(Goldb)q(erg.)38 b fi(Smal)r (ltalk-80:)32 b(The)21 b(Inter)n(active)f(Pr)n(o)n(gr)n(amming)h(Envir)n(onme\ nt)p fl(.)36 b(Addison-)154 2145 y(W)l(esley)l(,)16 b(Reading,)g(Massac)o(h)o (usetts,)d(1984.)60 2239 y([49])22 b(Adele)14 b(Goldb)q(erg)g(and)g(Da)o(vid) f(Robson.)k fi(Smal)r(ltalk-80:)j(The)14 b(L)n(anguage)g(and)g(its)h(Implemen\ tation)p fl(.)154 2296 y(Addison-W)l(esley)l(,)i(Reading,)f(Massac)o(h)o(uset\ ts,)d(1983.)60 2389 y([50])22 b(J.)10 b(E.)g(Grass)f(and)h(Y.)g(F.)f(Chen.)k (The)d(C++)h(Information)f(Abstractor.)g(In)h fi(Usenix)g(C++)g(Confer)n(enc) n(e)154 2446 y(Pr)n(o)n(c)n(e)n(e)n(dings)p fl(,)h(pages)j(265{278,)e(San)i (F)l(rancisco,)g(CA,)g(April)i(1990.)60 2540 y([51])22 b(R.)13 b(Greiner.)k (Learning)d(b)o(y)f(understanding)h(analogies.)j fi(A)o(rti\014cial)d(Intel)r (ligenc)n(e)p fl(,)c(35:81{125,)h(1988.)941 2760 y(136)g eop bop 60 42 a fl ([52])22 b(William)c(G.)e(Grisw)o(old.)23 b fi(Pr)n(o)n(gr)n(am)17 b(R)n(estr\ ucturing)h(as)f(an)g(A)o(id)g(in)g(Softwar)n(e)h(Maintenanc)n(e)p fl(.)k(PhD) 154 98 y(thesis,)15 b(Univ)o(ersit)o(y)h(of)f(W)l(ashington,)g(1991.)60 192 y ([53])22 b(Daniel)13 b(C.)f(Halb)q(ert)i(and)e(P)o(atric)o(k)g(D.)g(O'Brien.) 17 b(Using)c(t)o(yp)q(es)g(and)g(inheritance)h(in)f(ob)s(ject-orien)o(ted)154 248 y(programs.)18 b fi(IEEE)e(Softwar)n(e)p fl(,)e(pages)h(71{79,)f(Septem)o (b)q(er)i(1987.)60 342 y([54])22 b(P)o(atric)o(k)e(A.)g(V.)g(Hall)h(and)g(Geo\ \013)f(R.)g(Do)o(wling.)36 b(Appro)o(ximate)20 b(string)h(matc)o(hing.)35 b fi (Computing)154 399 y(Surveys)p fl(,)14 b(12\(4\):381{402)o(,)e(Decem)o(b)q (er)k(1980.)60 492 y([55])22 b(Mehdi)14 b(T.)f(Harandi)h(and)f(Jim)i(Q.)e(Nin\ g.)k(Kno)o(wledge-based)e(program)e(analysis.)k fi(IEEE)d(Softwar)n(e)p fl (,)154 549 y(pages)h(74{81,)e(Jan)o(uary)i(1990.)60 643 y([56])22 b(M.)13 b (S.)h(Hec)o(h)o(t)f(and)i(J.)f(D.)f(Ullman.)19 b(Flo)o(w)13 b(graph)h(reducab\ ilit)o(y)l(.)20 b fi(SIAM)14 b(J.)h(Computing)p fl(,)e(1:188{202,)154 699 y (1972.)60 793 y([57])22 b(Apple)16 b(Computer)f(Inc.)21 b fi(Lisa)15 b(T)m (o)n(olkit)g(3.0)p fl(.)20 b(Apple)d(Computer,)d(1984.)60 887 y([58])22 b(Wil\ liam)d(A.)e(Jindric)o(h.)28 b(F)l(oible:)d(A)17 b(framew)o(ork)f(for)h(visual) h(programming)f(languages.)26 b(Master's)154 943 y(thesis,)15 b(Univ)o(ersit) o(y)h(of)f(Illinois)j(at)c(Urbana-Champaign,)h(1990.)60 1037 y([59])22 b(Ralp\ h)12 b(E.)e(Johnson)i(and)f(Brian)h(F)l(o)q(ote.)g(Designing)g(reusable)g(cla\ sses.)i fi(Journal)e(of)h(Obje)n(ct-Oriente)n(d)154 1093 y(Pr)n(o)n(gr)n(ammi\ ng)p fl(,)h(1\(2\):22{35,)e(1988.)60 1187 y([60])22 b(Ralph)f(E.)e(Johnson,)i (Justin)f(O.)g(Gra)o(v)o(er,)f(and)h(La)o(wrence)g(W.)f(Zura)o(wski.)33 b(TS:) 19 b(An)h(optimizing)154 1244 y(compiler)g(for)f(Smalltalk.)33 b(In)20 b fi (Pr)n(o)n(c)n(e)n(e)n(dings)e(of)i(OOPSLA)e(`88)p fl(,)i(pages)g(18{26,)e(No) o(v)o(em)o(b)q(er)h(1988.)154 1300 y(prin)o(ted)d(as)e(SIGPLAN)i(Notices,)g (23\(11\).)60 1394 y([61])22 b(W.)14 b(Lewis)i(Johnson)g(and)f(Martin)g(F)l (eather.)k(Building)f(an)d(ev)o(olution)g(transformation)f(library)l(.)21 b (In)154 1450 y fi(Pr)n(o)n(c)n(e)n(e)n(dings)10 b(of)j(the)g(12th)g(Internati\ onal)f(Confer)n(enc)n(e)f(on)h(Softwar)n(e)h(Engine)n(ering)p fl(,)d(pages)h (238{247,)154 1507 y(1990.)60 1601 y([62])22 b(Guy)16 b(L.)h(Steele)h(Jr.)25 b fi(Common)18 b(LISP:)e(The)h(L)n(anguage)h(\(2r)n(d)f(Edition\))p fl(.)24 b (Digital)18 b(Press,)f(Bedford,)154 1657 y(MA,)d(1990.)60 1751 y([63])22 b (Simon)c(M.)f(Kaplan.)27 b(Co)q(ed:)e(Con)o(v)o(ersation-orien)o(ted)17 b(sof\ t)o(w)o(are)f(en)o(vironmen)o(ts.)27 b(In)18 b fi(Pr)n(o)n(c)n(e)n(e)n(dings) 154 1807 y(of)e(IFIP)g(Confer)n(enc)n(e)e(on)i(Human)h(F)m(ac)n(ors)f(in)g (Information)g(Systems)p fl(,)e(Sc)o(harding,)i(Austia.,)f(June)154 1864 y (1990.)60 1958 y([64])22 b(S.)10 b(T.)h(Kedar-Cab)q(elli.)k(Purp)q(ose-direct\ ed)e(analogy)l(.)f(In)g fi(Pr)n(o)n(c)n(e)n(e)n(dings)e(Seventh)h(A)o(nnual)h (Confer)n(enc)n(e)154 2014 y(of)k(the)h(Co)n(gnitive)e(Scienc)n(e)f(So)n(ciet\ y)p fl(,)g(Irvine,)i(CA,)f(August)g(1985.)60 2108 y([65])22 b(B.)13 b(W.)f (Kernighan)j(and)e(P)l(.)g(J.)g(Plauger.)k fi(Elements)d(of)g(Pr)n(o)n(gr)n (amming)g(Style)p fl(.)i(McGra)o(w-Hill,)e(1974.)60 2202 y([66])22 b(W)l(on) 15 b(Kim.)20 b fi(Intr)n(o)n(duction)c(to)h(Obje)n(ct-Oriente)n(d)e(Datab)n (ases)p fl(.)k(MIT)c(Press,)g(1990.)60 2296 y([67])22 b(S.)f(R.)h(Kosara)s (ju.)39 b(Analysis)23 b(of)f(structured)g(programs.)38 b fi(Journal)23 b(of)f (Computer)i(and)e(System)154 2352 y(Scienc)n(es)p fl(,)12 b(9\(3\):232{255,)g (1974.)60 2446 y([68])22 b(Rob)q(ert)16 b(G.)f(Lanergan)h(and)h(Charles)f(A.) g(Grasso.)21 b(Soft)o(w)o(are)14 b(engineering)k(with)f(reusable)g(designs) 154 2502 y(and)f(co)q(de.)22 b(In)16 b fi(Softwar)n(e)h(R)n(eusability)g(-)g (V)m(olume)f(II:)g(Applic)n(ations)g(and)h(Exp)n(erienc)n(e)p fl(,)d(pages)i (187{)154 2559 y(196,)e(1989.)941 2760 y(137)g eop bop 60 42 a fl([69])22 b (Karl)c(Lieb)q(erherr.)28 b fi(Conc)n(epts)17 b(of)i(Obje)n(ct-Oriente)n(d)e (Data)i(Mo)n(deling)e(and)i(Pr)n(o)n(gr)n(amming)p fl(.)26 b(A)o(CM,)154 98 y (1991.)18 b(Presen)o(ted)e(as)f(T)l(utorial)g(No.)g(16)f(at)h(OOPSLA)h('91.) 60 188 y([70])22 b(Karl)12 b(Lieb)q(erherr,)i(W)l(alter)d(J.)h(Hursc)o(h,)g (and)g(Cun)g(Xiao.)i(Ob)s(ject-extending)f(class)f(transformations)154 244 y (\(draft\).)37 b(T)l(ec)o(hnical)23 b(rep)q(ort,)f(College)h(of)e(Computer)g (Science,)j(Northeastern)d(Univ)o(ersit)o(y)l(,)i(360)154 301 y(Hun)o(tington) 15 b(Av)o(e.,)g(Boston)f(MA)h(02115,)e(1991.)60 391 y([71])22 b(Karl)13 b(J.) g(Lieb)q(erherr)h(and)f(Ian)h(M.)e(Holland.)17 b(Assuring)c(go)q(o)q(d)g(st)o (yle)g(for)f(ob)s(ject-orien)o(ted)h(programs.)154 447 y fi(IEEE)i(Softwar)n (e)p fl(,)g(pages)g(38{48,)e(Septem)o(b)q(er)j(1989.)60 537 y([72])22 b(Karl) g(J.)f(Lieb)q(erherr,)k(Ian)d(M.)e(Holland,)k(and)e(A.)f(Riel.)41 b(Ob)s(ject\ -orien)o(ted)22 b(programming:)32 b(An)154 594 y(ob)s(jectiv)o(e)14 b(sense)h (of)e(st)o(yle.)19 b(In)14 b fi(Pr)n(o)n(c)n(e)n(e)n(dings)f(of)j(OOPSLA)e (`88)p fl(,)g(pages)g(323{334,)e(Septem)o(b)q(er)j(1988.)60 684 y([73])22 b (R.)13 b(C.)f(Linger,)i(H.)e(D.)h(Mills,)h(and)f(R.)g(J.)g(Witt.)j fi(Structu\ r)n(e)n(d)e(Pr)n(o)n(gr)n(amming:)19 b(The)n(ory)14 b(and)h(Pr)n(actic)n(e)p fl(.)154 740 y(Addison-W)l(esley)l(,)i(1979.)60 830 y([74])22 b(Barbara)d(Lis\ k)o(o)o(v.)36 b(Data)20 b(abstraction)g(and)h(hierarc)o(h)o(y)l(.)36 b(In)21 b fi(A)n(ddendum)h(to)f(the)h(Pr)n(o)n(c)n(e)n(e)n(dings)c(of)154 887 y(OOPSLA) c(`87)p fl(,)h(1987.)60 976 y([75])22 b(M.)14 b(J.)h(Ly)o(ons.)20 b(Salv)m (aging)c(y)o(our)e(soft)o(w)o(are)g(asset)g(\(to)q(ols)h(based)g(main)o(tanan\ ce\).)20 b(In)c fi(Pr)n(o)n(c)n(e)n(e)n(dings)d(of)154 1033 y(the)j(National) g(Computer)h(Confer)n(enc)n(e)d(1981)p fl(,)i(pages)f(337{341.)e(AFIPS)i(Pres\ s,)g(1981.)60 1123 y([76])22 b(P)o(eter)g(W.)f(Madan)o(y)l(.)41 b fi(A)o(n)22 b(Obje)n(ct-Oriente)n(d)g(F)m(r)n(amework)g(for)i(File)e(System)p fl(.)40 b (Ph.D.)22 b(thesis)h(in)154 1179 y(preparation,)14 b(Univ)o(ersit)o(y)i(of)f (Illinois)j(at)d(Urbana-Champaign.)60 1269 y([77])22 b(P)o(eter)14 b(W.)g(Mad\ an)o(y)l(,)g(Ro)o(y)g(H.)g(Campb)q(ell,)i(Vincen)o(t)g(F.)e(Russo,)g(and)h (Douglas)f(E.)g(Ley)o(ens.)20 b(A)14 b(Class)154 1326 y(Hierarc)o(h)o(y)c(for) g(Building)j(Stream-Orien)o(ted)f(File)g(Systems.)g(In)f fi(Pr)n(o)n(c)n(e)n (e)n(dings)e(of)k(the)f(1989)h(Eur)n(op)n(e)n(an)154 1382 y(Confer)n(enc)n (e)h(on)i(Obje)n(ct-Oriente)n(d)f(Pr)n(o)n(gr)n(amming)p fl(,)f(Nottingham,)h (UK,)g(July)h(1989.)60 1472 y([78])22 b(J.)i(Martin)h(and)g(C.)f(McClure.)48 b fi(Softwar)n(e)25 b(Maintenanc)n(e:)37 b(The)25 b(Pr)n(oblem)f(and)h(Its)f (Solution)p fl(.)154 1529 y(Pren)o(tice-Hall,)16 b(1983.)60 1619 y([79])22 b (Bertrand)15 b(Mey)o(er.)k fi(Obje)n(ct-oriente)n(d)d(Softwar)n(e)g(Construct\ ion)p fl(.)j(Pren)o(tice)d(Hall,)g(1988.)60 1709 y([80])22 b(W)l(are)14 b(Mey) o(ers.)20 b(In)o(terview)c(with)f(Wilma)h(Osb)q(orne.)k fi(IEEE)c(Softwar)n (e)p fl(,)f(5\(3\):104{10)o(5,)d(1988.)60 1799 y([81])22 b(Scott)10 b(Mey)o (ers)h(Moises)h(Lejter)f(and)g(Stev)o(en)h(P)l(.)f(Reiss.)k(Supp)q(ort)c(for) g(Main)o(taining)h(Ob)s(ject-Orien)o(ted)154 1855 y(Programs.)22 b(In)17 b fi (Pr)n(o)n(c)n(e)n(e)n(dings)e(of)i(the)h(1991)h(Confer)n(enc)n(e)c(on)i(Softw\ ar)n(e)h(Maintenanc)n(e)p fl(,)c(pages)j(171{)154 1911 y(178,)d(Sorren)o(to,) g(Italy)l(,)h(Octob)q(er)h(1991.)60 2001 y([82])22 b(H.)e(W.)f(Morgan.)35 b (Ev)o(olution)20 b(of)g(a)g(soft)o(w)o(are)f(main)o(tenance)i(to)q(ol.)35 b (In)21 b fi(Pr)n(o)n(c)n(e)n(e)n(dings)e(of)i(the)g(2nd)154 2058 y(National) 14 b(Confer)n(enc)n(e)f(on)i(EDP)g(Softwar)n(e)g(Maintenanc)n(e)p fl(,)c(page\ s)j(268{278.)d(US)j(Professional)g(De-)154 2114 y(v)o(elopmen)o(t)h(Institute\ ,)h(1984.)60 2204 y([83])22 b(James)d(M.)f(Neigh)o(b)q(ors.)32 b(Draco:)27 b (A)19 b(metho)q(d)g(for)g(engineering)i(reusable)f(soft)o(w)o(are)d(systems.) 31 b(In)154 2261 y fi(Softwar)n(e)16 b(R)n(eusability)g(-)g(V)m(olume)g(I:)g (Conc)n(epts)f(and)h(Mo)n(dels)p fl(,)e(pages)h(275{294,)e(1989.)60 2351 y ([84])22 b(Da)o(vid)13 b(et)f(al.)h(Notkin.)k fi(The)d(Journal)g(of)g(Systems) g(and)g(Softwar)n(e)g(Sp)n(e)n(cial)f(Issue:)19 b(The)14 b(GAND)o(ALF)154 2407 y(Pr)n(oje)n(ct)p fl(.)19 b(Elsevier)d(Science)h(Publishing)h(Co.,)c(Ma)o(y)g (1985.)60 2497 y([85])22 b(William)16 b(F.)f(Op)q(dyk)o(e)h(and)f(Ralph)h(E.) f(Johnson.)20 b(Refactoring:)g(An)15 b(aid)g(in)h(designing)h(application)154 2554 y(framew)o(orks)9 b(and)i(ev)o(olving)g(ob)s(ject-orien)o(ted)g(systems.) h(In)f fi(Pr)n(o)n(c)n(e)n(e)n(dings)f(of)i(Symp)n(osium)g(on)g(Obje)n(ct-) 154 2610 y(Oriente)n(d)i(Pr)n(o)n(gr)n(amming)h(Emphasizing)g(Pr)n(actic)n (al)f(Applic)n(ations)h(\(SOOPP)m(A\))p fl(,)c(Septem)o(b)q(er)k(1990.)941 2760 y(138)g eop bop 60 42 a fl([86])22 b(Tim)12 b(O'Shea,)g(Ken)o(t)h(Bec)o (k,)f(Dan)g(Halb)q(ert,)g(and)h(Kurt)f(J.)f(Sc)o(hm)o(uc)o(k)o(er.)k(P)o(anel) d(on:)18 b(The)13 b(learnabilit)o(y)154 98 y(of)g(ob)s(ject-orien)o(ted)h(pro\ gramming)f(systems.)k(In)d fi(Pr)n(o)n(c)n(e)n(e)n(dings)f(of)i(OOPSLA)e(`86) p fl(,)h(pages)g(502{504,)154 154 y(No)o(v)o(em)o(b)q(er)g(1986.)19 b(prin)o (ted)d(as)f(SIGPLAN)h(Notices,)f(21\(11\).)60 248 y([87])22 b(D.)13 b(L.)h (P)o(arnas.)k(Designing)d(soft)o(w)o(are)d(for)i(ease)g(of)g(extension)h(and) f(con)o(traction.)k fi(Communic)n(ations)154 305 y(of)e(the)h(A)o(CM)p fl(,)c (15\(12\):1053{10)o(58,)e(Decem)o(b)q(er)16 b(1972.)60 399 y([88])22 b(D.)10 b (L.)g(P)o(arnas.)i(Designing)f(soft)o(w)o(are)e(for)h(ease)h(of)f(extension)i (and)f(con)o(traction.)h fi(IEEE)f(T)m(r)n(ansactions)154 455 y(on)16 b(Softw\ ar)n(e)g(Engine)n(ering)p fl(,)d(5\(2\):128{13)o(8,)f(Marc)o(h)i(1979.)60 549 y([89])22 b(Da)o(vid)14 b(L.)g(P)o(arnas)f(and)i(P)l(.)e(C.)h(Clemen)o(ts.)k (A)d(rational)f(design)h(pro)q(cess:)20 b(Ho)o(w)13 b(and)h(wh)o(y)g(to)g(fak) o(e)g(it.)154 605 y(In)f fi(Pr)n(o)n(c)n(e)n(e)n(dings)e(of)j(International)e (Joint)i(Confer)n(enc)n(e)e(on)h(The)n(ory)h(and)g(Pr)n(actic)n(e)f(on)g(Soft\ war)n(e)h(De-)154 662 y(velopment)h(\(T)m(APSOFT\))o fl(,)c(1985.)17 b(Reprin) o(ted)f(in)f fi(IEEE)g(T)m(r)n(ansactions)e(on)i(Softwar)n(e)h(Engine)n(ering) 154 718 y fl(SE-12:2,)e(F)l(ebruary)l(,)g(1986.)60 812 y([90])22 b(D.)16 b (L.)g(P)o(arnass,)g(P)l(.C.)g(Clemen)o(ts,)h(and)g(D.M.)e(W)l(eiss.)25 b(The) 17 b(mo)q(dular)g(structure)g(of)f(complex)i(sys-)154 868 y(tems.)g(In)d fi (Pr)n(o)n(c)n(e)n(e)n(dings)e(of)j(the)g(7th)g(International)e(Confer)n(enc)n (e)g(on)h(Softwar)n(e)h(Engine)n(ering)p fl(,)c(pages)154 925 y(408{417,)h (1984.)60 1019 y([91])22 b(H.)15 b(P)o(artsc)o(h)g(and)h(R.)g(Stein)o(bruggen\ .)23 b(Program)15 b(transformation)g(systems.)21 b fi(Computing)c(Surveys)p fl (,)154 1075 y(15\(3\):199{2)o(36,)12 b(Septem)o(b)q(er)k(1983.)60 1169 y([92]) 22 b(D.)16 b(Jason)i(P)o(enney)f(and)h(Jacob)g(Stein.)27 b(Class)17 b(mo)q (di\014cation)i(in)f(the)f(GemStone)g(ob)s(ject-orien)o(ted)154 1225 y(dbms.) j(In)c fi(Pr)n(o)n(c)n(e)n(e)n(dings)d(of)k(OOPSLA)d(`87)p fl(,)i(1987.)60 1319 y([93])22 b(Edw)o(ard)16 b(J.)g(Rak.)23 b(Tw)o(o)16 b(redesign)h(to)q (ols)g(for)e(Smalltalk.)25 b(Master's)15 b(thesis,)i(Univ)o(ersit)o(y)g(of)f (Illinois)154 1376 y(at)e(Urbana-Champaign,)h(1990.)60 1469 y([94])22 b(Thoma\ s)11 b(W.)g(Reps.)k(Incremen)o(tal)d(ev)m(aluation)h(for)f(attribute)f(gramma\ rs)f(with)i(unrestricted)h(mo)o(v)o(e-)154 1526 y(men)o(t)i(b)q(et)o(w)o(een) g(tree)g(mo)q(di\014cation.)21 b fi(A)n(cta)16 b(Informatic)n(a)p fl(,)f(25\(\ 2\):155{1)o(78,)d(1988.)60 1620 y([95])22 b(Thomas)15 b(W.)g(Reps)i(and)f(Tim) g(T)l(eitelbaum.)24 b fi(The)17 b(Synthesizer)e(Gener)n(ator:)22 b(A)17 b(Sys\ tem)g(for)g(Con-)154 1676 y(structing)f(L)n(anguage-Base)n(d)f(Editors)p fl (.)20 b(Springer-V)l(erlag,)c(1989.)60 1770 y([96])22 b(John)14 b(R.)h(Rice)g (and)f(Herb)q(ert)h(D.)e(Sc)o(h)o(w)o(etman.)18 b(In)o(terface)c(issues)h(in) g(a)f(soft)o(w)o(are)e(parts)i(tec)o(hnology)l(.)154 1826 y(In)h fi(Softwar)n (e)i(R)n(eusability)f(-)g(V)m(olume)g(I:)g(Conc)n(epts)f(and)h(Mo)n(dels)p fl (,)e(pages)h(125{140,)e(1989.)60 1920 y([97])22 b(Charles)f(Ric)o(h)i(and)e (Linda)h(M.)f(Wills.)39 b(Recognizing)23 b(a)e(program's)e(design:)33 b(A)21 b (graph-parsing)154 1977 y(approac)o(h.)e fi(IEEE)c(Softwar)n(e)p fl(,)g(pages) g(82{89,)f(Jan)o(uary)h(1990.)60 2071 y([98])22 b(Ro)o(xanna)f(Ro)q(c)o(hat.) 39 b(In)22 b(searc)o(h)f(of)g(go)q(o)q(d)h(Smalltalk)g(programming)f(st)o(yle\ .)39 b(T)l(ec)o(hnical)23 b(Rep)q(ort)154 2127 y(CR-86-19,)14 b(T)l(ektronix,) h(1986.)60 2221 y([99])22 b(Marc)e(J.)g(Ro)q(c)o(hkind.)38 b(The)21 b(source) f(co)q(de)h(con)o(trol)g(system.)35 b fi(IEEE)20 b(T)m(r)n(ansactions)f(on)i (Softwar)n(e)154 2277 y(Engine)n(ering)p fl(,)12 b(SE-1\(4\):364{370,)g(Decem) o(b)q(er)k(1975.)37 2371 y([100])22 b(James)17 b(A.)g(Roskind.)27 b fi(Y)m (A)o(CC)16 b(c)n(omp)n(atible)i(C++)g(gr)n(ammar)g(\(and)g(R)n(elate)n(d)g (T)m(o)n(ols\))p fl(.)24 b(516)16 b(Latania)154 2428 y(P)o(alm)d(Driv)o(e;)h (Indialan)o(tic)h(FL)e(32903)f(USA.)18 b(Author)13 b(can)g(b)q(e)h(reac)o(hed) g(b)o(y)f(email)i(at)d(jar@ileaf.com)154 2484 y(or)i(uunet!leafusa!jar.)h(Sof\ t)o(w)o(are)f(a)o(v)m(ailable)i(via)g(ftp)f(from)f(sev)o(eral)i(sites.)37 2578 y([101])22 b(James)15 b(et)g(al)g(Rum)o(baugh.)21 b fi(Obje)n(ct-Oriente)n (d)15 b(Mo)n(deling)g(and)h(Design)p fl(.)j(Pren)o(tice)d(Hall,)g(1991.)941 2760 y(139)g eop bop 37 42 a fl([102])22 b(Vince)17 b(Russo,)g(Gary)f(Johnsto\ n,)g(and)h(Ro)o(y)f(H.)g(Campb)q(ell.)26 b(Pro)q(cess)16 b(Managemen)o(t)f (in)j(Multipro-)154 98 y(cessor)g(Op)q(erating)h(Systems)f(using)h(Class)f (Hierarc)o(hical)i(Design.)29 b(In)19 b fi(Pr)n(o)n(c)n(e)n(e)n(dings)e(of)i (OOPSLA)154 154 y('88)p fl(,)c(San)g(Diego,)g(Ca.,)f(Septem)o(b)q(er)i(1988.) 37 248 y([103])22 b(Vincen)o(t)13 b(Russo)g(and)g(Ro)o(y)g(H.)f(Campb)q(ell.) 17 b(Virtual)d(Memory)e(and)h(Bac)o(king)g(Storage)e(Managemen)o(t)154 305 y (in)19 b(Multipro)q(cessor)h(Op)q(erating)f(Systems)g(using)g(Class)g(Hierarc) o(hical)h(Design.)31 b(In)20 b fi(Submitte)n(d)f(to)154 361 y(OOPSLA)14 b('89) p fl(,)h(1989.)k(Also)d(a)o(v)m(ailable)h(as)d(Univ)o(ersit)o(y)i(of)f(Illino\ is)j(T)l(ec)o(hnical)f(Rep)q(ort.)37 455 y([104])22 b(Vincen)o(t)12 b(F.)e (Russo.)j fi(A)o(n)f(Obje)n(ct-Oriente)n(d)f(Op)n(er)n(ating)g(System)p fl (.)i(PhD)e(thesis,)h(Univ)o(ersit)o(y)f(of)g(Illinois)154 511 y(at)j(Urbana-C\ hampaign,)h(1991.)37 605 y([105])22 b(Vincen)o(t)e(F.)e(Russo)i(and)f(Simon)h (M.)f(Kaplan.)33 b(A)19 b(C++)h(in)o(terpreter)f(for)g(sc)o(heme.)32 b(In)20 b fi(Pr)n(o)n(c)n(e)n(e)n(d-)154 662 y(ings)j(of)i(the)g(USENIX)e(C++)49 b(Work\ shop)p fl(,)27 b(pages)d(95{108,)h(1988.)46 b(Also)25 b(T)l(ec)o(hnical)h(Rep) q(ort)154 718 y(No.)19 b(UIUCDCS{R{88{1461,)h(Departmen)o(t)f(of)h(Computer)f (Science,)k(Univ)o(ersit)o(y)e(of)f(Illinois)j(at)154 775 y(Urbana-Champaign.) 37 868 y([106])f(Barbara)16 b(Ryder.)28 b(P)o(ap)q(er)17 b(on)h(incremen)o (tal)g(data)f(\015o)o(w)g(anan)o(ysis.)27 b(In)19 b fi(Confer)n(enc)n(e)d(R)n (e)n(c)n(or)n(d)i(of)g(the)154 925 y(Sevente)n(enth)c(A)o(nnual)h(A)o(CM)h (Symp)n(osium)g(on)g(Principles)f(of)h(Pr)n(o)n(gr)n(amming)g(L)n(anguages)p fl(,)e(1990.)37 1019 y([107])22 b(Barbara)16 b(G.)h(Ryder)h(and)f(Marvin)h (C.)e(P)o(aull.)27 b(Elimination)20 b(algorithms)d(for)g(data)f(\015o)o(w)h (analysis.)154 1075 y fi(A)o(CM)e(Computing)h(Surveys)p fl(,)f(18\(3\):231{2) o(76,)d(Septem)o(b)q(er)j(1986.)37 1169 y([108])22 b(Markku)12 b(Sakkinen.)18 b(Commen)o(ts)12 b(in)i(the)g(la)o(w)f(of)f(Demeter)h(and)h(C++.)j fi(SIGPLAN) 12 b(Notic)n(es)p fl(,)h(pages)154 1225 y(38{44,)g(Decem)o(b)q(er)j(1988.)37 1319 y([109])22 b(Da)o(vid)g(Sank)o(o\013)g(and)h(Joseph)g(B.)g(Krusk)m(al.) 43 b(Macromolecular)23 b(sequences.)43 b(In)23 b fi(Time)g(Warps,)154 1376 y (String)13 b(Edits,)h(and)g(Macr)n(omole)n(cules:)19 b(The)13 b(The)n(ory)h (and)g(Pr)n(actic)n(e)g(of)g(Se)n(quenc)n(e)e(Comp)n(arison)i(\(D.)154 1432 y (Sanko\013)h(and)i(J.)f(Kruskal,)g(e)n(ds\))p fl(,)d(pages)i(45{53,)f(1983.) 37 1526 y([110])22 b(W)l(alt)17 b(Scacc)o(hi.)28 b(The)17 b(USC)h(system)f (factory)f(pro)s(ject.)26 b fi(A)o(CM)17 b(SIGSOFT)f(Softwar)n(e)j(Engine)n (ering)154 1582 y(Notes)p fl(,)14 b(14\(1\):61{82,)e(Jan)o(uary)j(1989.)37 1676 y([111])22 b(Stanley)e(M.)f(Selk)o(o)o(w.)33 b(The)20 b(tree-to-tree)f (editing)i(problem.)34 b fi(Information)20 b(Pr)n(o)n(c)n(essing)e(L)n(etters) p fl(,)154 1733 y(6\(6\):184{18)o(6,)12 b(Decem)o(b)q(er)k(1977.)37 1826 y ([112])22 b(B.)12 b(Shneiderman)i(and)e(G.)g(Thomas.)j(An)d(arc)o(hitecture)h (for)f(utomatic)g(relational)h(database)f(system)154 1883 y(con)o(v)o(ersion.) 20 b(In)15 b fi(A)o(CM)h(T)m(r)n(ansactions)e(on)i(Datab)n(ase)g(Systems)p fl (,)e(pages)h(235{257,)e(June)j(1982.)37 1977 y([113])22 b(M.)d(J.)h(Spier.)37 b(Soft)o(w)o(are)18 b(malpractice)j(-)g(a)f(distasteful)h(exp)q(erience.)37 b fi(Softwar)n(e)21 b(-)g(Pr)n(actic)n(e)f(and)154 2033 y(Exp)n(erienc)n(e)p fl (,)13 b(6:293{299,)f(1976.)37 2127 y([114])22 b(Bjarne)14 b(Stroustrup.)k fi (The)d(C++)f(Pr)n(o)n(gr)n(amming)h(L)n(anguage)p fl(.)i(Addison-W)l(esley)f (Publishing)h(Com-)154 2183 y(pan)o(y)l(,)e(1986.)37 2277 y([115])22 b(Kuo-Ch) o(ung)12 b(T)l(ai.)i(The)f(tree-to-tree)e(correction)h(problem.)j fi(Journal) e(of)g(the)g(A)o(CM)p fl(,)e(26\(3\):422{4)o(33,)154 2334 y(July)16 b(1979.) 37 2428 y([116])22 b(W)l(alter)14 b(F.)g(Tic)o(h)o(y)l(.)20 b(T)l(o)q(ols)15 b (for)f(soft)o(w)o(are)f(con\014guration)i(managemen)o(t.)j(In)e fi(Pr)n(o)n (c)n(e)n(e)n(dings)d(of)j(the)g(In-)154 2484 y(ternational)e(Workshop)j(on)d (Softwar)n(e)i(V)m(ersion)d(and)j(Con\014gur)n(ation)e(Contr)n(ol)g(\(J.)g (F.)h(H.)g(Winkler,)154 2540 y(e)n(d\))p fl(,)f(pages)h(1{20,)f(1988.)941 2760 y(140)g eop bop 37 42 a fl([117])22 b(Will)c(T)l(racz.)26 b fi(T)m(utorial:)e (Softwar)n(e)19 b(R)n(euse)e(-)i(Emer)n(ging)e(T)m(e)n(chnolo)n(gy)p fl(.)24 b (IEEE)17 b(Computer)g(So)q(ciet)o(y)l(,)154 98 y(1988.)37 192 y([118])22 b (V.)g(Vyssotsky)f(and)i(P)l(.)f(W)l(egner.)41 b(A)23 b(graph)f(theoretical)h (fortran)e(source)i(language)f(analyzer.)154 248 y(Man)o(uscript,)15 b(A)l (T&T)g(Bell)i(Lab)q(oratories,)d(Murra)o(y)h(Hill,)h(NJ,)g(1963.)37 342 y([11\ 9])22 b(Rob)q(ert)e(A.)f(W)l(agner.)34 b(Order-n)20 b(correction)h(for)e(regu\ lar)h(languages.)34 b fi(Communic)n(ations)20 b(of)g(the)154 399 y(A)o(CM)p fl (,)13 b(17\(5\):265{268,)e(1974.)37 492 y([120])22 b(Rob)q(ert)11 b(A.)f(W)l (agner)h(and)g(Mic)o(hael)h(J.)e(Fisher.)j(The)f(string-to-string)e(correctio\ n)h(problem.)i fi(Journal)154 549 y(of)j(the)h(A)o(CM)p fl(,)c(21\(1\):168{17\ 3,)e(Jan)o(uary)k(1974.)37 643 y([121])22 b(S.)10 b(W)l(arren.)h(Map:)17 b (A)10 b(to)q(ol)g(for)g(understanding)h(soft)o(w)o(are.)f(In)h fi(Pr)n(o)n (c)n(e)n(e)n(dings)e(of)j(the)g(6th)g(International)154 699 y(Confer)n(enc)n (e)i(on)i(Softwar)n(e)g(Engine)n(ering)p fl(,)d(pages)i(28{37.)e(IEEE)j(Compu\ ter)e(So)q(ciet)o(y)l(,)i(1982.)37 793 y([122])22 b(A.)15 b(I.)g(W)l(asserman\ .)k fi(T)m(utorial:)i(Softwar)n(e)16 b(Development)h(Envir)n(onments)p fl(.)h (IEEE)d(Computer)g(So)q(ci-)154 849 y(et)o(y)l(,)f(1981.)37 943 y([123])22 b (G.)14 b(M.)h(W)l(ein)o(b)q(erg.)20 b(Kill)e(that)c(co)q(de!)26 b fi(Infosyst\ ems)p fl(,)13 b(pages)i(48{49,)e(August)i(1983.)37 1037 y([124])22 b(Reinhard) c(Wilhelm.)27 b(A)17 b(mo)q(di\014ed)i(tree-to-tree)d(correction)h(problem.) 26 b fi(Information)18 b(Pr)n(o)n(c)n(essing)154 1093 y(L)n(etters)p fl(,)13 b (12\(3\):127{132,)e(June)17 b(13)d(1981.)37 1187 y([125])22 b(Reb)q(ecca)g (Wirfs-Bro)q(c)o(k)g(and)f(Brian)h(Wilk)o(erson.)39 b(Ob)s(ject-orien)o(ted) 22 b(design:)33 b(A)21 b(resp)q(onsibilit)o(y-)154 1244 y(driv)o(en)16 b(appr\ oac)o(h.)j(In)d fi(Pr)n(o)n(c)n(e)n(e)n(dings)e(of)i(OOPSLA)f(`89)p fl(,)g (pages)g(71{75,)e(Octob)q(er)j(1989.)37 1337 y([126])22 b(Reb)q(ecca)c(Wirfs-\ Bro)q(c)o(k,)f(Brian)g(Wilk)o(erson,)h(and)f(Lauren)h(Wiener.)25 b fi(Designi\ ng)17 b(Obje)n(ct-Oriente)n(d)154 1394 y(Softwar)n(e)p fl(.)i(Pren)o(tice-Hal\ l,)e(1990.)37 1488 y([127])22 b(Reb)q(ecca)c(J.)f(Wirfs-Bro)q(c)o(k)g(and)g (Ralph)i(E.)d(Johnson.)26 b(A)17 b(surv)o(ey)g(of)f(curren)o(t)h(researc)o (h)g(in)h(ob)s(ject-)154 1544 y(orien)o(ted)d(design.)21 b fi(Communic)n(atio\ ns)16 b(of)g(the)g(A)o(CM)p fl(,)e(Septem)o(b)q(er)i(1990.)37 1638 y([128])22 b(E.)14 b(Y)l(ourdon.)20 b fi(T)m(e)n(chniques)15 b(of)h(Pr)n(o)n(gr)n(am)g (Structur)n(e)h(and)f(Design)p fl(.)j(Pren)o(tice-Hall,)e(1975.)37 1732 y([12\ 9])22 b(Jonathan)17 b(Zw)o(eig)g(and)g(Ralph)h(Johnson.)26 b(Conduits:)f(A)17 b(comm)o(unication)h(abstraction)e(in)i(C++.)154 1788 y(In)d fi(Pr)n(o)n(c)n (e)n(e)n(dings)f(of)j(the)f(USENIX)f(C++)32 b(Workshop)p fl(,)15 b(pages)g (191{203,)e(1990.)941 2760 y(141)g eop bop 37 374 a fb(Vita)37 596 y fl(Willi\ am)13 b(F.)d(Op)q(dyk)o(e)i(attended)f(Drexel)h(Univ)o(ersit)o(y)f(in)h(Phila\ delphi)q(a,)i(P)o(ennsylv)m(ania,)f(where)e(he)g(receiv)o(ed)37 653 y(bac)o (helor)22 b(of)f(science)i(degrees)f(in)h(computer)e(science)i(and)f(in)g(com\ merce)f(and)h(engineering)h(sciences,)37 709 y(b)q(oth)18 b(in)h(1979.)26 b (While)19 b(attending)f(Drexel)g(Univ)o(ersit)o(y)g(he)g(completed)g(computer) g(related)g(co)q(op)q(erativ)o(e)37 765 y(education)13 b(w)o(ork)d(assignmen) o(ts)h(at)g(IBM)g(and)h(Sun)g(\(Oil\))g(Co.)18 b(After)11 b(graduating)g(from) f(Drexel)i(Univ)o(ersit)o(y)l(,)37 822 y(he)k(w)o(ork)o(ed)f(for)f(t)o(w)o (o)g(y)o(ears)h(in)h(a)e(soft)o(w)o(are)g(qualit)o(y)i(assurance)f(organizati\ on)g(at)g(Sp)q(erry)g(Univ)m(ac.)108 878 y(Dr.)26 b(Op)q(dyk)o(e)19 b(joined) f(A)l(T&T)g(Bell)h(Lab)q(oratories)e(in)i(1981.)25 b(He)18 b(receiv)o(ed)h (an)e(MS)h(degree)g(in)g(Com-)37 935 y(puter)f(Sciences)h(from)d(the)i(Univ)o (ersit)o(y)g(of)f(Wisconsin)h(-)f(Madison)h(in)g(1982,)e(supp)q(orted)i(under) g(A)l(T&T's)37 991 y(graduate)g(study)f(program.)24 b(Then,)17 b(at)f(Bell)j (Labs)e(he)g(help)q(ed)i(plan)e(the)g(ev)o(olution)g(of)g(switc)o(hed)g(digit\ al)37 1048 y(telecomm)o(unications)22 b(services,)g(and)e(in)o(v)o(estigated) g(the)h(application)g(of)f(kno)o(wledge-based)h(and)f(relat-)37 1104 y(ed)f (tec)o(hnologies)g(to)e(assist)h(in)h(v)o(ery)f(large)g(scale)h(soft)o(w)o (are)d(dev)o(elopmen)o(ts.)29 b(He)19 b(w)o(as)e(appro)o(v)o(ed)h(for)f(the) 37 1161 y(do)q(ctoral)f(supp)q(ort)f(program)f(in)i(1988.)108 1217 y(Dr.)j (Op)q(dyk)o(e)13 b(pursued)h(his)f(do)q(ctoral)f(researc)o(h)h(under)g(the)g (sup)q(ervision)h(of)e(Prof.)18 b(Ralph)c(E.)e(Johnson.)37 1274 y(He)k(receiv) o(ed)g(his)g(PhD)f(from)g(the)g(Univ)o(ersit)o(y)h(of)f(Illinois)j(at)c(Urban\ a-Champaign)i(in)g(1992.)108 1330 y(Dr.)35 b(Op)q(dyk)o(e)22 b(is)f(curren)o (tly)g(a)f(Mem)o(b)q(er)g(of)h(T)l(ec)o(hnical)h(Sta\013)e(at)f(A)l(T&T)i(Bel\ l)h(Lab)q(oratories.)36 b(His)37 1386 y(researc)o(h)16 b(in)o(terests)f(inclu\ de)j(ob)s(ject-orien)o(ted)e(programming)e(and)i(design,)g(soft)o(w)o(are)e (restructuring)h(and)37 1443 y(application)i(mo)q(deling)g(using)f(ob)s(ject-\ orien)o(ted)f(framew)o(orks.)941 2760 y(142)g eop eos @end