AuthorsL. Briand, J. W. Dzidek and Y. Labiche
EditorsI. C. Society
TitleInstrumenting Contracts With Aspect-Oriented Programming to Increase Observability and Support Debugging
AfilliationSoftware Engineering, Software Engineering
Publication TypeProceedings, refereed
Year of Publication2005
Conference Name21st IEEE International Conference on Software Maintenance (ICSM), Budapest, Hungary, September 25-30
ISBN Number0-7695-2368-4

Analysis and design by contract allows the definition of a formal agreement between a class and its clients, expressing each party's rights and obligations. Operation contracts and class invariants are known to be a useful technique to specify the precondition and postcondition of operations and the legal states of class instances in an object-oriented context, making the definition of object-oriented analysis or design elements more precise. Furthermore, it is also useful to check such contracts and invariants at run time in order to help testing and debugging during corrective maintenance. Indeed, experiments report a substantial gain when relying on instrumented contracts during those two activities. However, the instrumentation of such contracts is a time consuming activity. In this paper we report on how Aspect-Oriented Programming (AOP), using AspectJ, can be employed to automatically and efficiently instrument contracts and invariants in Java. The paper focuses on (1) the AspectJ templates to instrument preconditions, postconditions, and class invariants, (2) the necessary instrumentation for compliance-checking to the Liskov Substitution Principle.


Use of the attached PDF is subject to the IEEE terms found here:

Citation KeyBriand.2005.1