Aspectual Component Implementation Examples
ComponentPackage Component Participant expectedOp() Op(){expectedOp(); getHost()} getHost() ConnectorPackage HostPackage H...
ComponentPackage Component Participant expectedOp() Op(){expectedOp(); getHost()} getHost() ConnectorPackage MyHost toModi...
ComponentPackage Component Participant expectedOp() Op(){expectedOp ??? (); getHost()} getHost() ConnectorPackage More com...
ComponentPackage Component Participant rOp(Method expOp) {expOp.invoke(); getHost();} getHost(); ConnectorPackage HostPack...
Implementations <ul><li>Implement Datastructure/Counter/Lock example  </li></ul><ul><ul><li>without reflection </li></ul><...
Upcoming SlideShare
Loading in …5
×

Aspectual Components Implementation: Examples

361 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
361
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Aspectual Components Implementation: Examples

  1. 1. Aspectual Component Implementation Examples
  2. 2. ComponentPackage Component Participant expectedOp() Op(){expectedOp(); getHost()} getHost() ConnectorPackage HostPackage Host // to play role of participant toModify(){} // to be mapped to Op() Johan’s solution 1 based on Mira’s inner class solution. Modification interface is represented also by abstract class, not by Method argument as proposed by Mira. “ outer.super.toModify()” simulated with aux() is not elegant MyHost toModify(){part.Op();}// override aux(){super.toModify()} part ParticipantAnonymousExtended expectedOp(){aux()} getHost(){MyHost.this} main(){new MyHost().toModify() }
  3. 3. ComponentPackage Component Participant expectedOp() Op(){expectedOp(); getHost()} getHost() ConnectorPackage MyHost toModify(){part.Op();} aux(){super.toModify()} part HostPackage ParticipantAnonymousExtended expectedOp(){aux()} getHost(){MyHost.this} main(){new MyHost().toModify() } Host toModify(){} Does it work with multiple participants? With multiple hosts? Looks like. Problem: when we have a Host-object and want to get modified behavior, need to create a MyHost object.
  4. 4. ComponentPackage Component Participant expectedOp() Op(){expectedOp ??? (); getHost()} getHost() ConnectorPackage More complex connector: one host but multiple methods are modified. Which expectedOp should be called in the participant? Is this why Mira’s implementation is more complex? part2 ParticipantAnonymousExtended expectedOp2(){aux2()} getHost(){MyHost.this} main(){new MyHost().toModify2() } toModify2(){part2.Op();}//override aux2(){super.toModify2()} ParticipantAnonymousExtended expectedOp1(){aux1()} getHost(){MyHost.this} main(){new MyHost().toModify1() } MyHost toModify1(){part1.Op();}//overrride aux1(){super.toModify1()} part1
  5. 5. ComponentPackage Component Participant rOp(Method expOp) {expOp.invoke(); getHost();} getHost(); ConnectorPackage HostPackage Host // to play role of participant toModify(){} // to be mapped to rOp() Mira’s modified inner class solution. MyHost toModify(){part.rOp(“toModify”);} part ParticipantAnonymousExtended getHost(){MyHost.this} main(){new MyHost().toModify() }
  6. 6. Implementations <ul><li>Implement Datastructure/Counter/Lock example </li></ul><ul><ul><li>without reflection </li></ul></ul><ul><ul><li>with reflection </li></ul></ul><ul><ul><li>apply to both Queue and Stack </li></ul></ul><ul><li>Implement ShowRWAccess example: simulate inheritance between components and connectors in Java </li></ul><ul><ul><li>without reflection </li></ul></ul><ul><ul><li>with reflection </li></ul></ul><ul><ul><ul><li>map readOp to two methods of two different application classes </li></ul></ul></ul>

×