Can Aspects Implement Contracts?

  • Stephanie Balzer
  • Patrick Th. Eugster
  • Bertrand Meyer
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3943)


Design by ContractTMis commonly cited as an example of the “crosscutting” concerns that aspect-oriented programming can address. We test this conjecture by attempting to implement contracts through aspects and assessing the outcome. The results of this experiment cast doubt on the validity of the conjecture, showing that aspects appear unable to capture contracts in a way that retains the benefits of the Design by Contract methodology.


Class Text Class Point Class Invariant Procedure Move Public Void 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C., Loingtier, J.M., Irwin, J.: Aspect-oriented programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  2. 2.
    Lieberherr, K.J., Lorenz, D.H., Mezini, M.: Building modular object-oriented systems with reusable collaborations (tutorial session). In: ICSE, p. 821. ACM Press, New York (2000)Google Scholar
  3. 3.
    Lopes, C.V., Kiczales, G.: Improving design and source code modularity using AspectJ (tutorial session). In: ICSE, IEEE-CS: Computer Society and SIGSOFT: ACM Special Interest Group on Software Engineering and Irish Comp Soc: Irish Computer Society, p. 825. ACM Press, New York (2000)Google Scholar
  4. 4.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: Getting started with AspectJ. Commun. ACM 44, 59–65 (2001)CrossRefzbMATHGoogle Scholar
  5. 5.
    TheServerSide.COM: Interview with Gregor Kiczales, topic: Aspect-oriented programming (AOP) (2003),
  6. 6.
    Lopes, C.V., Lippert, M., Hilsdale, E.A.: Design by contract with aspect-oriented programming. U.S. Patent No. 6, 442, 750 (2002)Google Scholar
  7. 7.
    Diotalevi, F.: Contract enforcement with AOP (2004),
  8. 8.
    Skotiniotis, T., Lorenz, D.H.: Cona: aspects for contracts and contracts for aspects. In: OOPSLA Companion, pp. 196–197. ACM Press, New York (2004)Google Scholar
  9. 9.
    Meyer, B.: Object-Oriented Software Construction, 2nd edn. Prentice Hall Professional Technical Reference (1997)Google Scholar
  10. 10.
    Meyer, B.: Eiffel: The Language. Prentice Hall Professional Technical Reference (1991)Google Scholar
  11. 11.
    Kiczales, G.: AspectJ: Aspect-oriented programming in Java. In: Aksit, M., Mezini, M., Unland, R. (eds.) NODe 2002. LNCS, vol. 2591, pp. 1–1. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  12. 12.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    Lopes, C.V., Kiczales, G.: Recent developments in aspect. In: Demeyer, S., Bosch, J. (eds.) ECOOP 1998 Workshops. LNCS, vol. 1543, pp. 398–401. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  14. 14.
    Parnas, D.L.: On the criteria to be used in decomposing systems into modules. Commun. ACM 15, 1053–1058 (1972)CrossRefGoogle Scholar
  15. 15.
    Hannemann, J., Chitchyan, R., Rashid, A.: Analysis of aspect-oriented software. In: Buschmann, F., Buchmann, A., Cilia, M.A. (eds.) ECCV-WS 2003. LNCS, vol. 3013, pp. 154–164. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  16. 16.
    Bergmans, L.: Towards detection of semantic conflicts between crosscutting concerns. In: Hannemann, J., Chitchyan, R., Rashid, A. (eds.) Workshop on Analysis of Aspect-Oriented Software, ECOOP 2003 (2003)Google Scholar
  17. 17.
    Kiczales, G., Mezini, M.: Aspect-oriented programming and modular reasoning. In: ICSE, pp. 49–58. ACM Press, New York (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Stephanie Balzer
    • 1
  • Patrick Th. Eugster
    • 1
  • Bertrand Meyer
    • 1
  1. 1.Department of Computer ScienceETH Zurich (Swiss Federal Institute of Technology)ZürichSwitzerland

Personalised recommendations