Modular Reasoning in Aspect-Oriented Languages from a Substitution Perspective

In object-oriented languages, a notion of behavioural subtyping is needed to enable modular reasoning. This is no longer sufficient when such languages are extended with aspects. In general, all aspects need to be inspected in order to understand the behaviour of a single method or proceed call, which complicates reasoning about aspect-oriented programs. In this paper, we present an approach to modular reasoning that consists of two parts. First, the advice substitution principle, based on behavioural subtyping, identifies when it is possible to remain unaware of an advice while preserving modular reasoning. Second, in cases where it is undesired or impossible to be unaware of an advice, a simple specification clause can be used to restore modular reasoning and to become aware of this advice. We show that our approach effectively enables modular reasoning about pre- and postconditions in a minimal aspect-oriented language called ContractAJ. To ensure the approach is used correctly, we also provide a runtime contract enforcement algorithm that is specified in ContractAJ, and implemented in AspectJ.

[1]  Andy Clement,et al.  Aspect-Oriented Programming with AJDT , 2003 .

[2]  Gary T. Leavens,et al.  Modular aspect-oriented design rule enforcement with XPIDRs , 2013, FOAL.

[3]  K. Rustan M. Leino,et al.  Object Invariants in Dynamic Contexts , 2004, ECOOP.

[4]  Gary T. Leavens,et al.  A design discipline and language features for modular reasoning in aspect-oriented programs , 2005 .

[5]  Pierre America,et al.  Designing an Object-Oriented Programming Language with Behavioural Subtyping , 1990, REX Workshop.

[6]  Jonathan Aldrich,et al.  Open Modules: Modular Reasoning About Advice , 2005, ECOOP.

[7]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[8]  Sven Apel,et al.  Types and modularity for implicit invocation with implicit announcement , 2010, TSEM.

[9]  John Mylopoulos,et al.  On the Frame Problem in Procedure Specifications , 1995, IEEE Trans. Software Eng..

[10]  Yuanyuan Song,et al.  Modular aspect-oriented design with XPIs , 2010, ACM Trans. Softw. Eng. Methodol..

[11]  Andry Rakotonirainy,et al.  Context-oriented programming , 2003, MobiDe '03.

[12]  K. Rustan M. Leino,et al.  Data groups: specifying the modification of extended state , 1998, OOPSLA '98.

[13]  Bertrand Meyer,et al.  Applying 'design by contract' , 1992, Computer.

[14]  Martin C. Rinard,et al.  A classification system and analysis for aspect-oriented programs , 2004, SIGSOFT '04/FSE-12.

[15]  Gary T. Leavens,et al.  Ptolemy: A Language with Quantified, Typed Events , 2008, ECOOP.

[16]  Dean Wampler Aspect-Oriented Design in Java/AspectJ and Ruby , 2007, 29th International Conference on Software Engineering (ICSE'07 Companion).

[17]  Gary T. Leavens,et al.  Translucid contracts: expressive specification and modular verification for aspect-oriented interfaces , 2011, AOSD '11.

[18]  Reiner Hähnle,et al.  A Liskov Principle for Delta-Oriented Programming , 2012, ISoLA.

[19]  Matthias Felleisen,et al.  Contract Soundness for object-oriented languages , 2001, OOPSLA '01.

[20]  Jianjun Zhao,et al.  Pipa: A Behavioral Interface Specification Language for AspectJ , 2003, FASE.

[21]  David H. Lorenz,et al.  Extending Design by Contract for Aspect-Oriented Programming , 2005, ArXiv.

[22]  Albert L. Baker,et al.  Preliminary design of JML: a behavioral interface specification language for java , 2006, SOEN.

[23]  Michael Barnett,et al.  Towards imperative modules: reasoning about invariants and sharing of mutable state , 2004, Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, 2004..

[24]  Dean Wampler,et al.  Aspect-Oriented Design Principles : Lessons from Object-Oriented Design , 2007 .

[25]  簡聰富,et al.  物件導向軟體之架構(Object-Oriented Software Construction)探討 , 1989 .

[26]  Daniel P. Friedman,et al.  Aspect-Oriented Programming is Quantification and Obliviousness , 2000 .

[27]  Gary T. Leavens,et al.  MAO: Ownership and Effects for More Effective Reasoning About Aspects , 2007, ECOOP.

[28]  Kim B. Bruce,et al.  Guest Editorial: Foundations of Object-Oriented Languages , 2002, Inf. Comput..

[29]  MeyerBertrand,et al.  Design by Contract , 1997 .

[30]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[31]  Jeannette M. Wing,et al.  A behavioral notion of subtyping , 1994, TOPL.

[32]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[33]  Mira Mezini,et al.  An Overview of CaesarJ , 2006, LNCS Trans. Aspect Oriented Softw. Dev..

[34]  Mehmet Aksit,et al.  Transactions on Aspect-Oriented Software Development I , 2006, Trans. Aspect-Oriented Software Development I.

[35]  Gunter Saake,et al.  Applying Design by Contract to Feature-Oriented Programming , 2012, FASE.

[36]  A NaumannDavid,et al.  Towards imperative modules , 2006 .

[37]  Gary T. Leavens,et al.  Observers and Assistants: A Proposal for Modular Aspect-Oriented Reasoning , 2002 .

[38]  Ana Moreira,et al.  Contracts for aspect-oriented design , 2008 .

[39]  Shmuel Katz Aspect Categories and Classes of Temporal Properties , 2006, LNCS Trans. Aspect Oriented Softw. Dev..

[40]  Perdita Stevens,et al.  Modelling Recursive Calls with UML State Diagrams , 2003, FASE.

[41]  Stephen Gilmore,et al.  Rigorous Graphical Modelling of Movement in Collective Adaptive Systems , 2016, ISoLA.

[42]  Sven Apel,et al.  How AspectJ is Used: An Analysis of Eleven AspectJ Programs , 2010, J. Object Technol..

[43]  Gary T. Leavens,et al.  Obliviousness, Modular Reasoning, and the Behavioral Subtyping Analogy , 2003 .

[44]  H. Rajan,et al.  Classpects: unifying aspect- and object-oriented language design , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[45]  Gary T. Leavens,et al.  Forcing behavioral subtyping through specification inheritance , 1996, Proceedings of IEEE 18th International Conference on Software Engineering.

[46]  David Walker,et al.  Harmless advice , 2006, POPL '06.

[47]  Eric Bodden,et al.  Join point interfaces for safe and flexible decoupling of aspects , 2014, TSEM.

[48]  Gary T. Leavens,et al.  Modular invariants for layered object structures , 2006, Sci. Comput. Program..

[49]  Gary T. Leavens,et al.  Behavioral Subtyping, Specification Inheritance, and Modular Reasoning , 2015, ACM Trans. Program. Lang. Syst..

[50]  Christian Koppen,et al.  PCDiff : Attacking the Fragile Pointcut Problem , 2004 .