27.03.2014 Views

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The use of metadata annotations brings two additional<br />

benef ts for the XPIDR interface specif cation and verif -<br />

cation. The f rst one guarantees that the specif celements<br />

exposed by the XPIDR (using the AspectJ supplying annotation<br />

syntax) must be declared by the base and aspect code.<br />

The second one is that unlike XPIs, we can now check specif<br />

c properties of a particular AspectJ advice. We match a<br />

specif c advice based on its annotation type.<br />

In relation to the use of design rules, we can minimize<br />

the impact of the well known problem of pointcut fragility.<br />

For example, if a developer changes the base code, by removing<br />

a join point shadow (a method call), can lead the<br />

aspect code to behave in a different way from what is expected.<br />

Hence, our XPIDR checks the method call occurrence<br />

and if it is not found, the developer is warned about<br />

the missing join point.<br />

4.1 Feature Request<br />

Some problems we had during XPIDR specif cation<br />

could be avoided if we could add a supply clause for advice.<br />

Therefore, we submitted a feature request to the AspectJ<br />

team, which they hope to consider for a future version<br />

of AspectJ. We suggested the support of a new construct<br />

that marks an advice with an annotation. For example, it<br />

could be used as in the following:<br />

declare @advice : update . around ( . . ) : @UpdateConcern;<br />

This declaration would avoid the extra annotations added<br />

directly in the advice declaration, such as the one used to<br />

say that an around advice must proceed.<br />

5 Summary<br />

Metadata annotations, pointcuts and advice are useful<br />

techniques commonly used for separating concerns in<br />

source code. We have combined these three AO techniques<br />

towards a design by contract methodology for AOP. Each of<br />

these AO mechanisms makes a different kind of task: annotations<br />

mark join points related to the base and aspect code;<br />

pointcuts bindings sets of join points marked with annotations,<br />

and advice provide the checking code implementation<br />

to sets of join points denoted by pointcuts.<br />

We have combined the notion of crosscut programming<br />

interfaces (XPIs) [4] with more expressive design rules<br />

adopted by LSD [9]. Such design rules are specif ed and<br />

checked using the three AO mechanisms we focus in this<br />

paper. We call our enhanced XPIs as crosscut programming<br />

interfaces with design rules, orXPIDRs.<br />

Our main contribution is that we have devised a practical<br />

alternative way to a enable an expressive design by contract<br />

methodology for AOP using existing AOP constructs like<br />

those of AspectJ. In addition, our approach, called XPIDRs,<br />

is a grey box specif cation based approach, which provides<br />

means to detailed specify control f ow effects for both base<br />

and aspect code. In a grey box specif cation, the designer<br />

decides whether or not to expose control f ow effects. As a<br />

result, only interesting control f ow effects are exposed.<br />

Finally, and most importantly, using XPIDRs a developer<br />

does not require new AO constructs, which in turns<br />

makes the adoption by the AO community more easier. We<br />

argued that the design rules of XPIDRs showed to be more<br />

expressive than the existing AO based techniques [4, 14].<br />

References<br />

[1] M. Bagherzadeh et al. Translucid contracts: expressive specif<br />

cation and modular verif cation for aspect-oriented interfaces.<br />

In <strong>Proceedings</strong> of AOSD’11, 2011.<br />

[2] K.P.Boysen. Aspecif cation language design for jml using<br />

Java 5 annotations. Technical report, Iowa State University,<br />

2008.<br />

[3] M. Büchi and W. Weck. The greybox approach: When<br />

blackbox specif cation hide too much. Technical report,<br />

Aug. 06 1999.<br />

[4] W. G. Griswold et al. Modular software design with crosscutting<br />

interfaces. IEEE Softw., 23:51–60, January 2006.<br />

[5] G. Kiczales et al. Aspect-oriented programming. In ECOOP<br />

97, 1997.<br />

[6] G. Kiczales et al. Getting Started with AspectJ. Commun.<br />

ACM, 44(10):59–65, 2001.<br />

[7] G. T. Leavens, A. L. Baker, and C. Ruby. Preliminary design<br />

of JML: A behavioral interface specif cation language for<br />

Java. ACM SIGSOFT Software Engineering Notes, 31(3):1–<br />

38, Mar. 2006.<br />

[8] B. Meyer. Applying “design by contract”. Computer,<br />

25(10):40–51, 1992.<br />

[9] A. C. Neto et al. A design rule language for aspect-oriented<br />

programming. In SBLP ’09, 2009.<br />

[10] H. Rajan and G. T. Leavens. Ptolemy: A language with<br />

quantif ed, typed events. In ECOOP 2008.<br />

[11] H. Rebêlo et al. Implementing java modeling language contracts<br />

with aspectj. In Proc. of the 2008 ACM SAC, 2008.<br />

[12] H. Rebêlo et al. The contract enforcement aspect pattern. In<br />

<strong>Proceedings</strong> of the 8th SugarLoafPlop, pages 99–114, 2010.<br />

[13] H. Rebêlo et al. Assessing the impact of aspects on design<br />

by contract effort: A quantitative study. In <strong>SEKE</strong>, pages<br />

450–455, 2011.<br />

[14] T. Skotiniotis and D. H. Lorenz. Cona: aspects for contracts<br />

and contracts for aspects. ACM SIGPLAN Notices,<br />

39(10):196–197, Oct. 2004.<br />

A. Online Appendix<br />

We invite researchers to replicate, analyze, and compare<br />

our XPIDR implementation of the f gure editor against its<br />

counterpart in XPI. The implementations are available at:<br />

http://www.cin.ufpe.br/˜hemr/seke12.<br />

153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!