Modular Contracts with Procedures, Annotations, Pointcuts and Advice by Henrique Rebelo, Ricardo Lima, and Gary T. Leavens CS-TR-11-05 September, 2011 Abstract There are numerous mechanisms for modularizing design by contract at the source code level. Three mechanisms have been the main focus of attention, metadata annotations, pointcuts and advice. The latter two are well-known aspect-oriented programming mechanisms, and according to the literature, fare better in achieving contract modularization. However, previous efforts aimed at supporting contract modularity actually hindered it. In this paper we report an enhanced use of pointcuts and advice, and show how crosscut programming interfaces (XPIs) can significantly improve contract modularity. In addition, we also discuss how these XPIs can be used together with annotations to tackle the pointcut fragility problem and minimize the limited enforcement of XPI interface rules. We compare our approach with the literature's in terms of code locality, well-defined interfaces, reusability, changeability, fragility, and pluggability. Keywords: Aspect-oriented programming, programming by contract, modularity. 2011 CR Categories: D.2.1 [Software Engineering] Requirements/ Specifications — languages, AOP, AspectJ; D.2.2 [Software Engineering] Design Tools and Techniques — computer-aided software engineering (CASE); D.2.4 [Software Engineering]Software/Program Verification — Assertion checkers, class invariants, formal methods, programming by contract, reliability, AOP, AspectJ; F.3.1 [Logics and Meanings of Programs] Specifying and Verifying and Reasoning about Programs —Assertions, invariants, pre- and post-conditions, specification techniques. To appear in SBLP 2011.