Skip to main content

Modular Reasoning in Aspect-Oriented Languages from a Substitution Perspective

  • Chapter
  • First Online:
Transactions on Aspect-Oriented Software Development XII

Part of the book series: Lecture Notes in Computer Science ((TAOSD,volume 8989))

Abstract

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.

Tim Molderez—Funded by a doctoral scholarship of the Research Foundation - Flanders (FWO).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    An analogous definition of \(\rightharpoonup _{\mathsf {sep}}\) can be given for advice with an execution pointcut.

  2. 2.

    Note that execution pointcuts matching on advice executions are also converted into call pointcuts, which is accepted by ContractAJ’s operational semantics as it reuses the dynamic type as static type in advice executions.

  3. 3.

    An analogous definition of \(\rightharpoonup _{\mathsf {exec}}\) can be given in case an if construct is already present in the execution pointcut.

  4. 4.

    Note that we use two different concatenation symbols to avoid ambiguity. “;” concatenates records in \(\mathcal {J}\) and “+” concatenates tuples in an \(\mathcal {A}\) record.

  5. 5.

    The tuple might still be needed in case an around advice makes multiple proceed calls. This is however not supported, as it is an uncommon scenario and would unnecessarily complicate the semantics.

  6. 6.

    This definition only applies if all advice are ASP-compliant; it will be extended later in Sect. 5.5 to take into account non-ASP-compliant advice as well.

  7. 7.

    An execution pointcut can only be determined dynamically, but we assume that it has already been converted into a call pointcut conjoined with an if construct, as described in Fig. 4 of Sect. 3.1.

  8. 8.

    The evaluation of the condition in if pointcut constructs might involve store-altering rule applications. However, this is harmless as we assume that these conditions are free from side effects and always terminate.

  9. 9.

    The library and source code are available at: https://github.com/timmolderez/adbc.

  10. 10.

    One caveat is that an advice body should make use of its thisJoinPoint variable in order for it to be available for higher-order advice.

References

  1. Agostinho, S., Moreira, A., Guerreiro, P.: Contracts for aspect-oriented design. In: Proceedings of the 2008 AOSD workshop on Software Engineering Properties of Languages and Aspect Technologies (SPLAT), pp. 1:1–1:6. ACM, New York, NY, USA (2008)

    Google Scholar 

  2. Aldrich, J.: Open modules: modular reasoning about advice. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 144–168. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  3. America, P.: Designing an object-oriented programming language with behavioural subtyping. In: de Bakker, J.W., de Roever, W.P., Rozenberg, G. (eds.) Foundations of Object-Oriented Languages. LNCS, vol. 489, pp. 60–90. Springer, Heidelberg (1991)

    Chapter  Google Scholar 

  4. Apel, S., Batory, D.: How AspectJ is used: an analysis of eleven AspectJ programs. J. Object Technol. (JOT) 9(1), 117–142 (2010)

    Article  Google Scholar 

  5. Aracic, I., Gasiunas, V., Mezini, M., Ostermann, K.: An overview of CaesarJ. In: Rashid, A., Akşit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 135–173. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  6. Bagherzadeh, M., Rajan, H., Leavens, G.T., Mooney, S.: Translucid contracts: expressive specification and modular verification for aspect-oriented interfaces. In: Proceedings of the Tenth International Conference on Aspect-Oriented Software Development, AOSD 2011, pp. 141–152. ACM, New York, NY, USA (2011)

    Google Scholar 

  7. Bodden, E., Tanter, É., Inostroza, M.: Join point interfaces for safe and flexible decoupling of aspects. ACM Trans. Softw. Eng. Methodol. 23(1), 7:1–7:41 (2014)

    Article  Google Scholar 

  8. Borgida, A., Mylopoulos, J., Reiter, R.: On the frame problem in procedure specifications. IEEE Trans. Softw. Eng. 21(10), 785–798 (1995)

    Article  Google Scholar 

  9. Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. SIGPLAN Not. 33(10), 48–64 (1998)

    Article  Google Scholar 

  10. Clement, A., Colyer, A., Kersten, M.: Aspect-oriented programming with AJDT. In: ECOOP Workshop on Analysis of Aspect-Oriented Software (2003)

    Google Scholar 

  11. Clifton, C., Leavens, G.T.: Observers and assistants: a proposal for modular aspect-oriented reasoning. In: Proceedings of the 1st Workshop on Foundations of Aspect-Oriented Languages, FOAL 2002, p. 33 (2002)

    Google Scholar 

  12. Clifton, C., Leavens, G.T.: Obliviousness, modular reasoning, and the behavioral subtyping analogy. In: Workshop on Software Engineering Properties of Languages for Aspect Technologies (SPLAT) (2003)

    Google Scholar 

  13. Clifton, C., Leavens, G.T.: A design discipline and language features for modular reasoning in aspect-oriented programs. Ph.D. thesis, Iowa State University (2005)

    Google Scholar 

  14. Clifton, C., Leavens, G.T., Boyland, J.: MAO: ownership and effects for more effective reasoning about aspects. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 451–475. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  15. Dantas, D.S., Walker, D.: Harmless advice. In: Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, pp. 383–396. ACM, New York, NY, USA (2006)

    Google Scholar 

  16. Dhara, K.K., Leavens, G.T.: Forcing behavioral subtyping through specification inheritance. In: Proceedings of the 18th International Conference on Software Engineering, 1996, pp. 258–267 (1996)

    Google Scholar 

  17. Filman, R.E., Friedman, D.P.: Aspect-oriented programming is quantification and obliviousness. In: Workshop on Advanced separation of Concerns, OOPSLA (2000)

    Google Scholar 

  18. Findler, R.B., Felleisen, M.: Contract soundness for object-oriented languages. In: Proceedings of the 16th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pp. 1–15. ACM, New York, NY, USA (2001)

    Google Scholar 

  19. Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pp. 171–183. ACM Press, New York, USA, January 1998

    Google Scholar 

  20. Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Technol. 7(3), 125–151 (2008)

    Google Scholar 

  21. Katz, S.: Aspect categories and classes of temporal properties. In: Rashid, A., Akşit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 106–134. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  22. Koppen, C., Störzer, M.: PCDiff: attacking the fragile pointcut problem. In: European Interactive Workshop on Aspects in Software (2004)

    Google Scholar 

  23. Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary design of JML: a behavioral interface specification language for java. SIGSOFT Softw. Eng. Notes 31(3), 1–38 (2006)

    Article  Google Scholar 

  24. Leavens, G.T., Naumann, D.A.: Behavioral subtyping, specification inheritance, and modular reasoning (2006)

    Google Scholar 

  25. Rustan, K., Leino, M.: Data groups: specifying the modification of extended state. SIGPLAN Not. 33(10), 144–153 (1998)

    Article  Google Scholar 

  26. Rustan, K., Leino, M., Müller, P.: Object invariants in dynamic contexts. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 491–515. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  27. Liskov, B.H., Wing, J.M.: A behavioral notion of subtyping. ACM Trans. Program. Lang. Syst. (TOPLAS) 16(6), 1811–1841 (1994)

    Article  Google Scholar 

  28. Lorenz, D.H., Skotiniotis, T.: Extending design by contract for aspect-oriented programming, January 2005. http://arxiv.org/abs/cs/0501070

  29. Meyer, B.: Object-Oriented Software Construction, vol. 2. Prentice Hall, New York (1988)

    Google Scholar 

  30. Meyer, B.: Applying “Design by contract”. Computer 25(10), 40–51 (1992)

    Article  Google Scholar 

  31. Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular invariants for layered object structures. Sci. Comput. Program. 62(3), 253–286 (2006)

    Article  MATH  Google Scholar 

  32. Naumann, D.A., Barnett, M.: Towards imperative modules: Reasoning. Theor. Comput. Sci. 365(1–2), 143–168 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  33. Rajan, H., Leavens, G.T.: Ptolemy: a language with quantified, typed events. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 155–179. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  34. Rajan, H., Sullivan, K.J.: Classpects: unifying aspect- and object-oriented language design. In: 27th International Conference on Software Engineering (ICSE), pp. 59–68 (2005)

    Google Scholar 

  35. Rebelo, H., Leavens, G.T., Lima, R.M.F., Borba, P. Ribeiro, M.: Modular aspect-oriented design rule enforcement with XPIDRs. In: Proceedings of the 12th workshop on Foundations of Aspect-Oriented Languages, FOAL 2013, pp. 13–18. ACM, New York, NY, USA (2013)

    Google Scholar 

  36. Hähnle, R., Schaefer, I.: A Liskov principle for delta-oriented programming. In: Margaria, T., Steffen, B. (eds.) Leveraging Applications of Formal Methods, Verification and Validation. Technologies for Mastering Change. LNCS, vol. 7609, pp. 32–46. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  37. Rinard, M., Salcianu, A., Bugrara, S.: A classification system and analysis for aspect-oriented programs. In: Proceedings of the 12th ACM SIGSOFT Twelfth International Symposium on Foundations of Software Engineering, SIGSOFT 2004/FSE-12, pp. 147–158. ACM, New York, NY, USA (2004)

    Google Scholar 

  38. Steimann, F., Pawlitzki, T., Apel, S., Kästner, C.: Types and modularity for implicit invocation with implicit announcement. ACM Trans. Softw. Eng. Methodol. 20(1), 1:1–1:43 (2010)

    Article  Google Scholar 

  39. Sullivan, K., Griswold, W.G., Rajan, H., Song, Y., Cai, Y., Shonle, M., Tewari, N.: Modular aspect-oriented design with XPIs. ACM Trans. Softw. Eng. Methodol. 20(2), 5:1–5:42 (2010)

    Article  Google Scholar 

  40. Thüm, T., Schaefer, I., Kuhlemann, M., Apel, S., Saake, G.: Applying design by contract to feature-oriented programming. In: de Lara, J., Zisman, A. (eds.) Fundamental Approaches to Software Engineering. LNCS, vol. 7212, pp. 255–269. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  41. Wampler, D.: Aspect-oriented design principles: Lessons from object-oriented design. In: Sixth International Conference on Aspect-Oriented Software Development (2007). http://aosd.net/2007/program/industry/I6-AspectDesignPrinciples.pdf

  42. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  43. Zhao, J., Rinard, M.: Pipa: a behavioral interface specification language for AspectJ. In: Pezzé, M. (ed.) FASE 2003. LNCS, vol. 2621, pp. 150–165. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tim Molderez .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Molderez, T., Janssens, D. (2015). Modular Reasoning in Aspect-Oriented Languages from a Substitution Perspective. In: Chiba, S., Tanter, É., Ernst, E., Hirschfeld, R. (eds) Transactions on Aspect-Oriented Software Development XII. Lecture Notes in Computer Science(), vol 8989. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-46734-3_1

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-46734-3_1

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-46733-6

  • Online ISBN: 978-3-662-46734-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics