Presentation is loading. Please wait.

Presentation is loading. Please wait.

Aspect-Oriented Software Development (AOSD) Additional Tutorial.

Similar presentations


Presentation on theme: "Aspect-Oriented Software Development (AOSD) Additional Tutorial."— Presentation transcript:

1 Aspect-Oriented Software Development (AOSD) Additional Tutorial

2 Aspect-Oriented Software Development (236608) 2 Today Comments on HW2 Comments on HW3 Answers to your questions received by e- mail

3 Aspect-Oriented Software Development (236608) 3 HW2 comments Aspect A: make it possible to temporarily close an exit (exit B). Specification attempt: –Assumption: “there is a ticket holder attempting to exit through B” –Guarantee: “if B exists, the user will not be permitted to exit. The state of the system will remain the same as before the "exit" command was executed” What’s the problem with this specification? Proposed “assumption” is the “if” part of the guarantee!

4 Aspect-Oriented Software Development (236608) 4 HW2 comments – contd. Aspect category justification attempt: “The aspect is strongly invasive because it adds new functionality / new field / … to the system “ What’s the problem with this statement? –The new fields are part of the aspect, and not part of the base system state => they won’t influence the projection –Not every new functionality will result in adding states to the base system! For example, an aspect that adds a logging functionality to the system is spectative…

5 Aspect-Oriented Software Development (236608) 5 HW2 comments – contd.(2) Change-giving aspect category justification attempt: “aspect A is strongly invasive, because a=p a!=p error accept base system (S) a=p a!=p erroraccepta>pa<pGive change System after weaving “new” state Wrong! Projected on “a!=p”

6 Aspect-Oriented Software Development (236608) 6 HW3 comments 1.In Question 3: The pointcut should be marked by a new predicate in the pointcut-ready tableau, otherwise the aspect will not be able to distinguish between the pointcut and non- pointcut states with "b"!

7 Aspect-Oriented Software Development (236608) 7 HW3 - Possible solution to Q.1 Cond Any Fst Permissions MagenFactor Average isCrosscutting iff examGrade > 55 isCrosscutting iff original examGrade > 55 isCrosscutting iff the operation is forbidden for the current user might modify exam grade isCrosscutting iff the event is “viewAverage”

8 Aspect-Oriented Software Development (236608) 8 Social Security System - reminder Document flow: Creates client’s entry (claim document) in the system Forwards the request to the appropriate handler Evaluates client’s disablement Issues bank orders Communicates with clients

9 Aspect-Oriented Software Development (236608) 9 Adding Logging – reminder Register all the interactions among objects: Add the class Logger. Main functionality: loggingEnabled – activate the logging loggingDisabled – deactivate the logging log(message) – extract the necessary info Additional functionality – retrieve information from the log

10 Aspect-Oriented Software Development (236608) 10 Logging – Implementation concern Logging begin // introduces centralized logger filterinterface notifyLogger begin … end filterinterface notifyLogger; filterinterface logger begin … end filterinterface logger; superimposition begin … end superimposition implementation in Java class LoggerClass { … } end implementation end concern Logging; to be added to the filterinterface of every concern we need to monitor performs the logging operation (the Meta filter defined in notifyLogger sends the messages to this logger) defines which concerns, etc. will be “modified”, and how

11 Aspect-Oriented Software Development (236608) 11 Logging – Implementation (contd.) concern Logging begin // introduces centralized logger filterinterface notifyLogger begin // this part declares the crosscutting code externals logger : Logging; // *declare* a shared instance of this concern internals logOn : boolean; // created when the filterinterface is imposed methods loggingOn(); // turn logging for this object on logginOff(); // turn logging for this object off log(Message); // declared here for typing purposes only conditions … // to be defined inputfilters … // to be defined outputfilters … //not needed end filterinterface notifyLogger; … end concern Logging;

12 Aspect-Oriented Software Development (236608) 12 Logging – Implementation (contd.) filterinterface logger begin externals //not needed internals //not needed methods log(Message); // various methods to retrieve info. from the log inputfilters disp : Dispatch = { inner.* }; outputfilters //not needed end filterinterface logger; accept all methods implemented by the object to which the logger is applied

13 Aspect-Oriented Software Development (236608) 13 Logging – Implementation (contd.) filterinterface notifyLogger begin // this part declares the crosscutting code externals logger : Logging; // *declare* a shared instance of this concern internals logOn : boolean; // created when the filterinterface is imposed methods loggingOn(); // turn logging for this object on logginOff(); // turn logging for this object off log(Message); // declared here for typing purposes only conditions LoggingEnabled; inputfilters logMessages : Meta = { LoggingEnabled=>[*]logger.log }; dispLogMethods : Dispatch = { loggingOn, loggingOff }; end filterinterface notifyLogger; if logging is enabled… log every message

14 Aspect-Oriented Software Development (236608) 14 Logging – Implementation (contd.) concern Logging begin … superimposition begin selectors allConcerns = { *!=Logging }; conditions allConcerns <- LoggingEnabled; filterinterfaces allConcerns <- notifyLogger; self <- logger; end superimposition; … end concern Logging; everything except instances of Logging the applicability of Logging should be defined separately for each concern other than Logging Every concern (except for Logging) is crosscut by notifyLogger So that the logger will be able to retrieve info from the log…

15 Aspect-Oriented Software Development (236608) 15 Logging – Implementation (contd.) concern Logging begin … // the only part left: implementation in Java class LoggerClass { boolean LoggingEnabled() { return logOn }; void loggingOn() { logOn:=true; }; void loggingOff() { logOn:=false; }; void log(Message msg) { … }; // get information from message and store } end implementation end concern Logging; “fire” is here…

16 Aspect-Oriented Software Development (236608) 16 EAOP: Aspect Composition Example (from Tutorial 7) Aspects on class Point: C: Positive quarter check; [after advice!!!] E: Positive quarter enforce; [before advice] N: Name adding and movements tracking [after] Any C N E


Download ppt "Aspect-Oriented Software Development (AOSD) Additional Tutorial."

Similar presentations


Ads by Google