Proving%20aspect-oriented%20programming%20laws - PowerPoint PPT Presentation

About This Presentation
Title:

Proving%20aspect-oriented%20programming%20laws

Description:

Outline. AspectJ Laws. MCI. Equivalence Notion. Add Before Execution Law. Conclusions. 7 ... body' does not declare or use local variables; body' does not call ... – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 27
Provided by: csU73
Learn more at: http://www.cs.ucf.edu
Category:

less

Transcript and Presenter's Notes

Title: Proving%20aspect-oriented%20programming%20laws


1
Proving aspect-oriented programming laws
Informatics Center Federal University of
Pernambuco Brazil
  • Leonardo Cole
  • Paulo Borba
  • Alexandre Mota
  • (lcn,phmb,acm_at_cin.ufpe.br)

2
Deriving Refactorings
  • Primitive laws of programming
  • simple, localized, intuitive and easier to
    understand
  • Two transformations
  • Bi-directional
  • Guarded by pre-conditions
  • We compose the laws to
  • Derive complex and global refactorings
  • Verify that an existing refactoring
  • preserves behaviour

3
Make Aspect Privileged
4
Problem
  • Current definition relies on the simplicity and
    intuition of the laws

It is necessary to formally prove the laws to
increase the confidence that they preserve
behaviour
5
Solution
  • Aspect-oriented semantics for Method Call
    Interception (MCI)
  • Equivalence notion for aspect-oriented programs

6
Outline
  • AspectJ Laws
  • MCI
  • Equivalence Notion
  • Add Before Execution Law
  • Conclusions

7
Add before-execution
(?) body does not declare or use local
variables body does not call super
8
Example
public class Account private double balance
... public void debit(double amount)
Access.check(new Permission()) //debit
logic ... public aspect
PermissionAspect
9
Applying Add Before-Execution Law
public class Account private double balance
... public void debit(double amount)
//debit logic ... privileged aspect
PermissionAspect before(Account cthis, double
amount) execution(void Account.debit(double)
this(cthis) args(amount)
Access.check(new Permission())
10
Summary of laws
Law Name Law Name
1 Add empty aspect 16 Remove argument parameter
2 Make aspect privileged 17 Add catch for softened exception
3 Add before-execution 18 Soften exception
4 Add before-call 19 Remove exception from throws clause
5 Add after-execution 20 Remove exception handling
6 Add after-call 21 Move exception handling to aspect
7 Add after returning-execution 22 Move field to aspect
8 Add after returning-call 23 Move method to aspect
9 Add after throwing-execution 24 Move implements declaration to aspect
10 Add after throwing-call 25 Move extends declaration to aspect
11 Add around-execution 26 Extract named pointcut
12 Add around-call 27 Use named pointcut
13 Merge advices 28 Move field introduction up to interface
14 Remove this parameter 29 Move method introduction up to interface
15 Remove target parameter 30 Remove method implementation
11
Method Call Interception - MCI
  • Operational semantics
  • Extends an object-oriented language to introduce
    aspect-oriented features
  • Superimpose construct
  • On dispatch
  • On enter
  • On exit

12
Domain Object-Store
13
?O2 Call Rule
14
MCI Call Rule
15
Equivalence Notion
  • We compare field values (heaps) resulting from
    the two programs execution
  • Strong notion (equal heaps)
  • Same number of objects
  • Same number of fields
  • Simplest notion to our objective
  • The laws do not change programs data structure

First component of the object-store must be
equal for both programs
16
Mapping AspectJ to MCI
  • Before-call x On dispatch
  • Before-execution x On enter
  • After-execution x On exit
  • args, this and target
  • Aspect x Main method

17
MCI Add Before Execution
18
Evaluation Tree Left
19
Evaluation Tree Right
20
Comparing Trees
Circled nodes may update object-store
21
Comparing
  • Circled nodes are syntactically equal in both
    sides
  • The order of execution is the same
  • Pre-conditions not necessary for the MCI law

22
Other Laws
  • Add before-call
  • Add after-execution returning
  • Merge advices
  • Remove target parameter
  • Remove this parameter

23
Conclusions
  • Increase confidence that aspect-oriented
    programming laws preserve behaviour
  • Equivalence notion for aspect-oriented programs
  • Formal argumentation about the soundness of some
    laws

24
Conclusions
  • Static semantics not considered
  • Formal proof using induction
  • Prove the remaining laws
  • Extend MCI
  • Choose another semantics

25
Proving aspect-oriented programming laws
Informatics Center Federal University of
Pernambuco Brazil
  • Leonardo Cole
  • Paulo Borba
  • Alexandre Mota
  • (lcn,phmb,acm_at_cin.ufpe.br)
  • Software Productivity Group
  • http//www.cin.ufpe.br/spg

26
Comparing Trees
Write a Comment
User Comments (0)
About PowerShow.com