Aspectual Component Implementation Examples Component Package Component Participant

  • Slides: 6
Download presentation
Aspectual Component Implementation Examples

Aspectual Component Implementation Examples

Component. Package Component Participant expected. Op(){expected. Op(); get. Host()} get. Host() Connector. Package My.

Component. Package Component Participant expected. Op(){expected. Op(); get. Host()} get. Host() Connector. Package My. Host to. Modify(){part. Op(); }// override aux(){super. to. Modify()} part Participant. Anonymous. Extended expected. Op(){aux()} get. Host(){My. Host. this} main(){new My. Host(). to. Modify() } “outer. super. to. Modify()” simulated with aux() is not elegant Johan’s solution 1 based on Mira’s inner class solution. Modification interface Host. Package is represented also by Host // to play role of participant abstract class, not by to. Modify(){} Method argument as // to be mapped to Op() proposed by Mira.

Component. Package Component Participant expected. Op(){expected. Op(); get. Host()} get. Host() Connector. Package My.

Component. Package Component Participant expected. Op(){expected. Op(); get. Host()} get. Host() Connector. Package My. Host to. Modify(){part. Op(); } aux(){super. to. Modify()} part Participant. Anonymous. Extended expected. Op(){aux()} get. Host(){My. Host. this} main(){new My. Host(). to. Modify() } Problem: when we have a Host-object and want to get Does it work with multiple modified behavior, need to create a My. Host object. participants? With multiple hosts? Host. Package Looks like. Host to. Modify(){}

Component. Package Component Participant expected. Op(){expected. Op? ? ? (); get. Host()} get. Host()

Component. Package Component Participant expected. Op(){expected. Op? ? ? (); get. Host()} get. Host() More complex connector: one host but multiple methods are modified. Which expected. Op should be called in the participant? Is this why Mira’s implementation is more complex? Connector. Package My. Host to. Modify 1(){part 1. Op(); }//overrride aux 1(){super. to. Modify 1()} part 1 Participant. Anonymous. Extended expected. Op 1(){aux 1()} get. Host(){My. Host. this} main(){new My. Host(). to. Modify 1()} part 2 Participant. Anonymous. Extended expected. Op 2(){aux 2()} get. Host(){My. Host. this} main(){new My. Host(). to. Modify 2()} to. Modify 2(){part 2. Op(); }//override aux 2(){super. to. Modify 2()}

Connector. Package Component. Package My. Host to. Modify(){part. r. Op(“to. Modify”); } Component Participant

Connector. Package Component. Package My. Host to. Modify(){part. r. Op(“to. Modify”); } Component Participant r. Op(Method exp. Op) {exp. Op. invoke(); get. Host(); } get. Host(); part Participant. Anonymous. Extended get. Host(){My. Host. this} main(){new My. Host(). to. Modify() } Host. Package Mira’s modified inner class solution. Host // to play role of participant to. Modify(){} // to be mapped to r. Op()

Implementations • Implement Datastructure/Counter/Lock example – without reflection – with reflection – apply to

Implementations • Implement Datastructure/Counter/Lock example – without reflection – with reflection – apply to both Queue and Stack • Implement Show. RWAccess example: simulate inheritance between components and connectors in Java – without reflection – with reflection • map read. Op to two methods of two different application classes