Aspect-oriented programming (AOP) is a novel paradigm in software engineering and programming languages. It provides programmers with a powerful technique for modularizing crosscutting concerns, which cut across multiple classes or components. In this session, two papers reporting on programming experiences with AspectJ, which is a seamless aspect-oriented extension to Java and is one of the most popular AOP languages. The first paper shows that AspectJ implementations of Gang-of-Four (GoF) design patterns improve textual locality, reusability, and composability in comparison to pure Java implementations. The second paper illustrates their experiences of implementation of object distribution and persistence in AspectJ. It also proposes minor extensions to AspectJ that they discovered to be potentially useful during their development.
Implementing the GOF design patterns in both Java and AspectJ shows that in many cases the implementations can be improved with aspect-oriented techniques. The improvements fall into three main categories: textual locality, reusability, and composability. The degree of improvement in implementation varies, with the greatest improvement coming when the pattern solution structure involves crosscutting of some form, including one object playing multiple roles, many objects playing one role, or an object playing roles in multiple pattern instances.
This paper presents guidelines for implementing or refactoring distribution and persistence code using AspectJ, a general-purpose aspect-oriented extension to Java. These guidelines were derived from our experience on implementing distribution and persistence aspects in a real information system, a health complaint system, which was originally implemented in Java and restructured with AspectJ. We also identify a few drawbacks in the language and suggest some minor modifications that could significantly improve the implementations that could be derived by following our guidelines. Some of the aspects implemented in our experiment constitute a simple AspectJ framework, whereas others are application specific. Nevertheless we show that different implementations might follow a common AspectJ pattern. The framework and the pattern allow us to provide the general guidelines for both restructuring and implementing persistent and distributed applications with AspectJ.