Technical Report PHD-2007-03

Title: Applying Aspect-Oriented Software Development to Middleware Frameworks
Authors: Tal Cohen
Supervisors: Joseph (Yossi) Gil
Abstract: This work presents a suite of related programming constructs and technologies aimed at integrating \emph{aspect-oriented programming} (AOP) in the middleware frameworks used for enterprise application development. These constructs include \emph{shakeins} (and the \emph{AspectJ2EE} language design based on it), \emph{JTL} (the Java Tools Language), \emph{factories}, and \emph{object evolution}.

\emph{Shakeins} are a novel programming construct which, like mixins and generic classes, generates new classes from existing ones in a universal, uniform, and automatic manner: Given a class, a shakein generates a new class which has the same type as the original, but with different data and code implementation. This thesis argues that shakeins are restricted, yet less chaotic, aspects. It further claims that shakeins are well suited for the introduction of AOP into existing middleware applications.

To demonstrate the applicability of shakeins to the middleware framework domain, we introduce the \emph{AspectJ2EE} language which, with the help of shakeins and a new \emph{deploy-time} weaving mechanism, brings the blessings of AOP to the enterprise Java (J2EE) framework. A unique advantage of AspectJ2EE, which is less general (and hence less complicated) than AspectJ, is that it can be smoothly integrated into J2EE implementations without breaking their architecture.

Any aspect-oriented language or framework must provide developers with a mechanism for specifying a set of join points, i.e., program locations that should be modified by relevant aspects. Such ``pointcut'' specifications are commonly expressed using queries written in a dedicated, declarative language. We present \emph{JTL}, the Java Tools Language, as a new query language. JTL provides a rich and powerful query-by-example mechanism which minimizes the \emph{abstraction gap} between queries and the program elements they match. We further show how JTL can be extended to support \emph{program transformations}, going as far as making JTL an AOP language in its own right.

\emph{Factories} are presented as a new mechanism for controlling object instantiation, overcoming anomalies that can be found in the construction mechanisms of Java, C++, Eiffel and similar object-oriented languages. Factories (not to be confused with the \textsc{Factory Method} or \textsc{Abstract Factory} design patterns) provide classes with a complete control over their instantiation mechanism. In particular, classes can enforce the application of shakeins to all instances, without disturbing existing client code.

Finally, we allow shakeins to behave as \emph{dynamic aspects}, i.e., aspects that can be applied to an object or removed from it at runtime. Because applying a shakein to a class generates a new class, we find that this implies the ability to change an object's class at runtime---i.e., object reclassification is required. As it turns out, reclassification using shakeins is part of a more general concept, which we call \emph{Object Evolution}. Object evolution is a restriction of general reclassification by which dynamic changes to an object's class are \emph{monotonic}: an object may gain, but never lose, externally-visible properties. We argue that there are many applications of monotonic evolution in practical systems. The monotonicity property makes it easier to maintain static type safety with object evolution than in general object reclassification.

CopyrightThe above paper is copyright by the Technion, Author(s), or others. Please contact the author(s) for more information

Remark: Any link to this technical report should be to this page (, rather than to the URL of the PDF files directly. The latter URLs may change without notice.

To the list of the PHD technical reports of 2007
To the main CS technical reports page

Computer science department, Technion