Open Aspects

https://doi.org/10.1016/j.cl.2005.09.003Get rights and content

Abstract

Open Aspects are our approach to face unplanned changes in systems that are based on aspect-oriented composition at runtime. They support explicit adaptation models, allowing developers to describe system change events to be observed, and corrective actions to be taken. These events and actions cover both the base system affected by aspects as well as the aspects affecting the base system themselves. The proper combination of change events and corrective actions allows for conditional just-in-time runtime re-composition. This paper offers a detailed discussion of difficulties related to change in aspect-oriented systems and a description of consistency constraints inherent to them. An implementation illustrating Open Aspects and their application is provided.

Introduction

Systems utilizing aspect-oriented programming (AOP) differ in how and when they carry out the processes of composing aspects into the base system, a process also known as weaving. There are systems that statically weave at compile or load-time. Other systems permit the composition of aspects at an application's runtime.

We usually prefer to carry out changes to our systems while they are offline so that the detection and resolution of problems that become apparent during aspects composition will not interfere with the running system. However, there are situations where such practice is not desirable, is inadvisable, or even impossible due to domain specific requirements to the system in question. In telecommunications, for instance, system downtime results in disruption of services, leading to less customer satisfaction, and because of that has to be kept to a minimum or to be avoided entirely [1], [2], [3]. Ambient and embedded computing infrastructures and environments are yet another example of systems that require online adaptations—changes to the running system. The reason for weaving in aspects dynamically results from the requirement that the system aspects to be woven are expected to change at runtime.

Recent work of the aspect-oriented software development community indicates that dynamic aspects are becoming of increased interest. Dynamic aspects offer compositions that can be made effective or revoked at runtime. Prominent activities in this research area are efforts to provide technologies for dynamic method call interception (MCI [4]) or extensions to virtual machines (VM) for enhanced method call dispatch. Systems like PROSE [5], [6], Steamloom [7], JAC [8], AspectL [9], or AspectS [10] are all concerned with hot-deployment of aspects. They employ runtime weaving to dynamically add new code, modify or remove available code or change the way the base application is interpreted. Their weaver considers the systems or code segments to be combined at one particular point in time. Pointcut expressions or predicates (both terms are used interchangeably in this text) are evaluated to compute sets of join-point shadows [11] to be instrumented, and integration steps are performed as necessary to provide the desired composed behavior. Join-point shadows are roughly correspondent locations of actual join-points in a program's representation such as the program's source or its meta structure. We consider poincut predicates to be one essential contribution of AOP to generically designate subsets of a system's computational properties. Examples for that are all accesses to an instance variable, all sends are receptions of a message, or all messages sent by a group of senders or received by a specific receiver.

Opening up systems and allowing them to be changed after their initial deployment—possibly by code providers other than the original one and probably while they are running—increases the likelihood of system changes not planned for at the beginning of their design and development. Furthermore, in such open systems the point in time changes can happen as well as their order and frequency are undetermined. Presence and characteristics of classes, instances, or methods can be revised at any instant or not at all. Furthermore, we can assume changes that not only address elements that belong to the base system, but to affect aspects themselves. Changing pointcuts and their associated sets of join-point shadows or changes to advice code is an example.

Changes like that can and will have an effect on AOP-induced invariants as mentioned above. Hence, a mechanism is needed to explicitly maintain these invariants.

As a simple illustration let us look at a system that uses classes not known at compile time but loads them dynamically on demand. New classes not known during the development and initial deployment of the original system thus appear. In such a situation the problem from the aspect-oriented point of view is that it is not clear how the system should behave. Should pointcut coverage be monitored, and, if necessary, should aspects be recomposed? Or should such changes be ignored at all? Questions like that are not addressed by current approaches and technologies.

Open Aspects is our approach to handling unplanned system changes at runtime. Open Aspects support explicit adaptation models, allowing developers to describe system change events to be observed and corrective actions to be taken in response to these events. System change events and corrective actions cover both the base system affected by aspects and the aspects themselves affecting the base system. The proper combination of change events and corrective actions allows for conditional just-in-time runtime re-composition.

Contributions of our paper include:

  • A description of consistency constraints inherent to aspect-oriented systems.

  • A detailed discussion of the associated change problem.

  • A solution to this change problem by separating and providing an explicit adaptation model to aspect developers.

  • An implementation illustrating our solution and its application.

In the next section we give a motivating example. In Section 3, we explain open aspects in general. Section 4 demonstrates how Open Aspects work in the presence of change. Section 5 describes openAspectS, our implementation of Open Aspects in AspectS. Section 6 shows an application example of OpenAspectS. After discussing related work in Section 7, we summarize our paper in Section 8 and come to a conclusion.

Section snippets

Aspect composition models

In most aspect-oriented systems there is typically a weaving mechanism that composes aspects and the base system they apply according to descriptions offered by pointcut predicates or expressions. Usually, such a composition is initiated by developers at a particular point in time. This point in time might vary from development-time, over compile- and load-time, up to runtime. Here it is important to note that each and every composition is either carried out implicitly by development tools or

System changes

In open systems that are allowed to change at runtime, aspect composition needs to explicitly address changes to both the base system and the set of aspects that have been applied to it. These changes comprise added, transformed, or removed classes and methods. The addition, modification/transformation, or removal of pieces of advice associated with an aspect or pointcut expressions or predicates associated with a piece of advice also need to be handled.

A weaver determines all join-point

Starting situation

In the following we will illustrate how Open Aspects behave in open systems. For that we will use the notation as shown in the right side of Fig. 12. In part (a), the left side of Fig. 12, we start out with two modules running on our platform with no aspects yet applied. This set of modules can be extended by adding new modules or curtailed by removing existing ones.

The L-shaped open platform represents that part of the runtime environment that remains quite stable over time with respect to

AspectS

AspectS extends Squeak to allow for experimental aspect-oriented system development. Its goal is to provide a platform for the exploration of dynamic late-bound aspect-oriented software composition. It employs coordinated meta-level programming to address the tangled code phenomenon. AspectS shows great flexibility by not relying on code transformations, but by making use of metaobject composition instead. AspectS provides a framework for developers to construct the proper runtime structure of

Starting situation

Our Open Aspects example starts out similarly to the one described in Section 2. This time we are utilizing the Open Aspects platform as shown in our code example. The main difference for the programmer is the additional adaptations attribute section for advice qualifiers.

In Fig. 19 we can see that the developer decided to let the advice being reinstalled in the event of a change to the base system that extends to the span of this piece of advice (adviceMouseEnter).

Since the pointcut

Load time weaving

Class loading in Java represents a simple form of open systems. Hence, if a system is designed in a way that it uses classes that are not known at compile-time then the underlying system is open. JMangler [18], Javassist [19], and EuLisp [20] are systems that permit the adaptation of classes at runtime. Hence, it permits one to adapt system changes (namely the addition of new classes to a running system). From the technical perspective, these systems would allow to build up an adaptation model

Summary and conclusion

In this paper, we identify the need to handle the weaving of aspects in open systems, that is to say systems that are intentionally designed to change at runtime, in a special way: it is necessary that the developer specifies how aspect compositions are to be maintained if changes to the system might affect them.

Open Aspects allow a system to respond to system change events appropriately by providing adaptation models. Adaptation models explicitly associate such change events with corrective

Acknowledgements

We would like to thank Alexandre Bergel, Gilad Bracha, Pascal Costanza, Stephane Ducasse, Jeff Eastman, Erik Ernst, and Dave Thomas for their valuable discussions and contributions.

References (25)

  • Hirschfeld R, Kawamura K. Dynamic service adaptation. In: Proceedings of the ICDCS 2004 workshop on distributed...
  • R. Hirschfeld et al.

    Dynamic service adaptation for runtime system extensions

  • Kawamura K, Hamard J, Hirschfeld R, Minokuchi A, Souville B. Sustainable evolutionary systems. In: NTT DoCoMo Technical...
  • Lämmel R. A semantical approach to method-call interception. In: Proceedings of the conference on aspect-oriented...
  • Popovici A, Gross Th, Alonso G. Dynamic weaving for aspect-oriented programming. In: Proceedings of the conference on...
  • Popovici A, Gross Th, Alonso G. Just in time aspects. In: Proceedings of the Conference on Aspect-Oriented Software...
  • Bockisch C, Haupt M, Mezini M, Ostermann K. Virtual machine support for dynamic join points. In: Proceedings of the...
  • Pawlack R, Seinturier L, Duchien L, Florin G. JAC: A flexible solution for aspect-oriented programming in Java. In:...
  • Costanza P. A short overview of AspectL. In Proceedings of the European interactive workshop on aspects in software...
  • R. Hirschfeld

    AspectS aspect-oriented programming with squeak

  • Masuhara H, Kiczales G, Dutchyn C. A compilation and optimization model for aspect-oriented programs. In: Proceedings...
  • Hanenberg S, Hirschfeld R, Unland R. Morphing aspects: incompletely woven aspects and continuous weaving. In:...
  • Cited by (4)

    View full text