Skip to main content
Top
Published in:
Cover of the book

2015 | OriginalPaper | Chapter

Modular Reasoning in Aspect-Oriented Languages from a Substitution Perspective

Authors : Tim Molderez, Dirk Janssens

Published in: Transactions on Aspect-Oriented Software Development XII

Publisher: Springer Berlin Heidelberg

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

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.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
1
An analogous definition of \(\rightharpoonup _{\mathsf {sep}}\) can be given for advice with an execution pointcut.
 
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
An analogous definition of \(\rightharpoonup _{\mathsf {exec}}\) can be given in case an if construct is already present in the execution pointcut.
 
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
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
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
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
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
The library and source code are available at: https://​github.​com/​timmolderez/​adbc.
 
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.
 
Literature
1.
go back to reference 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) 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)
2.
go back to reference Aldrich, J.: Open modules: modular reasoning about advice. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 144–168. Springer, Heidelberg (2005) CrossRef Aldrich, J.: Open modules: modular reasoning about advice. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 144–168. Springer, Heidelberg (2005) CrossRef
3.
go back to reference 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)CrossRef 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)CrossRef
4.
go back to reference Apel, S., Batory, D.: How AspectJ is used: an analysis of eleven AspectJ programs. J. Object Technol. (JOT) 9(1), 117–142 (2010)CrossRef Apel, S., Batory, D.: How AspectJ is used: an analysis of eleven AspectJ programs. J. Object Technol. (JOT) 9(1), 117–142 (2010)CrossRef
5.
go back to reference 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) CrossRef 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) CrossRef
6.
go back to reference 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) 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)
7.
go back to reference 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)CrossRef 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)CrossRef
8.
go back to reference Borgida, A., Mylopoulos, J., Reiter, R.: On the frame problem in procedure specifications. IEEE Trans. Softw. Eng. 21(10), 785–798 (1995)CrossRef Borgida, A., Mylopoulos, J., Reiter, R.: On the frame problem in procedure specifications. IEEE Trans. Softw. Eng. 21(10), 785–798 (1995)CrossRef
9.
go back to reference Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. SIGPLAN Not. 33(10), 48–64 (1998)CrossRef Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. SIGPLAN Not. 33(10), 48–64 (1998)CrossRef
10.
go back to reference Clement, A., Colyer, A., Kersten, M.: Aspect-oriented programming with AJDT. In: ECOOP Workshop on Analysis of Aspect-Oriented Software (2003) Clement, A., Colyer, A., Kersten, M.: Aspect-oriented programming with AJDT. In: ECOOP Workshop on Analysis of Aspect-Oriented Software (2003)
11.
go back to reference 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) 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)
12.
go back to reference 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) 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)
13.
go back to reference 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) 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)
14.
go back to reference 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) CrossRef 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) CrossRef
15.
go back to reference 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) 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)
16.
go back to reference 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) 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)
17.
go back to reference Filman, R.E., Friedman, D.P.: Aspect-oriented programming is quantification and obliviousness. In: Workshop on Advanced separation of Concerns, OOPSLA (2000) Filman, R.E., Friedman, D.P.: Aspect-oriented programming is quantification and obliviousness. In: Workshop on Advanced separation of Concerns, OOPSLA (2000)
18.
go back to reference 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) 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)
19.
go back to reference 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 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
20.
go back to reference Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Technol. 7(3), 125–151 (2008) Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Technol. 7(3), 125–151 (2008)
21.
go back to reference 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) CrossRef 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) CrossRef
22.
go back to reference Koppen, C., Störzer, M.: PCDiff: attacking the fragile pointcut problem. In: European Interactive Workshop on Aspects in Software (2004) Koppen, C., Störzer, M.: PCDiff: attacking the fragile pointcut problem. In: European Interactive Workshop on Aspects in Software (2004)
23.
go back to reference 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)CrossRef 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)CrossRef
24.
go back to reference Leavens, G.T., Naumann, D.A.: Behavioral subtyping, specification inheritance, and modular reasoning (2006) Leavens, G.T., Naumann, D.A.: Behavioral subtyping, specification inheritance, and modular reasoning (2006)
25.
go back to reference Rustan, K., Leino, M.: Data groups: specifying the modification of extended state. SIGPLAN Not. 33(10), 144–153 (1998)CrossRef Rustan, K., Leino, M.: Data groups: specifying the modification of extended state. SIGPLAN Not. 33(10), 144–153 (1998)CrossRef
26.
go back to reference 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) CrossRef 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) CrossRef
27.
go back to reference Liskov, B.H., Wing, J.M.: A behavioral notion of subtyping. ACM Trans. Program. Lang. Syst. (TOPLAS) 16(6), 1811–1841 (1994)CrossRef Liskov, B.H., Wing, J.M.: A behavioral notion of subtyping. ACM Trans. Program. Lang. Syst. (TOPLAS) 16(6), 1811–1841 (1994)CrossRef
29.
go back to reference Meyer, B.: Object-Oriented Software Construction, vol. 2. Prentice Hall, New York (1988) Meyer, B.: Object-Oriented Software Construction, vol. 2. Prentice Hall, New York (1988)
30.
go back to reference Meyer, B.: Applying “Design by contract”. Computer 25(10), 40–51 (1992)CrossRef Meyer, B.: Applying “Design by contract”. Computer 25(10), 40–51 (1992)CrossRef
31.
go back to reference Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular invariants for layered object structures. Sci. Comput. Program. 62(3), 253–286 (2006)CrossRefMATH Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular invariants for layered object structures. Sci. Comput. Program. 62(3), 253–286 (2006)CrossRefMATH
33.
go back to reference 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) CrossRef 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) CrossRef
34.
go back to reference 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) 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)
35.
go back to reference 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) 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)
36.
go back to reference 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) CrossRef 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) CrossRef
37.
go back to reference 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) 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)
38.
go back to reference 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)CrossRef 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)CrossRef
39.
go back to reference 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)CrossRef 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)CrossRef
40.
go back to reference 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) CrossRef 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) CrossRef
43.
go back to reference 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) CrossRef 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) CrossRef
Metadata
Title
Modular Reasoning in Aspect-Oriented Languages from a Substitution Perspective
Authors
Tim Molderez
Dirk Janssens
Copyright Year
2015
Publisher
Springer Berlin Heidelberg
DOI
https://doi.org/10.1007/978-3-662-46734-3_1

Premium Partner