0#!&*1+%0*%)&0a78khan/cs446/additional... · 48. model-view-controller. vs: data, and ne or...

Post on 20-Aug-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

!"#$"%&'()*%+'"#%'#,'-%./&0#!&*1+%0*%)&0

!"#$%&'"()"*&+&,"(-&./"0&1&23

Stephanie Xie
Normal
Stephanie Xie
Radical
Stephanie Xie
Stephanie Xie
Stephanie Xie
Normal
Stephanie Xie
Radical
Stephanie Xie
components
Stephanie Xie
composition
Stephanie Xie
Architectural Styles⊆Normal Modes of Composition

!

Architectural Style

"#$%&'($')#(

! !"#$"%&%'*+#(,#(-(.'-+$/0,)'1'&/.

! !"%%&!'"()*+21$&3&'1'(-+$/0,/.(.'+$/00).&$1'&/.

"#$%&'($')#13+4'53(67/.2&8)#1'&/.

! 1#$%&'($')#(+9+:$/0,/.(.'-;+$/..($'/#-;+$/.-'#1&.'-<

=&-)13&>1'&/.+

! 8#1,%+#(,#(-(.'1'&/.

?

Architectural Styles

@&,(-+1.A+2&3'(#-

B1'1+1C-'#1$'&/.

D0,3&$&'+&.E/$1'&/.

F15(#(A+-5-'(0-

G(,/-&'/#&(-

H

Pipes & Filters

IE(#E&(J

! "#$%&'($')#13+,1''(#.+2/#+-'#(10+,#/$(--&.8

! "+2&3'(#+A(2&.(-+1+,#/$(--&.86$/0,)'1'&/.+-'(,

! B1'1+23/J-+'%#/)8%+1+-(K)(.'&13+$%1&.+/2+2&3'(#-

! "+2&3'(#+$%1&.+#(,#(-(.'-+1+-5-'(0

23

24

25

2'67'"0"%

2'""0*%'&

(/%/#-8'.

L

93

94

9"

-+8%0&:

7+70:

(/%/#-8'.

7/0,/.(.'-+MN&3'(#-O

! 4('+/2+&.,)'-+1.A+/)',)'-

! D.,)'+P+/)',)'+-'#(10-

! F/$13+'#1.-2/#01'&/.

" &.$#(0(.'13+/)',)'

! Q./J.+1-+2&3'(#-

7/..($'/#-+M@&,(-O

! N1$&3&'1'(+A1'1+23/J

! Q./J.+1-+,&,(-

Pipes & Filters

R

Pipes & Filters

D.E1#&1.'-

! D.A(,(.A(.'+(.'&'&(-

" A/+./'+-%1#(+-'1'(

" %1E(+./+S./J3(A8(+/2+/'%(#+2&3'(#-

! T#1.-2/#01'&/.

" &.$#(0(.'13+

" ./'+A(,(.A(.'+/.+/#A(#+&.+'%(+$%1&.

Stephanie Xie
Can filter X influence filter Y?Can filter Y influence filter X?
Stephanie Xie
Stephanie Xie
Stephanie Xie
Stephanie Xie
X
Stephanie Xie
Y
Stephanie Xie
Stephanie Xie
Like what kind of Prog. Langs.?
Stephanie Xie

U

Pipes & Filters

4,($&13&>1'&/.

! *+$&,+%&)*+#(-'#&$'(A+'/+3&.(1#+'/,/3/85

! -".%/&/0$+$&)*+#(-'#&$'-+'%(+10/).'+/2+A1'1+/.+1+,&,(

! 12$&/0$+$&)*+A1'1+/.+1+,&,(+'/+C(+/2+1.+1$$(,'1C3(+'5,(

V)(-'&/.

! 71.+1+2&3'(#+,#/$(--+133+/2+&'-+&.,)'+A1'1+1-+1+-&.83(+(.'&'5W

XY

Pipes & Filters

Z[10,3(-

! \.&[+-%(33+,#/8#10-+

" ,&,(3&.(-

" $1'+2&3(X+]+-/#'+]+8#(,+S(5J/#A

! ^ZZ+4(#E3('+N&3'(#+M_1E1[`-(#E3('`N&3'(#O

" '5,(A+,&,(-

&0;)0:%&0:7'":0

<==>?0;)0:%<==>?0:7'":0

:0&@0& :0&@80%

:0&@0& :0&@80%-3 -4 -"

XX

Pipes & Filters

Z[10,3(-

! 7/0,&3(#-

" a/#(+/2+1+-(K)(.'&13+C1'$%+1#$%&'($')#(

80A :B" :06 '7% *'(0

:')&*0#*'(0 6/*1+"0#*'(0

Xb

Pipes & Filters

"AE1.'18(-

! 4&0,3(+$/0,/-&'&/.

! G()-(

" 1.5+'J/+2&3'(#-+$1.+C(+$/0C&.(A+'/8('%(#

! 1-+3/.8+1-+'%(5+-,(1S+'%(+-10(+A1'1+31.8)18(

! @#/'/'5,&.8

" %/J+01.5+-$#&,'-+01S(+)-(+/2+8#(,;+1JS;+-(A+('$`

! Z1-5+8#/J'%+P+(E/3)'&/.

" "#$%&'($')#13+(E13)1'&/.+2/#+,(#2/#01.$(+P+C/''3(.($S-

! 7/.$)##(.$5+P+,1#133(3&-0

Xc

Pipes & Filters

B&-1AE1.'18(-

! @//#+,(#2/#01.$(

" (1$%+2&3'(#+%1-+'/+,1#-(+A1'1

" -%1#&.8+83/C13+A1'1+&-+A&22&$)3'

! d/'+1,,#/,#&1'(+2/#+&.'(#1$'&/.+

! F/J+21)3'+'/3(#1.$(+'%#(-%/3A

" e%1'+%1,,(.-+&2+1+2&3'(#+$#1-%(-

! B1'1+'#1.-2/#01'&/.+

" '/+F7B+'/+1$$/00/A1'(+2&3'(#-+

! D.$#(1-(-+$/0,3([&'5+P+$/0,)'1'&/.

32

Pipe-and-Filter vs. Batch Sequential

• Both decompose the task into a fixed sequence of computations (components) interacting only through data passed from one to another

• fine grained• results starts processing• localized input• concurrency possible• interactive awkward but

possible

• course grained• high latency• external access to input• no concurrency• non-interactive

Pipe-and-FilterBatch Sequential

X!

Data Abstraction

IC_($'+I#&(.'(A+I#81.&>1'&/.+MIIIO

! Z.$1,-)31'&/.+MA1'1+P+/,(#1'&/.-O

7/0,/.(.'-

! IC_($'-;+0/A)3(-

7/..($'/#-

! #(,#(-(.'+&.'(#f/C_($'+$/00).&$1'&/.

" -5.$%#/./)-+/#+1-5.$%#/./)-+

X?

Data Abstraction

Q(5+1-,($'-

! IC_($'-+,#(-(#E(+'%(&#+&.'(8#&'5+

! ./+A&#($'+1$$(--

! IC_($'+#(,#(-(.'1'&/.+&-+1+,#&E1'(+1221&#

"AE1.'18(-

! D0,3(0(.'1'&/.+$%1.8(-+J&'%+0&.&013+83/C13+&0,1$'

! B($/0,/-&'&/.

" 31#8(+-5-'(0+&.'/+1+-('+/2+&.'(#1$'&.8+/C_($'-

" (1-5+'/+01.18(+P+(E/3E(

XH

Data Abstraction

B&-1AE1.'18(-

! D.'(#1$'&/.+&._($'-+$/),3&.8

" /C_($'-+&.'(#1$'+E&1+,)C3&$+$/.'#1$'

" J%1'+%1,,(.-+J%(.+'%(+$/.'#1$'+$%1.8(-W

" &.A&#($'+$/),3&.8*+"+)-(-+g;+7+)-(-+g;+'%(.+$%1.8(-+01A(+C5+7+/.+g+1#(+).([,($'(A+'/+"

XL

Data Abstraction

4/0(+'%/)8%'-

! B(-&8.+C5+$/.'#1$'+h+&.'(#21$(-

" A($/),3(-+&.'(#f/C_($'+A(,(.A(.$&(-

! 45.$%#/.&>1'&/.

e%1'+J/)3A+%1,,(.+&2+1.+/C_($'+J(#(+'/+21&3+A)#&.8+1.+/,(#1'&/.W

XR

Implicit invocation

ZE(.'fC1-(A

! 7/0,/.(.'-+A/+./'+A&#($'35+&.E/S(+/'%(#+$/0,/.(.'-

! 4&0&31#+'/+"3)&(4&(0567890/&)+:%0$;''&(%

" &0,3&$&'+&.E/$1'&/.+1#$%&'($')#13+-'53(+%1-+C#/1A(#+-$/,(

7/0,/.(.'-

! a/A)3(-+i(E(.';+$133C1$S+]+,#/$(A)#(j+

" /C_($'-;+,#/$(--(-;+A&-'#&C)'(A+1,,3&$1'&/.-

7/..($'/#-

! T#1A&'&/.13+0('%/A+$133

! g#/1A$1-'+/2+(E(.'-

XU

Implicit invocation

@)C3&-%+P+4)C-$#&C(

! 7/0,/.(.'-+#(8&-'(#+2/#+(E(.'-

! ZE(.'-+1#(+8(.(#1'(A+,)C3&-%(A+

" C5+A&22(#(.'+-/)#$(-

" '/+1+$(.'#13&>(A+-5-'(0

! ZE(.'-+1#(+C#/1A$1-'

" E&1+$133C1$S+/#+,#/$(A)#(

bY

Implicit invocation

D.E1#&1.'-

! ZE(.'+8(.(#1'/#-+A/+./'+S./J+

" 1C/)'+(E(.'+$/.-)0(#-

" 2).$'&/.13+&0,1$'+/.+A&22(#(.'+$/0,/.(.'-

! g#/1A$1-'+/#A(#&.8

" $/0,/.(.'-+$1../'+01S(+1--)0,'&/.-+1C/)'+/#A(#(A+A(3&E(#5

bX

Implicit invocation

Z[10,3(-

! d(J-;+2&#(+131#0-+('$`

! a=7

! DBZ-

! B1'1C1-(+-5-'(0-+'/

" (.-)#(+$/.-&-'(.$5+$/.-'#1&.'-

" ([($)'(+-'/#(A+,#/$(A)#(-

! \-(#+&.'(#21$(

" 4(,1#1'&/.+/2+A1'1+,#(-(.'1'&/.+2#/0+A1'1+01.18(0(.'

! Z.'(#,#&-(+1,,3&$1'&/.+&.'(#1$'&/.

47

Model-View-Controller

48

Model-View-Controller• A decomposition of an interactive system into three components:

– A model containing the core functionality and data,– One or more views displaying information to the user, and– One or more controllers that handle user input.

• A change-propagation mechanism (i.e., observer) ensures consistency between user interface and model, e.g.,

– If the user changes the model through the controller of one view, the other views will be updated automatically

• Sometimes the need for the controller to operate in the context of a given view may mandate combining the view and the controller into one component

• The division into the MVC components improves maintainability

bb

Implicit invocation

"AE1.'18(-

! a&.&013+A(,(.A(.$5+1.A+3//-(+$/),3&.8

" 7/0,/.(.'-+A/+./'+A&#($'35+&.'(#1$'+J&'%+(1$%+/'%(#

" 7/0,/.(.'-+$1.+C(+1AA(A+/#+#(0/E(A

! k&8%35+#()-1C3(

" 7/0,/.(.'-+$1.+C(+#(,31$(A+J&'%+.(J(#+$/0,/.(.'-

! J&'%/)'+$%1.8&.8+'%(&#+&.'(#21$(-

! 4$131C3(

" d(J+$/0,/.(.'-+$1.+-&0,35+#(8&-'(#+'%(0-(3E(-

bc

Implicit invocation

B&-1AE1.'18(-

! F/--+/2+([($)'&/.+$/.'#/3

" e%/;+J%(.;+J%1'

! B1'1+([$%1.8(

" &.2/#01'&/.+%1-+'/+C(+(.$1,-)31'(A+J&'%&.+1.+(E(.'

" -%1#(A+#(,/-&'/#5

" &0,1$'+/.+

! 83/C13+-5-'(0+,(#2/#01.$(+P+#(-/)#$(+01.18(0(.'

! ZE(.'+$/.'(['

" ).,#(A&$'1C3(+-&A(+(22($'-

" %/J+'/+A(C)8+-)$%+1+,#/C3(0W

b!

Layered Systems

I#81.&>(A+%&(#1#$%5

! Z1$%+315(#+

" ,#/E&A(-+1+-(#E&$(+'/+'%(+315(#+1C/E(

" 1$'-+1-+1+$3&(.'+'/+'%(+315(#+C(3/J

7/0,/.(.'-+

! F15(#-*+$/0,/-(A+/2+8#/),-+/2+-)C'1-S-

! "@D*+4('+/2+$31--(-+([,/-&.8+1.+"@D+315(#

7/..($'/#-

! 7/00).&$1'&/.+,#/'/$/3-6&.'(#21$(-

" A(2&.(+'%(+&.'(#f315(#+&.'(#1$'&/.

b?

Layered Systems

*'&0

C/:+*#)%+8+%+0:

/778+*/%+'":

D"+'"#:E+"#6'(08

bH

Layered Systems

=&00#6'(08

bL

Layered Systems

=+0&0(#6'(08

70&:+:%0"*0

C):+"0::#-)"*%+'":

/773 /774

71

Example: FTP on top of TCP/IP

FTP

TCP

IP

Ethernet

FTP

TCP

IP

Ethernet

FTP Protocol

TCP Protocol

IP Protocol

Ethernet Protocol

Physical Connect

72

The Unix Layered Architecture

bR

Layered Systems

D.E1#&1.'-

! F&0&'+315(#+&.'(#1$'&/.-+'/+1A_1$(.'+315(#-+/.35

" 71.+C(+E&/31'(A+1-+2/33/J-*

! "+315(#+015+)-(+1.5+315(#+C(3/J+2/#+-(#E&$(

! a)$%+#&$%(#+&.'(#1$'&/.+J%(.+$/0,1#(A+'/+,&,(3&.(

" 'J/+J15+$/00).&$1'&/.

! F15(#-+0)-'+-),,/#'+'%(+,#/'/$/3-+/2+&'-+),,(#+1.A+3/J(#+C/).A1#&(-

bU

"AE1.'18(-

! D.$#(1-&.8+3(E(3-+/2+1C-'#1$'&/.

! F/J+$/),3&.8

" (1-5+'/+01&.'1&.

" 1+315(#+/.35+&.'(#1$'-+J&'%+1+315(#+1C/E(+1.A+1+315(#+C(3/J

! a/A)31#+#()-(

" 1+315(#+$1.+C(+#(,31$(A+C5+1./'%(#+1-+3/.8+1-+'%(+&.'(#21$(+&-+./'+E&/31'(A

Layered Systems

cY

Layered Systems

B&-1AE1.'18(-

! d/'+133+-5-'(0-+$1.+C(+315(#(A

! @(#2/#01.$(

" a15+2/#$(+'%(+%&8%+3(E(3+2).$'&/.-+'/+C(+'&8%'35+$/),3(A+J&'%+3/J+3(E(3+&0,3(0(.'1'&/.

T&(#(A+"#$%&'($')#(

! 4,($&13&>1'&/.+2/#+(.'(#,#&-(+1,,3&$1'&/.-

" '&(#-+1#(+8(.(#1335+,%5-&$1335+-(,1#1'(A

cX

Repositories

a1&.+&A(1

! 7(.'#13&>(A+-/)#$(+/2+&.2/#01'&/.+J&'%+01.5+$/0,/.(.'-

7/0,/.(.'-

! T5,(+X*+$(.'#13+A1'1f-'/#(+$/0,/.(.'

" #(,#(-(.'-+-5-'(0+-'1'(6A1'1

! T5,(+b*+$/33($'&/.+/2+A1'1f)-(+$/0,/.(.'-

" $/33($'&/.+/2+&.A(,(.A(.'+$/0,/.(.'-+/,(#1'(+/.+'%(+$(.'#13+A1'1f-'/#(

cb

Repositories

7/..($'&/.-

! =1#5+$/.-&A(#1C35

" "$'&E(*+D.$/0&.8+-'#(10-+/2+'#1.-1$'&/.-+'#&88(#+,#/$(--(-+'/+1$'+/.+A1'1f-'/#(+h+/;';3;)&

" @1--&E(*+$)##(.'+-'1'(+/2+'%(+A1'1f-'/#(+'#&88(#-+,#/$(--(-+h+3,;!<3";(/

Stephanie Xie
expert systems (cf JESS, CLIPS, etc)

cc

Repositories

"AE1.'18(-

! Z22&$&(.'+J%(.+A(13&.8+J&'%+31#8(+10/).'-+/2+A1'1

" Q./J.+A1'1+-$%(01

" 3(1A-+'/+(1-(+/2+A1'1+-%1#&.8

" $(.'#13&>(A+01.18(0(.'

! 73&(.'-+1#(+3//-(35+$/),3(A

c!

Repositories

B&-1AE1.'18(-

! B1'1+0/A(3+

" &-+-'1'&$;+C/).A(A+C5+A(2&.(A+-$%(01

" #(-&-'1.'+'/+$%1.8(+1-+01.5+A(,(.A+/.+&'

" (E/3)'&/.+&-+([,(.-&E(

! B&22&$)3'+'/+A&-'#&C)'(

c?

Interpreter Style

a1&.+&A(1

! g#&A8(+2).$'&/.13&'5

" 4)&'1C3(+2/#+1,,3&$1'&/.-+&.+J%&$%+'%(+0/-'+1,,#/,#&1'(+31.8)18(+/#+01$%&.(+2/#+([($)'&.8+'%(+-/3)'&/.+&-+./'+A&#($'35+1E1&31C3(

cH

Interpreter Style

7/0,/.(.'-

! &.'(#,#('1'&/.+(.8&.(

" '/+A/+'%(+J/#S

! 0(0/#5

" $/.'1&.-+'%(+,-)(A/f$/A(+P+-'1'(

! -'1'(

" $/.'#/3+-'1'(+/2+'%(+(.8&.(

" $)##(.'+-'1'(+/2+'%(+,#/8#10

cL

Interpreter Style

7/..($'/#-

! ,#/$(A)#(+$133-

! A&#($'+0(0/#5+1$$(--

Z[10,3(-

! @#/8#100&.8+31.8)18(+$/0,&3(#-

" ^1E1;+-0133+'13S

! 4$#&,'&.8+31.8)18(-

" 1JS;+@(#3

cR

Interpreter Style

"AE1.'18(-

! 4&0)31'&/.+/2+./.f&0,3(0(.'(A+,1#'-

! @/#'1C&3&'5

" 1$#/--+1+E1#&('5+/2+,31'2/#0-

B&-1AE1.'18(-

! @(#2/#01.$(

" 7/0,)'1'&/.13+$/0,3([&'5+h+-3/J+([($)'&/.

top related