ࡱ> &)('(( / 00DArialngs-0z[ 0DTahomags-0z[ 0" DTimes New Roman0z[ 00DWingdingsRoman0z[ 0O, .  @n?" dd@  @@`` 8   () **21// 21         HG    HGopqr3w9xX     Q    , 0AA f333f@8ghwLf ʚ;Nh8ʚ;g42d2d z[ 0&ppp@ <4ddddL 0, <4BdBdL< 080___PPT10 ?  %~C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to express design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital ExampleRPatients play the Subject role State includes temp and heart rate Notifying all observers is done with Pat.PageAll() Nurses observe Patients Keep track if Patents have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)VMZH < I           >g XiTN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%%f> $U 0 ` r77f3/Ʊ` fff` KfxP` 7_/U<ff` HghXs3q̙` WXcklugti~^ӤO` ־3f3f` 33^` J%xiff3` fff>?" dd@,?nFd@  d nF@ d`nF n?" dd@   @@``PP   @ ` ` p>> rj(  6 T ~  "~  c B@CW DEF"d@ W @W @W W @`".~  c B,CW DEF"d@ W ,W ,@`". \ ~  "~  c B CDEF"@   @`"(4  c B C DEF"d@ @`"(W4  c BtC DEF"d@t t tt@`"~   c B CDEF"@ @`"([4W   c B CDEF"d@ @`"(4   c B CDEF"2@  @`"(4[   c BC DEF"d@ @`"_   c BC DEF"@ @`"  c BC DEF"@  @`"\  Bh ?"0F  T Click to edit Master title style! !$  0 "0  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  0\ "`P  B*   0  "`p   D*   0蠠 "`0  D* H  0޽h ? fff80___PPT10. @F$ Shimmer9 g 9(   T ~  "~~b ~ # "~  c B@CW DEF"d@ W @W @W W @`".~  c B,CW DEF"d@ W ,W ,@`".  c B CDEF"2@  @`"(4[  c BC DEF"@ @`"  c BC DEF"d@ @`"_b \~  # "\~   c B CDEF"@   @`"(4   c B C DEF"d@ @`"(W4   c BtC DEF"d@t t tt@`"~   c B CDEF"@ @`"([4W  c B CDEF"d@ @`"(4  c BC DEF"@  @`"\  HDx ?"p  T Click to edit Master title style! !  0z " `   W#Click to edit Master subtitle style$ $  0 "`P  B*   0ԃ "`@`   D*   0 "`0  D* H  0޽h ? fff80___PPT10. @F$thK0 sk@ (  ~  s *Ē6  ~  s *@     0 0P \SAVCBS  04 Workshop at ACM SIGSOFT 2004/FSE-12//  0( @ @ }1Benjamin Tyler (Presenter) Ohio State University02   0<  p  (Neelam Soundarajan Ohio State University")#H  0޽h ? 33___PPT10i. /+D=' = @B +} g $(  r  S 0F   r  S   H  0޽h ? fff___PPT10i. al+D=' = @B + g ` 0(  x  c $0F   x  c $P  H  0޽h ? fff___PPT10i.+D=' = @B + g  (  X   0fԔ@x  c $ +0F  +   0ԔC"?S!  h Contract Aspect for P (abstract),!    <` +   + H  0޽h ? fff___PPT10i.+D=' = @B + g   (  X   0fԔ@x  c $+0F  + X  033Ԕ ;X  033Ԕp pX  033Ԕ@ {  0+ԔC"?1 @w n&System Code Purportedly uses pattern P,'    0+ԔC"?S!  h Contract Aspect for P (abstract),!    <+   + H  0޽h ? fff___PPT10i.+D=' = @B + g 0(  (  X   0fԔ@X   033Ԕ`  x  c $&+0F  + X  033Ԕ ;X  033Ԕp pX  033Ԕ@ {  0D)+ԔC"?1 @w n&System Code Purportedly uses pattern P,'    0 +ԔC"?S!  h Contract Aspect for P (abstract),!    02+ԔC"?` !  j&Subcontract Aspect Specific to System(' RB   s *DԔ` ^R   6ԔaQ  <P7+   + H  0޽h ? fff___PPT10i.+D=' = @B +  g   2pm (  X & 0fԔ@X % 033Ԕ`  r  S =+0F  + ^ * 633Ԕ ;^ ) 633Ԕp p^  633Ԕ@ {  6<@+ԔC"?1 @w n&System Code Purportedly uses pattern P,'    64E+ԔC"?S!  h Contract Aspect for P (abstract),!   " 6J+ԔC"?` !  i%Subcontract Aspect Specific to System(& RB ' s *DԔ` ^R $ 6ԔaQx , 0GtFC"? 0   - <GEBHC"?p 0 X . 033Ԕ` @  0 0xP+ԔC"?C  bCompiled System Monitors P,   2 0xU+ԔC"?` @  JCompile/ Weave  H  0޽h ? fff___PPT10i.+D=' = @B + g ,$  (  X  0fԔ@x  c $x]+0F  + X  0Ԕp pX  0Ԕ@ {  0x_+ԔC"?1  cAnother System Also uses P,    0pd+ԔC"?S!  h Contract Aspect for P (abstract),!  RB   s *DԔ` ^R   6ԔaQX   033Ԕ`     0j+ԔC"?` !  i%Subcontract Aspect Specific to System(& H  0޽h ? fff___PPT10i.+D=' = @B +; g RJ  (  X  0Ԕ`  X  0fԔ@x  c $+0F  + X  0Ԕp pX  0Ԕ@ {  0+ԔC"?1  cAnother System Also uses P,    0+ԔC"?S!  h Contract Aspect for P (abstract),!     0+ԔC"?` !  )Another Subct. Aspect Specific to System(* RB   s *DԔ` ^R   6ԔaQH  0޽h ? fff___PPT10i.+D=' = @B +i  g  x  (  X   0Ԕ`  X   0fԔ@x  c $m+0F  + X  0Ԕp pX  0Ԕ@ {  0ԔC"?1  cAnother System Also uses P,    08+ԔC"?S!  h Contract Aspect for P (abstract),!    0+ԔC"?` !  )Another Subct. Aspect Specific to System(* RB   s *DԔ` ^R   6ԔaQx   0GtFC"? 0    <GFHZC"? 0 X  0Ԕ` @   0+ԔC"?C  h Compiled System Also monitors P,!   0+ԔC"?` @  JCompile/ Weave  H  0޽h ? fff___PPT10i.+D=' = @B + g P 0(  x  c $+0F  + x  c $+ + H  0޽h ? fff___PPT10i.+D=' = @B + g  ,0(  ,x , c $0F   x , c $  H , 0޽h ? fff___PPT10i.4+D=' = @B +  g    hk (  hx h c $T 0F    h 0+"`$ 0 L  1before(Calc c): SqPc(c) { }2 2$ N h 0"`  Dafter(Calc c): SqPc(c) { } TE B&&&$ 0  h 0"`<  @Zaspect CalcMonitor { int st_old; pointcut SqPc(Calc c): exec(Sqrt()) && targ(c);N[ #6t   B  h 0"` 0 L  & assert(c.st >= 0); st_old = c.st; L' #>     h 0l$"`~  1assert(c.st^2 <= st_old && st_old <(c.st+1)^2);2 2, h 0)"`L  K}. F pp  h @@  h Hl.ԔS"`?p  Hpclass Calc { int st; void Sqrt() { int i = 1; while(i*i<=st) i++; st = i-1; } } .q U  f h 6Ԕpp ^B h 6DԔ|  ^B h 6DԔ|  H h 0޽h ? fff___PPT10i.U+D=' = @B +M g d\p#8(  r  S ;0F   M  B<Ԕp "  E Subject +Attach(in Observer) +Notify() +Detach(in Observer)FF  4,   RB   s *DԔs RB  s *DԔs   6DԔ p  l ConcreteSubject  RB  s *DԔ s RB  s *DԔp   <I  w- subjectState * , RB @ s *DԔ0 @ RB  s *DԔ0  RB  s *DԔ @ RB  s *DԔ    6OԔ"   Observer + Update() `    RB   s *DԔRB ! s *DԔ " 6WԔ  w! ConcreteObserver + Update() " "RB # s *DԔ  RB $ s *DԔ % <\ 0 x- observerState * , RB &@ s *DԔ0 0 RB ' s *DԔ0 0 RB ( s *DԔ  RB ) s *DԔ 00 XB * 0DԔ` `XB +@ 0DԔ   , 0dp  P observers *  , - 0Pi P Nsubject * , . 0m`   o1 * 6  2, / 0Hs ` `  n1 * 6  2,XB 4 0Do 2 5 Hhyo 6" ,XB 6 0Do ` ^ 7 6o` `  8 0} J  )for all o in observers o.Update()0* ),H  0޽h ? fff___PPT10i.µ~e+D=' = @B + g  (  r  S 0F     s *4 "6 ?  "p`PpH  0޽h ? fff___PPT10i.и4+D=' = @B + g 3+ 4(  4x 4 c $0F    4 c $ `p  "p`Ppu 4 0"`p after(Subj s, Obs o): UpdatePc(s, o) { assert(Consistent(s, o)); } abstract pointcut UpdatePc(Subj s, Obs o) ; abstract boolean Consistent(Subj s, Obs o) ;        H 4 0޽h ? fff___PPT10i.и4+D=' = @B + g  (  x  c $t0F     c $ܹ`p  "p`PpP  0&"` after(Subj s): SubjMethPc(s) { assert(! Modified(s_old, s)); } before(Subj s): NotifyPc(s) { s_old = copyObject(s); & } abstract pointcut SubjMethPc(Subj s) ; abstract pointcut NotifyPc(Subj s) ; abstract boolean Modified(Subj s1, Subj s2) ;   %         H  0޽h ? fff___PPT10i.и4+D=' = @B +} g @ $(  r  S Ы0F   r  S L֫0P  H  0޽h ? fff___PPT10i.TD+D=' = @B + g 0 0(  x  c $ܫ0F   x  c $ܫ  H  0޽h ? fff___PPT10i.y@:#+D=' = @B + g P '(  x  c $ 0F   x  c $    0dP `G pointcut UpdatePc(Subj subj, Obs obs) : ( exec(Nrs.TempUpd(Pat)) || exec(Doc.CondUpd(Pat)) ) && targ(obs) && arg(subj) ; pointcut SubjMethPc(Subj subj) : exec(Pat.*(..)) && targ(subj) ;           H  0޽h ? fff___PPT10i.y@:#+D=' = @B + g   O(   x   c $0F   x   c $p0`      0l  eboolean Modified(Subj s1, Subj s2) { return s1.temp != s2.temp || s1.hrtRate != s2.hrtRate; }f     6 HH   0޽h ? fff___PPT10i.tź +D=' = @B += g TL 8(  8x 8 c $/0F   x 8 c $00   8 0@4RP L^boolean Consistent(Subj subj, Obs obs) { if (obs instanceOf Nrs) { return subj.temp > 104 == obs.isFeverish(subj); } else if (obs instanceOf Doc) { return (55 < subj.hrtRate < 100 && 92 < subj.temp < 105) == obs.isStable(subj); } else { /* Error! */} }_   +  $, !   &   '!H 8 0޽h ? fff___PPT10i.tź +D=' = @B +0 g  0(  x  c $Y0F   x  c $ZP  H  0޽h ? fff80___PPT10.k?.  g   $} (  $X $ 0fԔ@AA X $ 033Ԕ` AA x $ c $e0F   X $ 033ԔP ;X $ 033Ԕp X $ 033Ԕ `{ $ 0jԔC"? w n&System Code Purportedly uses pattern P,'    $ 0|oԔC"?Sq  h Contract Aspect for P (abstract),!    $ 0tԔC"?` qA  i%Subcontract Aspect Specific to System(& RB  $ s *DԔ))` ^R  $ 6Ԕx  $ 0GtFC"? 0  $ <GEBHC"?pA0 X $ 033Ԕ`  $ 0{ԔC"?C 0 bCompiled System Monitors P,   $ 0ԔC"?` 0@@  JCompile/ Weave  d" $ <Ԕ 0@  $ 0  ) ZAspects = Specs .  2H $ 0޽h ? fff___PPT10i.+D=' = @B + g   +( (  (x ( c $0F   X ( 0fԔ0qqX ( 033ԔP qq  ( 0@rԔC"?CA# KContract Spec for P  ( 0đԔC"?P q  g#Subcontract Spec Specific to System($ RB ( s *DԔ YYP ^R ( 6Ԕ d" ( <Ԕ`pp "( 04 _Specs written in PCL .  2r &( s *3C"?  '( 0$Y  \MonGen  23*8  @ +( @` ( 033Ԕ ;` ( 033Ԕp` ( 033Ԕ`0{ ( 0XԔC"?Q`w n&System Code Purportedly uses pattern P,'  f ( 633Ԕ    ( 6ԔC"? P  `Monitoring Aspect for System(  ( <GEBHC"?p0 ` ( 033Ԕ``  ( 0ФԔC"?C  bCompiled System Monitors P,   ( 0دԔC"?0` @@  JCompile/ Weave   *( 0G6C"?  H ( 0޽h ? fff___PPT10i.+D=' = @B +} g 0 $(  r  S P0F   r  S $   H  0޽h ? fff___PPT10i.v`65Y+D=' = @B +} g $(  r  S 0F   r  S tP  H  0޽h ? fff___PPT10i.˵+D=' = @B +r0(> Vm p *3:`B@xQYG[_exŷοPRRkTW vZ0? \(( / 00DArialngs-0z[ 0ZOh+'0Q hp    $,$Monitoring Design Pattern Contracts Ben Tyler DShimmer Ben Tyler D69 Microsoft PowerPointter@ j@6A@vW.GPg  P('& &&#TNPPX2OMi & TNPP &&TNPP     'A x(xʦ """)))UUUMMMBBB999|PP3f3333f333ff3fffff3f3f̙f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙33333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffff3fffffff3f̙ffff3ff333f3ff33fff33f3ff̙3f3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3ffffffffff!___www________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________8___8_______________________________________________________________88888888888888888888_8___________________________________________________________888_888_888888_8________________________________________________________88888888__88888888888_8__________________________________________________________8888_______8____8_________________________________________________________________8__________________8_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________Å_Å________Å_ÅÅ___________________________________Å_______________________________Å___________________________________Å________________________________ÅÅ__Å_________Å__ÅÅÅÅ___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________Å_______________________________Å______________________________Å____________________________________________________________________Å_ÅÅ_Å____Å____ÅÅÅ_____________________________________________________________Å__________________________________________________________________________Å_______Å________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ "--&TNPP &____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________WingdingsRoman$bb0bWo 0o, .  @n?" dd@  @@`` @   () **21//bb0bWo 00DWingdingsRoman$bb0bWo 0o, .  @n?" dd@  @@`` @   () **21// 21         HG    HGr3w9xX     Q    , 0AA f333f@8ghLf ʚ;Nh8ʚ;g42d2d0bNppp@ <4dddd 0b|%b <4BdBdb. 0bb<4!d!db. 0bb80___PPT10 ?  %C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to capture design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital ExampleSPatients play the Subject role State includes temp and heart rate Notifying all observers is done with Pat.PageAll() Nurses observe Patients Keep track if Patients have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)VNZH = I           PkYqT  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root EntrydO) gq.Current User;SummaryInformation(RPowerPoint Document(DocumentSummaryInformation8DTahomags-0z[ 0" DTimes New Roman0z[ 00DWingdingsRoman0z[ 0O, .  @n?" dd@  @@`` 8   () **21// 21         HG    HGopqr3w9xX     Q    , 0AA f333f@8ghwLf ʚ;Nh8ʚ;g42d2d z[ 0&ppp@ <4ddddL 0, <4BdBdL< 080___PPT10 ?  %C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to express design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital ExampleSPatients play the Subject role State includes temp and heart rate Notifying all observers is done with Pat.PageAll() Nurses observe Patients Keep track if Patients have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)VNZH = I           >g YiTN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%%f> $U 0 g 0 0(  x  c $00F   x  c $  H  0޽h ? fff___PPT10i.y@:#+D=' = @B +r^P*M? :,\)( / 00DArialngsRo'b$bb0bWo 0DTahomagsRo'b$bb0bWo 0" DTimes New Roman$ Z՜.+,0    +On-screen Showun-s  ArialTahomaTimes New Roman WingdingsShimmer$Monitoring Design Pattern ContractsDesign Patterns and Monitoring Our ApproachMethodology OverviewMethodology OverviewMethodology OverviewMethodology OverviewMethodology OverviewMethodology OverviewMethodology OverviewBenefits of Our ApproachAspect TerminologyMonitoring with AspectsPattern Example: ObserverThe Contract Aspect)Part of the Contract Aspect for Observer)Part of the Contract Aspect for ObserverIn the Subcontract AspectHospital Example$Pointcuts in the Subcontract AspectDefining RelationsDefining Relations DiscussionPresented MethodologyMonGen Methodology Conclusion Questions?  Fonts UsedDesign Template Slide Titles!_ Ben TylerBen TylerN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%%f> $ 0 g `0(  x  c $1g0F  g x  c $2gP g H  0޽h ? fff___PPT10i.+D=' = @B +r,EUA,|X\)( / 00DArialngsRo'b$bb0bWo 0DTahomagsRo'b$bb0bWo 0" DTimes New Roman$bb0bWo 00D 21         HG    HG 39xX     Q        , 0AA f333f@8ghLf ʚ;Nh8ʚ;g42d2d0b4ppp@ <4dddd 0b|%b <4BdBdb. 0bb<4!d!db. 0bb80___PPT10 ?  %C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to capture design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital ExampleSPatients play the Subject role State includes temp and heart rate Notifying all observers is done with Pat.PageAll() Nurses observe Patients Keep track if Patients have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)VNZH = I           PkYqTN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%%f> $ 0  g   $} (  $X $ 0fԔ@AA X $ 033Ԕ` AA x $ c $X |0F  | X $ 033ԔP ;X $ 033Ԕp X $ 033Ԕ `{ $ 06yԔC"? w n&System Code Purportedly uses pattern P,'    $ 0yԔC"?Sq  h Contract Aspect for P (abstract),!    $ 08yԔC"?` qA  i%Subcontract Aspect Specific to System(& RB  $ s *DԔ))` ^R  $ 6Ԕx  $ 0GtFC"? 0  $ <GEBHC"?pA0 X $ 033Ԕ`  $ 0yԔC"?C 0 bCompiled System Monitors P,   $ 0|ԔC"?` 0@@  JCompile/ Weave  d" $ <Ԕ 0@  $ 0,|  ) ZMonitoring Code .  2H $ 0޽h ? fff___PPT10i.+D=' = @B +rXWāQX\z)(      !"#$% / 00DArialngsRo'b$bb0bWo 0DTahomagsRo'b$bb0bWo 0" DTimes New Roman$bb0bWo 00DWingdingsRoman$bb0bWo 0o, .  @n?" dd@  @@`` @   () **21// 21         HG    HG39X     Q        ,  0AA f333f@8ghLf ʚ;Nh8ʚ;g42d2d0b(Nppp@ <4dddd 0b|%b <4BdBdb. 0bb<4!d!db. 0bb80___PPT10 ?  %C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to capture design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital ExampleSPatients play the Subject role State includes temp and heart rate Notifying all observers is done with Pat.PageAll() Nurses observe Patients Keep track if Patients have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)VNZH = I           PkYqTN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%% 0} g P$(  r  S C0F  C r  S CP C H  0޽h ? fff___PPT10i.˵+D=' = @B +rލ `?\)( / 00DArialngsRo'b$bb0bWo 0DTahomagsRo'b$bb0bWo 0" DTimes New Roman$bb0bWo 00DWingdingsRoman$bb0bWo 0o, .  @n?" dd@  @@`` @   () **21// 21         HG    HG39X     Q        ,  0AA f333f@8ghLf ʚ;Nh8ʚ;g42d2d0bNppp@ <4dddd 0b|%b <4BdBdb. 0bb<4!d!db. 0bb80___PPT10 ?  %C?#Monitoring Design Pattern Contracts$$%Jason O. Hallstrom Clemson University"& Design Patterns and MonitoringPatterns capture key system behaviors Behaviors often cross-cutting Usually, specified informally To monitor and test behaviors, informal specs are not enough8&<=&<=EA Our ApproachAOP aspect  Language construct, similar to a class, that implements cross-cutting behaviors for classes in an application Aspects can be used to capture design pattern contracts These aspects can be used to monitor system behavior to see if these contracts are respected Z GCMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0HDMethodology OverviewBThe contract aspect contains the main checking logic for a pattern&C0IBMethodology OverviewGThe subcontract aspect contains definitions specific to the application&H2Methodology Overview KGMethodology Overview LFMethodology Overview JEMethodology Overview D@Benefits of Our ApproachNo instrumentation of source code Monitoring code separate from application code Contract aspect needs to be created only once for a given design pattern Only need to create new subcontract aspects for each system to be monitored&LLZRAspect Terminology>Pointcut  A set of places in the class code where an aspect can insert new behavior Advice  Code associated with a pointcut that implements this new behavior2ME*&Monitoring with Aspects  Pattern Example: Observer MHThe Contract AspectFormalizes the behavior intended by the pattern Advice provides the main monitoring code for the pattern However, method names/signatures and concrete definitions for relations vary from application to application Use abstract pointcuts and methods for these in the contract aspect(Z8[T(Part of the Contract Aspect for ObserverProperty: After call to Update(), the Observer should be  consistent with its subjectWZWNI(Part of the Contract Aspect for ObservernAnother property: If a call to a Subject method results in a change in state, Notify() should have been calledoo3/4In the Subcontract Aspect& Associate concrete classes with pattern roles Insert dummy interfaces in the class hierarchy (AspectJ feature) Pointcut definitions that associate role methods with actual methods in the application Definitions for relations specific to the given application J.A.AW>^PMHospital Example Patients play the Subject role State includes temp and heart rate Nurses observe Patients Keep track if Patients have a fever or not Updates done with Nrs.TempUpd(Pat) Doctors also observe Patients Record whether or not patients are in stable condition Updates done with Doc.CondUpd(Pat)#NZ#= I        >qTN#Pointcuts in the Subcontract AspecttIn the subcontract aspect, we give definitions for the abstract pointcuts mentioned in the contract aspect Examples:RLDefining RelationsiNeed to provide definitions of application-specific relations in the subcontract aspect Example: Modified\UDefining RelationsAnother example: Consistent:6 Discussion"Contract aspects generally harder to write than the subcontract aspects Only have to write them once! Information such as method call sequences can be tracked using auxiliary variables in the aspect Pointcuts can encompass more than just method calls Current and future work MonGen and PCLHH WPPresented Methodology XQMonGen Methodology  B> ConclusionDesign patterns often describe behaviors that encompass multiple classes Aspects are a natural way to monitor such behaviors Separating the essence of the pattern from the details of the application saves time and effort *  Questions?Ve-mail tyler@cse.ohio-state.edu MonGen Web page: www.cse.ohio-state.edu/~tyler/MonGen`%% 0 g 0(  x  c $|C0F  C x  c $8C C H  0޽h ? fff___PPT10i.y@:#+D=' = @B +r!P*M\Root EntrydO)a@Current UserMSummaryInformation(RPowerPoint Document(      !"#$%* DiscussionPresented MethodologyMonGen Methodology Conclusion Questions?  Fonts UsedDesign Template Slide Titles'_Gary T. LeavensGary T. Leavens